Results 1 to 2 of 2

Thread: rotation problem

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    1

    rotation problem

    Hello everyone.

    I need some help to solve a rotation problem.
    I have a set of 2d quads, and I just want to rotate them around the Z axis. The problem is the following: when I apply the rotation, the proportion of the quads are changed, I mean, the length of the sides of the quads change.
    This is what I am doing:
    -using orthographic projection: gluOrtho2D(0.0,1.0,-1.0,2.0);
    -using display lists to generate the quads(actually, they are rectangles). They are generated to fill the whole screen. So, I can generate 10 or say, 100 quads, and in both cases the whole screen is filled. What matters here is the size of the quads, it is the length of the side that changes.
    -here is my draw function:

    void draw(){
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
    glTranslatef(0.5,0.5,0.0); //translate back
    glRotatef(-45,0,0,1); //rotation around the Z axis
    glTranslatef(-0.5,-0.5,0.0); //translate the center to the origin (0,0)
    glCallList(...); //quads are stored here
    glPopMatrix();
    glutSwapBuffers();
    }

    Now, you will notice that the translations are in reverse order. I can't understand that, it is just the way it seems to work better.

    I appreciate any help guys.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: rotation problem

    Quote Originally Posted by rogergcg
    I have a set of 2d quads, and I just want to rotate them around the Z axis. The problem is the following: when I apply the rotation, the proportion of the quads are changed, I mean, the length of the sides of the quads change.
    This will really not happen unless you use glScale function or change the projection matrix.

    I think this is a side effect on how you create the display list.

Similar Threads

  1. Rotation problem.
    By Joshhua5 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-18-2011, 05:31 AM
  2. problem with rotation
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-08-2005, 07:25 PM
  3. need help with this rotation problem
    By imported_spooky in forum OpenGL: General
    Replies: 1
    Last Post: 04-15-2004, 11:08 PM
  4. rotation problem
    By hoganh in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-28-2003, 08:02 AM
  5. Rotation problem, i even do a WEB page to let you see my problem
    By sicklab in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-19-2000, 12:47 PM

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