Reputation:
the glRoatef function does not work I have no idea why...
Code Below This is the Display Function this is called in the main loop im using SDL as well:
void display(){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
GLfloat ambientColor[] = {0.2f, 0.2f, 0.2f, 1.0f};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientColor);
Control(0.2,0.2,mousein);
drawSkybox(50.0);
UpdateCamera();
renderLine(0,0,0,100,0,0,0,0,255);
renderLine(0,0,0,0,100,0,0,255,0);
renderLine(0,0,0,0,0,100,255,0,0);
I forgot to add that this is the bit that is not working :
glPushMatrix();
glRotatef(1,0,0,360);
glScalef(0.05,0.05,0.05);
glCallList(ship);
glPopMatrix();
for(int i = 0;i<planets.size();i++){
glPushMatrix();
planets[i].render();
glPopMatrix();
}
}
In the Control Function these Rotations work.
glRotatef(-camPitch,1.0,0.0,0.0); glRotatef(-camYaw,0.0,1.0,0.0);
Update Camera also translates the scene glTranslatef(-camX,-camY,-camZ);
Also in the init function this is how I set up the camera
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,640.0/480.0,0.1,500.0);
glMatrixMode(GL_MODELVIEW);
Upvotes: 1
Views: 1741
Reputation: 5510
void glRotatef(GLfloat x, GLfloat y, GLfloat z, GLfloat angle)
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
http://www.opengl.org/sdk/docs/man2/xhtml/glRotate.xml
Upvotes: 3