Thread: GL Rotate problem

  1. #1
    Registered User
    Join Date
    Aug 2001

    GL Rotate problem

    I consider myself fluent in OpenGL. But I have hit a problem with a little demo I am working up to show how to do First Person with my GLH library.

    I define a matrix for the transposed view.


    then i setup a routine to modify the matrix.


    then the draw code.

    //Draw terrain

    the problem is that the pitch plane dose not move, so when i turn to the side, and try to look down the screen just spins, cause the pitch plane is focused to my side. It shouldn't do that when i load the matrix, rotate it, then save it back.

    the order of the glRotatef()'s makes no difference.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    I don't do OpenGL (don't have a OpenGL card) but are you transforming all of your vertices into aligned space?

    The way I do it is to translate and rotate the object according to local space and then transform to world space. Then I clear the transformation matrix. Here is where I rotate, translate the viewer. Any rotations called after the initial transform and prior to the second transform affect the viewer's rotation and not the object's rotation.

    But, I'm assuming you have done this already since you are very knowledgeable concerning 3D.

    Are you absolutely sure the order does not make a diff? In my code, the order does make a diff. If you rotate on X before you rotate on Y it will not work. But again one call to rotate takes care of this in my code (Rotate(ax,ay,az)). Also the order in which the matrices are multiplied matters to (MatMult(mat1,mat2,result) is not the same as MatMult(mat2,mat1, result)), but since you are using OpenGL, this should already be correct.

    I have had this happen to me before but I don't remember what was wrong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. Replies: 5
    Last Post: 11-07-2005, 11:34 PM