Rotating 2 objects 1 remains static problem opengl


  • Banned

    I want to rotate 2 objects out of 3. One object should remain static. But it's not happening. Please help. I using glPushMatrix() and glPopMatrix() for the objects that I want to rotate.
    [code]
    void CopenGLCoordView::DrawScene(CDC *pDC)
    {
    wglMakeCurrent(pDC->m_hDC, m_hrc);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    drawLine();

    glLoadIdentity();
    glPushMatrix();
    glRotatef(rot[0], 1.0f, 0.0f, 0.0f);
    glRotatef(rot[1], 0.0f, 1.0f, 0.0f);
    glRotatef(rot[2], 0.0f, 0.0f, 1.0f);
    drawAxes();
    glPrintX("X");
    glPrintY("Y");
    glPrintZ("Z");
    glPopMatrix();

    glFlush();
    SwapBuffers(pDC->m_hDC);
    wglMakeCurrent(NULL, NULL);
    }
    [/code]

    With the above code nothing is rotating. I want the drawLine() line should be static while the axis and x,y,z should rotate. Please help how can I achieve this?..Thanks Sujan


  • Lifetime Qt Champion

    This question is not Qt related, you should ask on "the opengl forum":http://www.opengl.org/discussion_boards/forum.php


  • Banned

    I am using this in Qt project. Yes it is openGL question.



  • SGaist is right, this question is not Qt-related.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.