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

Thread: Works for frame 1, but then fails?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    1

    Works for frame 1, but then fails?

    I'm totally confused, this code executes properly for the first running, but then quits working. Originally it did work for all frames, but then quit and I can't figure out why! Since I'm new to opengl, I figure it's something I'm doing way wrong.

    Hopefully someone can point me in the right direction. =)

    Here's the offending code:
    Code :
    void BounceyBall::Draw() 
    {
      glPushMatrix();
        glTranslated(m_Location.X,m_Location.Y,m_Location.Z);
        glRotated(60,1,0,0);
        glRotated(m_Timer,0,0,1);
        glutSolidSphere(m_Radius,10,10);
      glPopMatrix();
    }
    What I did to "break" it...
    originally it worked, but m_Radius was hard-coded at 1. I changed it to the soft coded value, and now the ball will neither spin nor move. The rotations and translations are completely ignored. I tried undoing it, going back to the hard coded value but it's still broke. =(
    As near as I can tell, the code should work but doesn't.

    It's called from here:
    Code :
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glColor3d(1,0,0);
     
        glPushMatrix();
          glTranslated(0,0,-6);
          VideoManager->ProcessFrame(t);
        glPopMatrix();
     
        ... (Other test objects drawn, they work) ...
     
        glutSwapBuffers();
    Huh?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2007
    Posts
    107

    Re: Works for frame 1, but then fails?

    Maybe post more code. Try and make sure you have selected the modelview matrix and reset it (glLoadIdentity) before applying your transformations to the matrix in each frame.
    kind regards,
    Nicolai de Haan

  3. #3
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: Works for frame 1, but then fails?

    What was said above, I am willing to be you are not resetting some state you changed.

Posting Permissions

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