Results 1 to 4 of 4

Thread: simple rotation

  1. #1
    Member Contributor
    Join Date
    May 2008
    Posts
    77

    simple rotation

    Maybe it's too late....I simply want to flip that triangle 180' so I can see it from behind. Now I've tried to add 180 to the rotations below (mpPsi+180 etc.)without success:

    glBegin(GL_TRIANGLES); //position glTranslatef(floc3DX, floc3DY, floc3DZ);
    glRotatef( mpPsi, 0.0f, -1.0f, 0.0f ); //heading?
    glRotatef( mpTheta, 1.0f, 0.0f, 0.0f); //pitch?
    glRotatef( mpPhi, 0.0f, 0.0f, -1.0f); //roll

    glColor3f(0.0, 0.0, 1.0); /* blue */
    glVertex3f(floc3DX, floc3DY, floc3DZ-2);
    glColor3f(0.0, 1.0, 0.0); /* green */
    glVertex3f(floc3DX+1, floc3DY+1, floc3DZ-2);
    glColor3f(1.0, 0.0, 0.0); /* red */
    glVertex3f(floc3DX-1, floc3DY+1, floc3DZ-1);
    glEnd();

    Many thanks

  2. #2
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: simple rotation

    Do not put your glTranslate & glRotate calls inside your glBegin glEnd code block. Move them before the glBegin.

  3. #3
    Member Contributor
    Join Date
    May 2008
    Posts
    77

    Re: simple rotation

    if i do that nothing is visible, probably drawn to far away.
    if i only move glrotate before glbegin triangles are drawn randomly around (for loop but those x,y,z values do not change)
    but anyway the rotations etc. are not done at all.

  4. #4
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: simple rotation

    Start mpPs etc at 0.0, and ingrement by small values.

    The location you have these is close to the polygon and is in the correct location to rotate the triangle .

    Remember that the modelview matrix is state and is persistent over time, it will begin where you left it at the end of the previous frame.

    You should be using:
    glMatrixMode
    glLoadIdentity

    To manage which matrix you edit and ensure you start with a clean slate each frame.

Similar Threads

  1. Simple Rotation Question...
    By tmason in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-01-2014, 09:13 PM
  2. Simple (not for me) rotation question
    By zedrummer in forum OpenGL: General
    Replies: 2
    Last Post: 04-12-2014, 10:36 AM
  3. Simple (not for me) rotation question
    By zedrummer in forum OpenGL: General
    Replies: 1
    Last Post: 04-10-2014, 06:08 AM
  4. Simple Rotation Problem
    By MSynth2000 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-14-2010, 09:05 PM
  5. Simple rotation question
    By dmatsumoto in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-14-2008, 08:42 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