|
Title: Hinting GL Version on Mavericks causes GLEW to explode Post by: giantrobotbee on October 27, 2013, 02:31:39 PM I had code that successfully ran with the 3.2 core profile on Mountain Lion after hinting with SDL_GL_SetAttribute as such:
Code: SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); I recently updated to Mavericks which supposedly supports OGL 4.1 core. I updated my hinting to try and get a 3.3 profile, but GLEW throws an "EXEC_BAD_ACCESS" error at glewInit(). If I trace out the version number as such: Code: GLdouble maj = 0; glGetDoublev(GL_MAJOR_VERSION, &maj); GLdouble min = 0; glGetDoublev(GL_MINOR_VERSION, &min); std::cout << "OpenGL Version: " << maj << "." << min << std::endl; I get some fun results. If I comment out the hinting, I get "OpenGL Version: 0.0" If I leave the hinting at Maj: 3, Min: 2, I get "OpenGL Version: 4.1" Has anyone run into this? Is my hinting code wrong? I want a 3.3 context and maybe some pumpkin pie but it looks like I'm just doomed to not get what I want. WOE IS ME! Any help is appreciated. Cheers! Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: Gregg Williams on October 27, 2013, 05:20:02 PM Seems like it might be this or related to it. https://github.com/nigels-com/glew/issues/3
Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: 516VATR on October 27, 2013, 06:14:07 PM ther is probs a really easy fix to this, try and trace the problem yuorssefl it will be fun
Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: JakobProgsch on October 28, 2013, 02:48:15 AM I would try something like gl3w (even if you don't use it, just for verification), since glew tends to be weird with core profiles in general.
Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: Thomas Hiatt on October 28, 2013, 07:00:41 AM I am using the NSOpenGLContext class and there are not many options for choosing what opengl version you want. The only thing I have found is a NSOpenGLProfileVersion3_2Core that will give you a version 4.1 context if available or a 3.2 version context. I think that is also the only thing to choose when using a CGLContext. I don't know what SDL does exactly, and I do not have time to check at the moment, but that might be the reason for you not getting what you ask for.
Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: giantrobotbee on October 28, 2013, 07:31:38 AM I am using the NSOpenGLContext class and there are not many options for choosing what opengl version you want. The only thing I have found is a NSOpenGLProfileVersion3_2Core that will give you a version 4.1 context if available or a 3.2 version context. I think that is also the only thing to choose when using a CGLContext. I don't know what SDL does exactly, and I do not have time to check at the moment, but that might be the reason for you not getting what you ask for. That seems to mirror the behaviour I'm experiencing. I can get a 3.2 or a 4.1 context and nothing else. I will try gl3w and there are a few things I need to try after digging into that GLEW ticket mentioned by Gregg. I will report back if I find anything. Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: Thomas Hiatt on October 28, 2013, 09:57:31 AM I found the part of the SDL source code that creates the NSOpenGLContext.
Code: const int wantver = (_this->gl_config.major_version << 8) | If you ask SDL for a context version greater than 3.2 it will set an error and return null, which is why it breaks when you do that. The problem isn't with glew it is that SDL doesn't give you a context with that version number. You could change the SDL code to still give you a context, or you can only ask for a 3.2 context when using a mac.(_this->gl_config.minor_version); SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; SDLOpenGLContext *context; NSOpenGLContext *share_context = nil; int i = 0; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { SDL_SetError ("OpenGL ES not supported on this platform"); return NULL; } /* Sadly, we'll have to update this as life progresses, since we need to set an enum for context profiles, not a context version number */ if (wantver > 0x0302) { SDL_SetError ("OpenGL > 3.2 is not supported on this platform"); return NULL; } pool = [[NSAutoreleasePool alloc] init]; /* specify a profile if we're on Lion (10.7) or later. */ if (data->osversion >= 0x1070) { NSOpenGLPixelFormatAttribute profile = kCGLOGLPVersion_Legacy; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { if (wantver == 0x0302) { profile = kCGLOGLPVersion_3_2_Core; } } attr[i++] = kCGLPFAOpenGLProfile; attr[i++] = profile; } Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: Gregg Williams on October 28, 2013, 10:01:48 AM Just use 2.1 :)
Title: Re: Hinting GL Version on Mavericks causes GLEW to explode Post by: giantrobotbee on October 28, 2013, 05:05:22 PM I found the part of the SDL source code that creates the NSOpenGLContext. Code: const int wantver = (_this->gl_config.major_version << 8) | If you ask SDL for a context version greater than 3.2 it will set an error and return null, which is why it breaks when you do that. The problem isn't with glew it is that SDL doesn't give you a context with that version number. You could change the SDL code to still give you a context, or you can only ask for a 3.2 context when using a mac.(_this->gl_config.minor_version); SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; SDLOpenGLContext *context; NSOpenGLContext *share_context = nil; int i = 0; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { SDL_SetError ("OpenGL ES not supported on this platform"); return NULL; } /* Sadly, we'll have to update this as life progresses, since we need to set an enum for context profiles, not a context version number */ if (wantver > 0x0302) { SDL_SetError ("OpenGL > 3.2 is not supported on this platform"); return NULL; } pool = [[NSAutoreleasePool alloc] init]; /* specify a profile if we're on Lion (10.7) or later. */ if (data->osversion >= 0x1070) { NSOpenGLPixelFormatAttribute profile = kCGLOGLPVersion_Legacy; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { if (wantver == 0x0302) { profile = kCGLOGLPVersion_3_2_Core; } } attr[i++] = kCGLPFAOpenGLProfile; attr[i++] = profile; } Dangit. That's what I get for being an early adopter. https://bugzilla.libsdl.org/show_bug.cgi?id=1942 (https://bugzilla.libsdl.org/show_bug.cgi?id=1942) |