I need to render a scene of a table and teapot from a virtual viewpoint that is from under the table. Then I have to capture the image as a texture map. Im not sure of the steps and what functions to use to go about doing this. Can someone please help me out? thank you so much, in advance!
Do you really need a texture map? Or do you more generally need a reflection of the scene rendered in the table (e.g. glossy reflection?
If the former, even then you have several choices. Create a framebuffer object, create/attach a color texture to COLOR_ATTACHMENT0, and render into that. That’s the simplest way. Before FBOs (many years ago), what you had to do is render into the system framebuffer, and then copy that into a texture with glCopyTexSubImage2D.
Yes, I have to create a reflection of the ceiling and objects on the table, on the tabletop. However, I’m not sure how to setup the view frustum such that I can capture this image from the viewpoint of under the table, then put it on a framebuffer.
Could you help me out with the setting of the view frustum to capture the image from that angle for the reflection? Thank you so much!!
There are a number of ways to do this, and you may actually prefer an approach besides render-to-texture, such as one which generates pixel-perfect results (e.g. the stencil technique). See this link:
In particular the 3 sections on “Planar Reflections” (stencil buffer, clip planes, texture mapping).
Also, for code and more docs, search for “reflection” on this page – several hits:
Thanks for the input, however I need to first set up the virtual viewpoint before i can go about rendering the scene as texture. It can be done by setting the glfrustum i believe. However I’m not sure what values to give for the parameters of glfrustum(), since there are bottom,top,near,far…
The frustum (projection) is the same it’s the viewing transform that changes. See this: