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
Does SDL work with Opengl 3.2 ?
I havn't tried it, but this was the first hit on google with the following search term "SDL OpenGL 3.2":
Creating a Cross Platform OpenGL 3.2 Context in SDL
Creating a Cross Platform OpenGL 3.2 Context in SDL
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).
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 ?
Is there any tutorial of getting text and timer function in opengGL 3.2 or something ?
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.
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.
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.
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.
Aslo does anyone know how to use glfonts to display text as a hud ? It should remain stable in the top of screen.
If you want just timer functionality, only initialize the timer.
From then on, you can track how many milliseconds have passed since the program started.
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 stuffUint32 current = SDL_GetTicks() - start; // how much time has passed// ...SDL_Delay(500); // pause for half a second
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement