PDA

View Full Version : How to draw with OpenGL in memory instead of window ?



Javac
10-28-2003, 12:25 AM
I created some 3D scene with OpenGL and draw it on TForm(C++ Builder),but I'd like to write(save) all the picture stright to bmp file,and not show any window at all.
How to do it?How to manage drawing in memory?
I will be very glad about some sample code on
this subject.

rgpc
10-28-2003, 12:48 AM
You are most likely after pbuffers. You can't get away from having a window, but once created you can hide the window and then draw to the pbuffer.

You can find lots of pbuffer examples on the nVidia web site (and, no doubt, ATI's as well). Once you have rendered to the pbuffer you can read it's contents and save it to whatever format you wish.

I believe there is also a method of rendering straight to a DIB, but I've never used it. If you search this forum you will find lots of info on pbuffers and related topics.

PanzerSchreck
10-28-2003, 12:48 AM
Just render your scene to a texture or a pbuffer and then copy their content to memory for saving them to a file.

Javac
10-28-2003, 05:04 AM
Thanks for answers.
So there is no way to make it work without
window control?