Now im even more confused!! can u please suggest a book which decribes these things in detail??
I started off with COMPUTER GRAPHICS by FS HILL…Now im finding hard to understand the exact concept behind the OpenGL functions…
Pls help…
If you’re translating around a point, you’re moving the object such that the point you’re rotating around is the origin.
Say I have a sphere at (10,10,0). I want to rotate it around (0,10,0). I need to move my sphere to the system of that point, where that point is the origin.
glTranslate(0,-10,0); // A - new point of sphere becomes (10,0,0)
glRotate(degrees); // B - do your rotation
glTranslate(0,10,0); // C - move it back to the original space
drawSphere();
The points for the sphere are multiplied like this
One more thing, for the example yoy just gave,can this be done??
glTranslatef(-10,0,0);//Move to that point
glTranslatef(0,-10,0);//Move to origin of coordinate system
glRotate();
glTranslatef(0,10,0);//MOve back to the required point…
Can this be done to do what? The same thing? No. If you add on that first line, you’re obviously going to get a different result.
glTranslate(10,10); // sphere will appear at (10,10) if it’s object coordinates are centered at (0,0)
glTranslatef(0,-10,0); // move to coordinate space of rotation point so rotation point is at (0,0)
glRotate();
glTranslatef(0,10,0); // move back by doing a translation in the opposite direction