Initialization order

Greets,

I’m working on an open-source game project which uses SDL & OpenGL. I’m
just about to get something to display on screen (won’t that be nice?)
but nothing shows up, so I thought I’d step through my source code and
see what’s happenning.

I noticed that the way I have it right now, I’m initializing the SDL
video system, setting up some basic OpenGL states, i.e.:
glEnable(GL_DEPTH_TEST), etc… and then setting the video mode. Now,
under windows, I’d need to set screen resolution before I could get a
rendering context, which probably means none of my OpenGL setup is
affecting anything…

So the question is this: can I start making opengl calls before getting
an SDL_Surface and expect it to have an effect, or should I be setting
the resolution and THEN performing OpenGL setup?

I realize this probably will not allow me to see my geometry, but I’d
like to think I’m heading off problems down the road.

Many thanks,
– Jeff Duncan
thaellin at bigfoot.com

You shouldn’t/can’t make OpenGL calls before you call SDL_SetVideoMode, there
is no contect and things can get fubar pretty quickly.On Sat, Nov 18, 2000 at 07:04:36PM -0800, Jeff Duncan wrote:

So the question is this: can I start making opengl calls before getting
an SDL_Surface and expect it to have an effect, or should I be setting
the resolution and THEN performing OpenGL setup?


Martin

Bother said the Moderator, &$&^%NO CARRIER