I understand OpenGL doublebuffering ending with the GDI swapbuffers command. I want to take that further and after the OpenGL frame is rendered, draw a line of text to the top of the frame and then swapbuffers.
Originally posted by camoguard:
[b]I understand OpenGL doublebuffering ending with the GDI swapbuffers command. I want to take that further and after the OpenGL frame is rendered, draw a line of text to the top of the frame and then swapbuffers.
Can I do it?
How?
Thanks in advance for any advice,
cam[/b]
No, it’s impossible. GDI does not know anything about OpenGL backbuffers.
SwapBuffers is not a GDI function, it’s a Win32 API function and just a shortcut for wglSwapLayerBuffers.
Why can’t you render the text with OpenGL instead?
There is wglUseFontBitmaps which build a font for you and text rendering code with that looks like this:
glColor3f(r, g, b); // Text color (assert lighting off). Issue before glRasterPos!
glRasterPos2i(x,y) // Baseline startpoint of first character. RasterPos is transformed by the current modelview matrix!
glListBase(baseOfFirstCharacter);
GLubyte sz[] = "Your text goes here!";
glCallLists(strlen(sz), GL_UNSIGNED_BYTE, sz);