Opengl rotation problem

Started by
6 comments, last by fllipperr 14 years, 5 months ago
Objects rotate around 0,0 when using glOrtho. How can i fix this?
Advertisement
Objects always rotate about the origin. Please describe your problem instead of stating a fact and asking for a fix to something that behaves as it should.
Forgot to say that im trying to rotate on the Z axis and the objects are 2d.
My problem is that it looks like the screen spins not the objects
You handle that just like you do at any time in OpenGL; rotate the object at the origin, not at its final position.
Make sure you load the identiy matrix, then translate for the object, then rotate for the object. It should look like this:

glLoadIdentity();
glTranslatef(x, y, 0.0f);
glRotatef(rotation, 0.0f, 0.0f, 1.0f);

Is this what you are having trouble with? It is hard to tell from your post. Try rephrasing the question and posting some code.
Quote:Original post by fllipperr
My problem is that it looks like the screen spins not the objects


You should read this.
Sorry for my phrasing but i fixed the problem.
The problem was that i translated the objects first.

This topic is closed to new replies.

Advertisement