Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9070215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:37:49+00:00 2026-06-16T17:37:49+00:00

I have a library, which is engaged in rendering on opengl and prinimaet streams

  • 0

I have a library, which is engaged in rendering on opengl and prinimaet streams from the network.

I write under a poppy, but plans to use on linux

so the window is created for objective c
I start drawing in a separate thread in the other receiving and decoding the data.

I crash bug (EXT_BAD_ACCESS) on methods of opengl, even if I use them only in a single thread.

my code
main glut:

int main(int argc, const char * argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
int win = glutGetWindow();
glutInitWindowSize(800, 600);
glutCreateWindow("OpenGL lesson 1");
client_init(1280, 720, win, "192.168.0.98", 8000, 2222);
return 0;

}

or objective c

- (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat*)format{
self = [super initWithFrame:frameRect];
if (self != nil) {
    NSOpenGLPixelFormatAttribute attributes[] = {

        NSOpenGLPFANoRecovery,
        NSOpenGLPFAFullScreen,
        NSOpenGLPFAScreenMask,
        CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
        (NSOpenGLPixelFormatAttribute) 0
    };
    _pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
    if (!_pixelFormat)
    {
        return nil;
    }
    //_pixelFormat   = [format retain];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(_surfaceNeedsUpdate:)
                                                 name:NSViewGlobalFrameDidChangeNotification
                                               object:self];
    _openGLContext = [self openGLContext];
    client_init(1280, 720, win, "192.168.0.98", 8000, 2222);
}
return self;

}

client_init code

    // pthread_create(&posixThreadID, NULL, (void*(*)(void*))ShowThread, dh_tmp);
pthread_create(&posixThreadID, NULL, (void*(*)(void*))ShowThread, NULL);

void* ShowThread(struct drawhandle * dh){

        //glViewport(0, 0, dh->swidth, dh->sheight);//EXT_BAD_ACCESS
        glViewport(0, 0, 1280, 720);//EXT_BAD_ACCESS

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        //gluOrtho2D(0, dh->swidth, 0, dh->sheight);
        gluOrtho2D(0, 1280, 0, 720);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

    ...
        return 0;
    }

I think the problem is? that uncreated context opengl.

How to create it in macos / linux?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:37:50+00:00Added an answer on June 16, 2026 at 5:37 pm

    This thread has no current OpenGL context. Even if you did create a context earlier in the program (not visible in your snippet), it will not be current in the thread you launch.

    An OpenGL context is always, with no exceptions, “current” for exactly one thread at a time. By default this is the thread that created the context. Any thread calling OpenGL must be made “current” first.

    You must either create the context in this thread, or call glXMakeCurrent (Unix/Linux) or aglMakeCurrent (Mac) or wglMakeCurrent (Windows) inside ShowThread (before doing anything else related to OpenGL).

    (probably not the reason for the crash, though… see datenwolf’s answer for the likely reason of the crash — nevertheless it’s wrong)`

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a native library which is invoked by the JNI function called from
I have a library from which I'd like to create two RPM packages. While
I have a class library which I want to call from my .NET application
I have an unmanaged library which I want to use from a managed class.
I have a class library which is called through COM from a Third Party
I have an android application (running under support library) which have MyListFragment class extends
I have a library which parses various messages, sent in binary form from multiple
I have an infrastructure library which must be used from both WinForms and ASP.Net.
I have an asynchronous library which is compiled under .NET 3.5, since it's used
I have this library called BASS which is an audio library which I'm going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.