PDA

View Full Version : get image from scene



ashi08104
03-10-2011, 06:27 AM
hey,I'm trying using glReadPixels() to get image from my scene.My goal is getting a image from arbitrary view point in the scene,e.g.there is a moving bird in my scene,I want to get image about what the bird sees, while I still can see the whole scene on screen.
however I found glReadPixels() only can get image about what windows show at that moment,just like a screenshot.How can I achieve my goal?
thanks for any reply.

ZbuffeR
03-10-2011, 06:29 AM
Move your camera to the bird's place, render, then glReadPixels it.

McLeary
03-10-2011, 06:41 AM
Take a look at FBOs too (http://www.opengl.org/wiki/Framebuffer_Object)

ashi08104
03-10-2011, 07:37 AM
thanks!
but I don't want show what the bird see on the sreen.as I know,move my camera to the bird's place,render,then the screen also will show what the bird see,which is not my goal.

ashi08104
03-10-2011, 07:44 AM
thanks McLeary!I'm reading it.

ZbuffeR
03-10-2011, 08:22 AM
Not a problem, as soon as you don't show it.
example :

:loop
glClear
draw view from bird's position
glReadPixels that
glClear
draw normal view
swapbuffers
goto :loop

FBO is a safer way to do that, but you can easily try first on the default frame buffer.

ashi08104
03-11-2011, 06:25 AM
it's great!I'll try it.thanks,ZbuffeR!