Jump to content
  • Advertisement
Sign in to follow this  
ukdeveloper

Using OpenGL/SDL

This topic is 4770 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 started work on what will eventually be Breakout, all being well. I was just wondering, is there any real advantage to using the OpenGL draw routines as opposed to the SDL ones? Is OpenGL faster or something? I'm trying to broaden my horizons a little, as you can see. So far, I'm using SDL for the keyboard input and OpenGL for the graphics, but I can't get NeHe's code for writing text to the screen to work, I may have to fall back to SDL_TTF for that, and use OpenGL for everything else. So, back to my original question, what advantages are there (if any) to using the OpenGL drawing/blitting routines as opposed to SDL's? Or does it make no difference? Thanks for your help, ukdeveloper.

Share this post


Link to post
Share on other sites
Advertisement
Yes, there are lots of advantages to using OpenGL over SDL. You will undoubtly see a major improvement in performance as well as functionality if you choose OpenGL. Ok I'm not going to go knee deep into anything, but rest assured that you will have a lot of breathing room when making your game.

As a side note, for the new release of SDL, it will supposedly use OpenGL rather than DirectDraw [wink]

To address your problem on the NeHe code, if you want to get that to work with the SDL/OpenGL program, you will need to use the SDL_syswm header file to be able to get a HWND as well as the HDC needed for those examples.

#include "SDL_syswm.h"
...
static SDL_SysWMinfo pInfo; // Must be static or global
SDL_VERSION(&pInfo.version);
SDL_GetWMInfo(&pInfo);
...
HWND hwnd = pInfo.window;
HDC = hdc = GetDC(hwnd);

But, I'd just use SDL_ttf with OpenGL if you don't want to add in the Windows specific code.

Share this post


Link to post
Share on other sites
I'm sorry for "hijacking" this thread, but i just have to ask you Drew_Benton, what is that SDL_syswm.h you use? Is it some kind of "bridge" to Win32, or is it speciffic to SDL? I tried to google for it, but i didn't find anything really helpful to explain it...

Could you please be kind and post something about it, or send me a private msg if you have the time? =)

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!