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 4 of 4

Thread: Moving/rotating object

  1. #1
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    2

    Question Moving/rotating object

    Hello, I want to ask if you have many objects (each object contains many triangles), how do you get object id and later on rotate just this or move without clearing whole screen and sending all triangles again each frame??

    Tnx

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Location
    Los Angeles
    Posts
    188
    Quote Originally Posted by SuperSQL View Post
    Hello, I want to ask if you have many objects (each object contains many triangles), how do you get object id and later on rotate just this or move without clearing whole screen and sending all triangles again each frame??
    Not sure what you mean by 'get object id'. If you mean select it by clicking on it with the mouse, then you could use picking.

    In all OpenGL programming I've ever done, the entire scene (i.e. all polygons) are redrawn each time the screen is updated. If you don't want to do this, just don't call glClear. The problem with updating only one object in a scene is that it is probably moving, changing shape, etc. That means you have to erase the old version of the object, before drawing the new version of the object. What if this object overlaps other objects? You'd have to check for this and redraw those other objects that got erased with the primary object. It gets messy. This is why all polygons in a scene are usually redrawn.

  3. #3
    Newbie Newbie
    Join Date
    Nov 2012
    Posts
    2
    I see, what if scene has like 10 million or more polygons? It would take so long just for the CPU to tell where each polygon is?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    You can look at layering - it depends a bit on your application. You can render to several framebuffers and merge. This can mean only some of your objects need to be redraw and the others are created with a blend of the frame buffers. You will need to handle sharing depth buffers.
    I do this when rendering tins (ground terrain) followed by surface objects. I only need to re-render the tin when the camera changes.

Posting Permissions

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