-
OpenGL Question?
What i am doing is making a 3D Checkers game that when its a different players turn the board spins around, I know how to spin the board with glRotatef but how would i make it a different function if the original drawing of the board is in a different function. Any ideas?
Thanks
Chris
-
are you saying you have two functions and you want to do such
??? function1(???)
{
// draw the chessboard
}
//elsewhere in the code
??? function2(???)
{
// rotate the chessboard here
}
is this what your trying to do?
-
Well, you could put a glRotatef in the drawing function, and rotate it THETA degrees, then make THETA a global variable and change it (say from 0 to 180) in the other function.
Or you might want to take a look at the gluLookAt() function, and then you could just change the position of the camera and swing it around the board, showing you the board from another view.
-
How do u use gluLookAt() function?
-
void gluLookAt(
GLdouble eyex,
GLdouble eyey,
GLdouble eyez,
GLdouble centerx,
GLdouble centery,
GLdouble centerz,
GLdouble upx,
GLdouble upy,
GLdouble upz
);
Parameters
eyex, eyey, eyez
The position of the eye point.
centerx, centery, centerz
The position of the reference point.
upx, upy, upz
The direction of the up vector.