Hello.
I’m trying to print some text in my window that is running an OpenGL
context.
I would like to know what is the best (and simplest) approach for that.
Is there a way to use both SDL_GL_CreateContext and SDL_Renderer for the
same window?
I tried it, but it only draws the last renderer called.
So, i made some research and found this
http://www.gamedev.net/topic/284259-for-reference-using-sdl_ttf-with-opengl/
with a good example to render a SDL_Surface in OpenGL.
But I noticed that for every frame the texture is generated and rendered.
Are those my only options?
Thanks in advance.
2014-04-29 19:31 GMT+02:00 Felipe Augusto :
Hello.
I’m trying to print some text in my window that is running an OpenGL
context.
I would like to know what is the best (and simplest) approach for that.
Is there a way to use both SDL_GL_CreateContext and SDL_Renderer for the
same window?
I tried it, but it only draws the last renderer called.
So, i made some research and found this
http://www.gamedev.net/topic/284259-for-reference-using-sdl_ttf-with-opengl/
with a good example to render a SDL_Surface in OpenGL.
But I noticed that for every frame the texture is generated and rendered.
Are those my only options?
Thanks in advance.
Normally you’d just reuse a texture and upload newly rendered pixels from
TTF into it,
then draw a textured quad. Here’s a basic tutorial on OpenGL:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/
A quad (rectangle) is drawn by splitting it up into two triangles.