Results 1 to 2 of 2

Thread: placement of object in a scene

  1. #1
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    placement of object in a scene

    I can do translation and rotation of one object without any problems, but when I put multiple objects they do not end up where I expect them too.
    It is like I am translating from my prevous translation and not 0,0,0 for which I would like to translate.
    My guess is I am not using the matrix correctly.

    example:

    for(i=0;i<5;i++)
    glPushMatrix()
    glRotatef(object[i].angle[0], 1,0,0); rotate X
    glRotatef(object[i].angle[1], 0,1,0); rotate Y
    glRotatef(object[i].angle[2], 0,0,1); rotate Z
    glTranslatef(object[i].pos[0],object[i].pos[1],object[i].pos[2]);
    glBegin();
    Drawobject(object[i].obj);
    glEnd();
    glPopMatrix();

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: placement of object in a scene

    call glLoadIdentity() after glPushMatrix().

Similar Threads

  1. Drawing a "2d" object in a 3d scene
    By Brorsson in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-16-2005, 03:12 AM
  2. more than one object in a scene
    By imported_matt in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-07-2001, 11:25 AM
  3. How to get 3d object from file to scene???
    By saiya-jin in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-31-2001, 08:24 AM
  4. Pixel placement and Bitmap placement with OpenGL
    By D_Lux in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-11-2001, 07:58 PM
  5. How do you rotate an individual object and not the whole scene?
    By Ace_Man in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-05-2000, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean