Skip to main content
GameDev.net gamedev.net
🔒 Locked

glGetString returns 0

Started by PaladinOfKaos Jan 1, 2007 at 4:26 PM 1 replies 650+ views
Original Post
PaladinOfKaos
PaladinOfKaos
I've created my context using SDL, and I can use all the OpenGL 1.1 calls that are native in Windows. But for some reason, glGetString() returns 0. I've tried all the values that are valid for that function, and none of them return a valid string. If I was using my own extension system, this wouldn't be a huge problem... but I'm using GLEW, and it won't work if that function doesn't give it the right information.

// SDL_GL_SetAttribute() calls for multisampling, depth buffer, stencil buffer, etc.
_screen_surface = SDL_SetVideoMode(ScreenWidth, ScreenHeight, 0, SDL_OPENGL);
glewInit();
Is there another call that needs to be made to make SDL's context active? Could having _screen_surface as a private member of my RenderingSystem class be causing the problem?
FReY
FReY
I'd suggest, as a test, trying a call to glGetString() in your application when your context is actually made current (ie. where you're actually doing some rendering).

If that works, then it means that SDL has not made the OpenGL context current at the point you're trying to call glGetString() and the 0 result should be expected.
do unto others... and then run like hell.
PaladinOfKaos
PaladinOfKaos
Well, I officially feel really, really stupid...

I had made an adjustment to the config file at the same time I had started adding extension code... It turns out a typo had me trying to create a fullscreen window at a resolution that wasn't possible, and I wasn't getting a context.

That's what I get for not making sure the SDL surface is valid, I suppose. I've put code in to check that, and fixed my config file. It's all working now.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.