Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Rendering scene from a virtual viewpoint

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    3

    Rendering scene from a virtual viewpoint

    Hi

    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!

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,124
    Quote Originally Posted by muffin View Post
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    3
    Hi

    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!!

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,124
    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:

    * Advanced Graphics Programming Techniques Using OpenGL (SIGGRAPH 1999) - 11.1 Reflections and Refractions

    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:

    * Code Resources (OpenGL wiki)

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    3
    Hi,

    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...

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,124
    The frustum (projection) is the same it's the viewing transform that changes. See this:

    * http://www.opengl.org/archives/resou...s/node159.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •