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: rotations

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

    rotations

    Hi
    all ok and centered but as soon as I try to rotate the mesh I only see it in the distance.

    glPushMatrix();
    // glRotatef(XPLMGetDataf(psi), 0, 1, 0);//heading
    // glRotatef(XPLMGetDataf(theta), -1, 0, 0);//pitch
    // glRotatef(XPLMGetDataf(phi), 0, 0, 1);//roll

    drawGLCube();

    glPopMatrix();

    So how to rotate my cube at the very same place?
    Many thanks
    Michael

  2. #2
    Intern Contributor uwi2k2's Avatar
    Join Date
    Mar 2011
    Posts
    97
    hi,

    we need to know the content of: drawGLCube();
    i just guess its moving the cube to some place in 3d space .. and its NOT around ( 0,0,0 ) right ?
    caus thats the point... you need to play around with the order of translate and rotate to get a feeling for it.
    its a difference if you rotate first or translate first ..
    try it !

    cu
    uwi
    uwi2k2 - OpenGL Trainer: www.opengl-trainer.com
    ---------------------------------------------------------
    Free Programming Helpline: www.programming-hotline.com
    ---------------------------------------------------------
    A Friday Night Programmer: www.uwiworld.net

  3. #3
    Intern Contributor
    Join Date
    May 2008
    Posts
    77
    Ohh like that is rotating ok:
    glTranslatef(XPLMGetDatad(locX), XPLMGetDatad(locY), XPLMGetDatad(locZ));
    glRotatef(XPLMGetDataf(psi), 0, 1, 0);//heading
    glRotatef(XPLMGetDataf(theta), -1, 0, 0);//pitch
    glRotatef(XPLMGetDataf(phi), 0, 0, 1);//roll
    glTranslatef(-XPLMGetDatad(locX), -XPLMGetDatad(locY), -XPLMGetDatad(locZ));

    Hmm if I draw:
    gluCylinder(quadratic,1.0f,0.0f,3.0f,32,32); // A Cone With A Bottom Radius Of .5 And A Height Of 2

    it shows the inside but not the outside. Any idea on how to switch that?

    Thanks again
    Last edited by mikethebike; 06-04-2013 at 02:29 AM.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,099
    it shows the inside but not the outside. Any idea on how to switch that?
    You are either inside the cylinder and have backface culling disabled or you're outside and have frontface culling enabled.

  5. #5
    Intern Contributor
    Join Date
    May 2008
    Posts
    77
    Was a easy fix with:
    glScalef(1,-1,1);

Posting Permissions

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