OpenGL glGetError under SDL

G’day folks

I’m having a problem with calling glGetError() when linking to SDL - I’ve
attached a ZIP file with the exact code that I have issues with.

Under Linux, it compiles and runs without error and does what I’d expect it
to (i.e. not show that an OpenGL error has occurred), but under XP with
VS2005, I get a (seemingly) endless loop in my showGLError() function just
after calling SDL_Init(), and I’ve really no idea why. I’m left with the
impression that there may be some known issue with SDL and glGetError() that
I’m not aware of though.

I can provide my Linux Makefile and / or VS2005 .vcproj / .suo files and
whatever if that’d help too.

Cheers
Simon
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDLTest.zip
Type: application/zip
Size: 1435 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060216/7313ec67/attachment.zip

Simon Winwood wrote:

G’day folks

I’m having a problem with calling glGetError() when linking to SDL -
I’ve attached a ZIP file with the exact code that I have issues with.

Under Linux, it compiles and runs without error and does what I’d
expect it to (i.e. not show that an OpenGL error has occurred), but
under XP with VS2005, I get a (seemingly) endless loop in my
showGLError() function just after calling SDL_Init(), and I’ve really
no idea why. I’m left with the impression that there may be some known
issue with SDL and glGetError() that I’m not aware of though.

I can provide my Linux Makefile and / or VS2005 .vcproj / .suo files
and whatever if that’d help too.

Cheers
Simon
While this is an odd thing to see, I agree (and, I can’t test it from
where I am now), it’s not completely unexpected. In any case, you
should probably avoid calling any GL function until after you’ve
actually attempted to create a GL context (SDL_SetVideoMode(w, h, bpp, SDL_OPENGL)). I’m not completely sure if this is a real flaw in the
Windows implementation of OpenGL, or if it is a non-standard flexibility
in the Linux implementation you’re using.

Out of curiosity, what error(s?) is it returning in the infinite loop?

BTW, I’d be willing to bet that if you didn’t have that if block (line
54) in there, you’d see the same thing come from the call on line 88.
AFAIK, nobody’s actually come up with a case where SDL, under normal
recommended use, was changing the behavior of GL in some way.

  • Silicon

You were spot on … if I don’t perform a call to my function showGLErrors()
(which does the glGetError()) before I create the SDL_SetVideoMode() it
works fine.

FYI the errors returned were pasted into the source I attached, namely :

OpenGL error before line 96 in y:\src\sdltest\sdltest.cpp : invalid

operation (last good check @ line 89)

i.e. “invalid operation”, which I guess in hindsight, it would be, if there
was no context :o)

Excellent stuff. Thanks for the quick response! Chalk it up to
yet-another-difference-between-Windows-and-Linux I guess.

SimonOn 2/16/06, John Silicon wrote:

Simon Winwood wrote:

G’day folks

I’m having a problem with calling glGetError() when linking to SDL -
I’ve attached a ZIP file with the exact code that I have issues with.

Under Linux, it compiles and runs without error and does what I’d
expect it to (i.e. not show that an OpenGL error has occurred), but
under XP with VS2005, I get a (seemingly) endless loop in my
showGLError() function just after calling SDL_Init(), and I’ve really
no idea why. I’m left with the impression that there may be some known
issue with SDL and glGetError() that I’m not aware of though.

I can provide my Linux Makefile and / or VS2005 .vcproj / .suo files
and whatever if that’d help too.

Cheers
Simon
While this is an odd thing to see, I agree (and, I can’t test it from
where I am now), it’s not completely unexpected. In any case, you
should probably avoid calling any GL function until after you’ve
actually attempted to create a GL context (SDL_SetVideoMode(w, h, bpp, SDL_OPENGL)). I’m not completely sure if this is a real flaw in the
Windows implementation of OpenGL, or if it is a non-standard flexibility
in the Linux implementation you’re using.

Out of curiosity, what error(s?) is it returning in the infinite loop?

BTW, I’d be willing to bet that if you didn’t have that if block (line
54) in there, you’d see the same thing come from the call on line 88.
AFAIK, nobody’s actually come up with a case where SDL, under normal
recommended use, was changing the behavior of GL in some way.

  • Silicon

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl