Using SDL_ttf with OpenGL
问题 I'm using OpenGL and SDL to create a window in my program. How do I use SDL_ttf with an OpenGL window? For example I want to load a font and render some text. I want to draw the text using an SDL OpenGL surface. 回答1: Here's how to do it: Initialize SDL and SDL_ttf, and create a window using SDL_SetVideoMode() . Make sure you pass the SDL_OPENGL flag. Initialize your OpenGL scene ( glViewport() , glMatrixMode() etc.). Render your text with SDL_ttf using e.g. TTF_RenderUTF8_Blended() . The