Let me clarify some of the questions you guys had.
IndirectX - Yes, I am pretty sure everything is being initialized correctly. Here is my constructor:
Cube::Cube(GLfloat x, GLfloat y, GLfloat z) : amIDefined(TRUE), myLength(z), myHeight(y), myWidth(x), myDepth(FALSE), myRotate(FALSE), myAngle(0.0f), myChange(0.0f), myRot(3), myPosition(3), myColor(3){ // set default position to center of screen myPosition[0] = 0.0f; myPosition[1] = 0.0f; myPosition[2] = 0.0f; // set default color to white myColor[0] = 1.0f; myColor[1] = 1.0f; myColor[2] = 1.0f;}
And yes, I dislike the whole AP coding stuff too (I take the test May 9th, but I have been doing practice questions in class). I also hate the AP classes they use, such as apmatrix, apstring, and apvector. What is the point of teaching something that we will not use outside of the class? It's not like I am going to bring along my AP files to my first job as a programmer. They should just teach the regular C++ strings and arrays.
smarechal: The array holds the axis for the cube to spin around (so in you example, x, y, and z would be stored in myRot[0], myRot[1], and myRot[2], respectively). The angle is myAngle, which is initialized to 0.0f, and is increased by myChange every time Draw() is called.
Trexmaster: I have not yet tried your code, but let me first enter a rebuttal to what you said. The cube alway starts from it's original position (0 degrees), and I am rotating it by myAngle. But every time Draw() is called, myAngle is increased by myChange. Therefore, through the first five calls, myAngle should be 0.0f, 2.0f, 4.0f, 6.0f, 8.0f. myAngle would continually be increased, therefore spinning.
A few of you have recommended using glPushMatrix() and glPopMatrix(), which I want to avoid using since I have no idea what they do. There must be some bug that I am not catching, because this program worked before I starting using classes (without Push and PopMatrix(), just glLoadIdentity).
Can anyone figure out my problem? Need more code?
Edit: Just for the record, I tried your code Trexmaster and it did not solve the problem. Thanks for your help though. [edited by - Erunama on May 2, 2002 4:49:50 PM]