Jump to content
  • Advertisement
Sign in to follow this  
vurentjie

OpenGL switching sdl opengl

This topic is 3849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, is there any info in the sdl docs about switching between sdl and opengl? or do i actually need this? basically, say i create an opengl window then at a later stage i want to use sdl to draw(or do something else), could i just use flags for this, or would this hamper the opengl, i haven't tested anything yet so this is just to ask for some advice beforehand, obviously i would have to be careful that the opengl state doesn't change while doing other sdl stuff, and when opengl gets recalled it is as before. am i thinking correctly?

Share this post


Link to post
Share on other sites
Advertisement
At any time, your window can either be an OpenGL context or a SDL based surface. In order to switch between them you would have to call SDL_SetVideoMode again, which would ditch the current OpenGL context or dispose of the current SDL frame buffer.

If you want to have a 2D overlay on OpenGL, you can use something like this to get the correct matrices, then draw what you want. Code to upload a SDL_Surface to an OpenGL texture is provided with the SDL source code (it is in the "test" folder, or was last time I checked).

Here is an example that demonstrates these concepts.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!