PDA

View Full Version : buffer question? direction please :)



Caltus
07-15-2002, 07:49 PM
Hi There,
I was wondering if anyone has a link on Auxiliary buffers the red book mentions them but thats basically it. There is not alot a info on most other books i have read up on.
what im planning on doing is creating background scenes using an offscene buffer. Im planing to make a 3d scene engine that will make 2d images for mitmaps from 3d objects on demand. Im new to opengl but trying to learn much as i can before starting my project design. I really want this feature so i can generate higher volume of trees/rocks for a huge landscape. Im hoping this will keep fps up allowing a more full landscape. I know the AUXi means i can have a few buffers. but appears that it will be a chunk of memory the size of the screen. I would love to allocate video memory and hardware render to it on the fly, then keep the image and use as a textile. Any direction/info on this would be greatly appreciated. http://www.opengl.org/discussion_boards/ubb/smile.gif

Is the fastest method i have?
glReadPixels (0, 0, Width, Height, xxx,xxx, frameBuffer); i see ppl flame this often for being slow.


Caltus

[This message has been edited by Caltus (edited 07-15-2002).]

thelamberto
07-15-2002, 11:58 PM
Hi,

I've not done this stuff for a while but...

If you change the write buffer with glDrawBuffer and render to it. You can then use glCopyTexImage2d or glCopyTexSubImage2D to copy all or a portion of the image in the GL_READ_BUFFER (set to the one you just rendered to using glReadBuffer) to a texture.

You'll have to check in the red or blue book to see if I'm making sense. Others might have more ways.

Hope this is what your looking for.

[This message has been edited by thelamberto (edited 07-16-2002).]

Relic
07-16-2002, 01:06 AM
The first hurdle here is that most implementations don't support AUX buffers at all. http://www.opengl.org/discussion_boards/ubb/frown.gif
Do a glGetIntergerv(GL_AUX_BUFFERS, &nAuxBuffers); and you'll get the number of supported auxiliary buffers.
In case you get none, there is an extension called P-buffers (pixel buffers) which allows to allocate a piece of video memory to render into it. Do a search on this and the advanced forum. There are demos on the NVIDIA developer site.
If that extension is not supported, you can render into the backbuffer (size restricted by window size) and copy data from there.

[This message has been edited by Relic (edited 07-16-2002).]

Caltus
07-16-2002, 09:08 AM
Thanks for the info. looks like I found what I need and will be experiementing with the back buffer solution.

[This message has been edited by Caltus (edited 07-16-2002).]