Text disappears in the off-screen rendering bitmap


Now i am working on off-screen rendering of an OpenGL view (under MS-Windows) so that I can generate an AVI file from the bitmaps.
My approach is similar to the approach in OpenGL SuperBible–a memory device context is first created and binded, then draw the model to a buffer, and save the buffer as bitmap file.

Everything is OK except i cannot show the text on the screen to the generated bitmap. I use the bitmap fonts in above book (2/e, p.245), bascially based on MS-Win 32 API wglUseFontBitmap().

The text display is OK on screen but disappear in the bitmap. i cannot figure out it’s the problem of pixel format setting or font library. I use the same rendering function for on-screen and off-screen rendering.

Any idea?

Thank you in advance for your kind reply.

Hi !

I don’t have a clue, make sure that you don’t have any small difference between the onscreen/offscreen rendering code, check wglUse… for error codes (GetLastError) and also check for errors when you render the text (glGetError).


Thank you for your kind reply.

Now I adopt another approach to capture the screen image for making AVI.
I use ::glReadPixels() to capture image into an image buffer and it works for either text and OpenGL model.

The only problem is if there is an overlapped window over the drawing window, ::glReadPixels() will loss data
in the area of overlap (this is in fact OpenGL-implement dependent, see http://www.frii.com/~martz/oglfaq/rasterization.htm
about the discussion of overlapping problem of ::glReadPixels() )

Any idea to the new problem ?