OpenGL + SDL + Changing Resolution

I ran into some troubles changing the resolution of a
program using OGL and SDL (1.2.5).

Specifically, when recalling SDL_SetVideoMode. I tried
adding the SDL_RESIZE flag in both places, to no
avail. This is for fullscreen…

It would seem that the OpenGL system is not updated
with the new settings. That is, if I upgrade
resoultions, the OpenGL system uses the original size,
and the glOrtho calls act as if that section is the
screen.

For example, if I started in resolution 1600x1200,
then downgraded to 800x600, a call to
glOrtho(0,400,0,300,-1,1) would act as if I had called
glOrtho(0,200,0,150,-1,1).

Going the other way (starting at 800x600 and going to
1600x1200) the call acts like
glOrtho(0,800,0,600,-1,1) with everything past
400x300 being clipped (aka only the lowwer left part
of the screen is displayed).

I have gotten around this problem by calling
SDL_SetVideoMode twice on resizing…first without the
SDL_OPENGL flag, then with it. This has the
unfortunate side effect of forcing me to reload all my
textures and re-enable all my OpenGL flags, as well
as adding extra time to resize.

Am I doing something wrong, or should the code be
patched? (I’m fairly newb… I don’t know how to
create patch files… and would most likely muck
something up in the system trying to fix it :slight_smile: )__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Specifically, when recalling SDL_SetVideoMode. I tried
adding the SDL_RESIZE flag in both places, to no
avail. This is for fullscreen…

It would seem that the OpenGL system is not updated
with the new settings. That is, if I upgrade
resoultions, the OpenGL system uses the original size,
and the glOrtho calls act as if that section is the
screen.

For example, if I started in resolution 1600x1200,
then downgraded to 800x600, a call to
glOrtho(0,400,0,300,-1,1) would act as if I had called
glOrtho(0,200,0,150,-1,1).

Going the other way (starting at 800x600 and going to
1600x1200) the call acts like
glOrtho(0,800,0,600,-1,1) with everything past
400x300 being clipped (aka only the lowwer left part
of the screen is displayed).

I have gotten around this problem by calling
SDL_SetVideoMode twice on resizing…first without the
SDL_OPENGL flag, then with it. This has the
unfortunate side effect of forcing me to reload all my
textures and re-enable all my OpenGL flags, as well
as adding extra time to resize.

Am I doing something wrong, or should the code be
patched? (I’m fairly newb… I don’t know how to
create patch files… and would most likely muck
something up in the system trying to fix it :slight_smile: )

Yes, You must patch YOUR code.
Use glViewport()

  • snip *

Am I doing something wrong, or should the code be
patched? (I’m fairly newb… I don’t know how to
create patch files… and would most likely muck
something up in the system trying to fix it :slight_smile: )

Yes, You must patch YOUR code.
Use glViewport()

  • slaps forehead * Doh! Thanks for the hint :).

btw: is it just me or is the doc project 'add notes’
script not working? (and giving ‘invalid parameter’ as
an error?)

I happen to know php if the web admins are busy…__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software