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

Thread: Bind two or more drawings

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2013
    Posts
    7

    Bind two or more drawings

    I am drawing 2D shapes to my OpenGL Window using glBegin() glEnd(). That is simple enough to do but what I'd like to do is bind them together somehow so that when I move one drawing it moves all drawings binded to it. Can any help me with this please.
    Last edited by throwaway; 11-30-2013 at 08:54 AM.

  2. #2
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    70
    Best solution (in my opinion) would be if you do this yourself by changing the vertex data in your application.
    However, there is also the way to translate the modelview matrix.

    Before you start rendering anything to the screen you can call:
    Code :
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(x, y, z);
    This would move all primitives together by x, y and z.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2013
    Posts
    7
    I not know if I should have mentioned in my original post but I'm drawing 2D shapes to the screen. Does that make a differences because I'm not using a z axis

  4. #4
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    70
    z can still be used, even in 2D, as a way of depth-testing.
    But even if you dont use it, it doesnt matter. Just put a 0 to the z coordinate.

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2013
    Posts
    7
    Do you have any links to turorials showing how to do this because I'm new to OpenGL and I'm not quite sure what I have to do

Posting Permissions

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