PDA

View Full Version : PFD_DRAW_TO_BITMAP size limit?



PeterHawkin
09-04-2013, 08:26 AM
Hi All,

I'm an OpenGL newbie and I have a little issue...

I'm adding a 3D view option to a graphing program. The program draws the graphs into a bitmap DC created used CreateCompatibleBitmap, then BitBlts it onto the client area. This allows very slick panning and scaling and also makes it easy to cut and paste the graphs into documents.

I've done the 3D view in a similar way by using PFD_DRAW_TO_BITMAP and it works very well...UNTIL the bitmap reaches about 700 x 300 pixels, when the model simply disappears!

The bitmap size is determined by the size of the client area, so resizing the application window causes a redraw into a newly sized bitmap. The bug is quite repeatable, such that you can drag the window bigger and the model disappears at exactly the same point, then reappears when the window is shrunk back to that point.

None of the OpenGL or windows functions seem to be failing, and it's temping to think it's a windows issue, but the graph view works a treat on huge displays.

Any ideas?

GClements
09-04-2013, 10:07 AM
I've done the 3D view in a similar way by using PFD_DRAW_TO_BITMAP
Note that PFD_DRAW_TO_BITMAP forces the use of the built-in, OpenGL 1.1-only software renderer.

If you want better performance or to use later features, you can render to an FBO then extract the image data with glReadPixels().

Other than that, be sure to check any implementation limits against the PFD_DRAW_TO_BITMAP context, not against a context created for a window, as the two will be using different drivers.

PeterHawkin
09-05-2013, 07:25 AM
Thanks G - I'll look into the FBO thing. If someone can point me in the direction of a simple tutorial for using an FBO (I don't need texturing).

In the meantime, I've limited the size of the bitmap and it seems to be working OK,

Peter

kyle_
09-05-2013, 12:18 PM
You can start here: https://www.opengl.org/wiki/FBO