View previous topic :: View next topic |
Author |
Message |
BLM768
Joined: 22 Feb 2012 Posts: 13
|
Posted: Thu May 24, 2012 4:44 pm Post subject: Unable to load OpenGL 3 context |
|
|
I've run into a problem again . Now I can create the context, but DerelictGL3.reload() fails to get anything newer than GL11. I'm sure that my graphics card has support for the new versions, so I'm not sure why Derelict isn't picking it up. Probably my code again; here's what I've got:
Code: |
DerelictSDL2.load();
DerelictSDL2Image.load();
DerelictGL3.load();
//Set up SDL, etc:
if(SDL_Init(SDL_INIT_EVERYTHING) != 0) {
throw new Error("Unable to initialize SDL:" ~ to!string(SDL_GetError()));
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBufferSize);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBufferSize);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
window = SDL_CreateWindow(null, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
width, height, SDL_WINDOW_OPENGL);
if(!window)
throw new Error("Unable to create SDL window: " ~ to!string(SDL_GetError()));
context = SDL_GL_CreateContext(window);
if(!context) {
throw new Error("Unable to create OpenGL context");
}
GLVersion glVersion = DerelictGL3.reload();
writeln(glVersion);
if(glVersion < GLVersion.GL32) {
throw new Error("Unable to create OpenGL 3.2 or higher context. Please update your graphics drivers.");
}
|
I always get GL11 after the reload() call for some reason. If you can't see anything that's obviously wrong, I'll probably just copy some code that actually works. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri May 25, 2012 1:08 am Post subject: |
|
|
I suggest that right after calling SDL_GL_CreateContext, you print the result of glGetString(GL_VERSION) and see what it says. If it reports 1.1, there's a problem somewhere in your context creation, but if you get back the correct version, it means I've got a subtle bug in Derelict. In addition, check glGetString(GL_VENDOR). If it says "Microsoft", then you're getting the software version of the drivers (which is always 1.1) and there's definitely a problem with your context creation.
Furthermore, I recommend you add this to your OpenGL hints:
Code: |
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
|
With that set, you should wind up with a an error on context creation instead of the Microsoft software renderer. And then a call to SDL_GetError might give you an idea as to what's wrong. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
BLM768
Joined: 22 Feb 2012 Posts: 13
|
Posted: Fri May 25, 2012 8:22 am Post subject: |
|
|
It looks like I am getting Microsoft's renderer, but SDL_GL_ACCELERATED_VISUAL doesn't seem to be stopping that. SDL_GetError() returns "GL 3.x is not supported," so it might be a driver issue. I'll try updating my drivers.
It's just a little strange that I have gotten this error on every computer I've tried; I may just have been very unlucky. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
|
Back to top |
|
|
BLM768
Joined: 22 Feb 2012 Posts: 13
|
Posted: Tue May 29, 2012 7:22 pm Post subject: |
|
|
I've asked the people on the SDL mailing list. So far, no one has an answer that works on my system, but it's only been about a day since I first posted. I'll give it a bit longer and maybe see if I get the same problems with C++ (although I'd rather not have to mess with that ). |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|