Jump to content
  • Advertisement
Sign in to follow this  
_sim

OpenGL SDL and OpenGL

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

Hey everyone, I'm working on a very basic game engine and trying to get some rendering things down but I've run into some problems. I'm using a combo of SDL and OpenGL for the graphics and SDL_ttf for text, but things don't seem to be working properly. I'm guessing the main problem is that I don't fully understand graphics (SDL and OpenGL) and I'm just using code from the NeHe tutorials without understanding what exactly it's doing. For example, calls such as: SDL_GL_SwapBuffers(); SDL_Flip(screen); SDL_BlitSurface(textSurface, NULL, screen, &textLocation); I'm not too sure what they do. I have a semi-idea after doing some reading, but all defenitions involve the term itself. For example, SDL_Flip will be listed in the man pages as Flip the buffer. Or SDL_BlitSurface will be defined as blitting a surface. That really doesn't help me understand what exactly they are doing since I don't know what a "blit" is in the first place. Is there a glossary someone can point out that will help me understand some of the basics of the terminology and how it all works at a hardware/software level? My second question is regarding the problems I'm having. I'm trying to get SDL_ttf to work as well as OpenGL. When I have OpenGL working, the 2D SDL_ttf iterms will not work. I enable SDL in one of 3 ways and each gives a different result with how things will work:
mSurface = SDL_SetVideoMode(640, 480, 32, SDL_OPENGLBLIT | SDL_HWSURFACE | SDL_DOUBLEBUF );
mSurface = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF );
mSurface = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF );
The first one will allow me to call SDL_GL_SwapBuffers() and SDL_BlitSurface(textSurface, NULL, screen, &textLocation) and SDL_Flip but will only render only a white screen. The second will crash on my SDL_Flip() call in my Renderer. The Third will let me render my SDL_ttf and 2D stuff without any problems, but and OpenGL stuff obviously doesn't work. How do I make it so that I can get both my 2D SDL and 3D OpenGL stuff working at the same time so I can render my FPS counter and my cube at the same time? I know this is very basic stuff, but I'm having problems finding good resources that explain SDL/OpenGL combo for a total beginner. I guess I will also cross post this in the beginners forums as someone there might be able to offer advice on the overall SDL/OGL portion. Thanks! Sim

Share this post


Link to post
Share on other sites
Advertisement

This topic is 4789 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.

Guest
This topic is now closed to further replies.
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!