Jump to content
  • Advertisement
Sign in to follow this  
kimi

OpenGL Does SDL work with Opengl 3.2 ?

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

Hi all,

Can anyone tell me whether SDL works with OpenGL 3.2 I need to have some text and timer. I think SDL is easier but does it work with 3.2 ? Glut also does the same thing ? Is it compatible with 3.2?


I am new to this but have to use openGL 3.2

Share this post


Link to post
Share on other sites
Advertisement
Using OpenGL 3.x with SDL requires using the highly unstable SDL 1.3 branch. Otherwise, you are stuck with a legacy context using the stable SDL 1.2 branch. That's not a terrible thing, though. Unless you plan on using 3.x specific functionality (stuff like instanced drawing), you can code in a very "OpenGL 3 way" (just avoid deprecated functionality).

Share this post


Link to post
Share on other sites
Thanks for replies. Yeah there is example in C but still if I can get the text and timer in SDL 1.214 working in openGL 3.2 that's all I want in this projectm I a using VS 2010, VC plus plus.Can anyone elaborate more if I can some trick to get this working ?

Is there any tutorial of getting text and timer function in opengGL 3.2 or something ?

Share this post


Link to post
Share on other sites
You can use freetype for text, just google it and tutorials on how to use it with OpenGL.

As to timers, you can use SDL 1.2's timers without creating a window, but it's probably neater to just switch to another library (GLFW for example) that supports OpenGL 3+ contexts until SDL 1.3 is officially out.

Share this post


Link to post
Share on other sites
Yeah, just keep in mind that there zero relationship between OpenGL and timers. There will never be an "OpenGL timer". You will always find timer functionality in other APIs. That is why SDL is so good: it is an all-in-one solution. It has timers, threads, etc.

Share this post


Link to post
Share on other sites
hmm ok thanks. I will try to use the timer without creating a window in SDL but is it possible to use it in openGL ? Some other method is used for timers by Win32 ?


Aslo does anyone know how to use glfonts to display text as a hud ? It should remain stable in the top of screen.

Share this post


Link to post
Share on other sites
If you want just timer functionality, only initialize the timer.


if (SDL_Init(SDL_INIT_TIMER) < 0)
{
// failed to initialize
}



From then on, you can track how many milliseconds have passed since the program started.


Uint32 start = SDL_GetTicks();

// do lots of stuff

Uint32 current = SDL_GetTicks() - start; // how much time has passed

// ...

SDL_Delay(500); // pause for half a second


Share this post


Link to post
Share on other sites
Thanks. I will try. Thinking of using SDL for timer function but printing this on openGL is also a problem [sad]

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!