• Advertisement
Sign in to follow this  

C++ and OpenGL or C++ and SDL

This topic is 3033 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

I've been doing some minor programming for a few years. Used BlitzBasic for a little while, but then I moved to C++. I wanted to try making a game from scratch with OpenGL and GLUT. Is it worth it to trudge through the textbooks and learn every aspect of 3D rendering, or am I better off just using something like SDL. I know GLUT doesn't have anything for audio playback in it, so I would have to use something like OpenAL. I'm starting to think I could save myself a lot of frustration by using SDL which has all the makin's for a game. Have any of you been in this situation? Should use SDL, but continue to read my OpenGL book? I believe SDL uses OpenGL for rendering. Is it possible to interact directly with OpenGL through SDL, even access the OpenGL Shader Language (I have no idea how to use this, it just sounds interesting and potentially very powerful.)

Share this post


Link to post
Share on other sites
Advertisement
SDL has two rendering modes. One is just to use SDL's rendering functions. In this case, the exact backend is dependent on your platform, but it probably won't be OpenGL *.

The second is to tell SDL to create an OpenGL rendering context. This is done by passing SDL_OPENGL to SDL_SetVideoMode(). In this case, you do all the drawing with raw OpenGL calls and use SDL just for window creation, context management and syncing (using SDL_GL_SwapBuffers). There are no restrictions, you are talking directly to OpenGL, you can use shaders etc.

I use the latter method, it works very well.

* Actually, the as-yet unreleased SDL 1.3 will support OpenGL as a direct backend. The API is heavily modified however.

Share this post


Link to post
Share on other sites
Yeah, It seems like SDL is the best choice, In the past I have been using GLUT for window management and user input. SDL has a sound library as well which is good. And the ability to specifically talk to OpenGL is nice to have because all that money I spent on the OpenGL SuperBible won't go to waste. Thanks for the input fellas.

Share this post


Link to post
Share on other sites
I haven't done much with SDL yet, but the little I did used OpenGL for graphics (because I had done a little OpenGL before that). So it is definitely not an SDL OR OpenGL choice, it's the choice to use SDL or not really. I say give it a try, it is definitely 1 of the 5 most popular beginner game libraries and doesn't have too many major problems.

Share this post


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

  • Advertisement