Rotation problem
Why the rotation of my sphere dont work ?? I dont understand!!! I created a skyBox and i use the camera from gametutorials.com.
If you want the total source code to help me, send me a mail at sovimat@wanadoo.fr
void Terre()
{
glBindTexture(GL_TEXTURE_2D, texture[1]);
GLUquadricObj *pObj = gluNewQuadric();
gluQuadricTexture(pObj, true);
gluQuadricDrawStyle(pObj, GLU_FILL);
glRotatef(0.6f / 2, 0, 1.0, 0);
glTranslatef(0.0f, 0.0f, 0.0f);
glRotatef(90, 0, 1.0, 0);
gluSphere(pObj, 0.5f, 30, 30); gluDeleteQuadric(pObj);
}
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
g_Camera.Update();
g_Camera.Look();
SkyBox();
Terre();
return TRUE;
}
HELP
What exactly do you want to do? If you want the sphere to continually spin, the angle in glRotatef will have to increase/decrease. Or do you just want the sphere to to stay still but rotated to a certain angle? You''ll need to be a bit more specific than "It wont work" 
Lukerd
"To err is human, to really mess up requires a computer"

Lukerd
"To err is human, to really mess up requires a computer"
"To err is human, to really mess up requires a computer"
August 23, 2002 02:15 PM
Hi!
Im just a newbie like you in OpenGL programming but it seems to me that you dont change the rotating value (decrease increase), logically I dont think it will rotate... Add the variable:
GLfloat rotater
and should be something like this...
rotatef(90,0,rotater,0)
...or... or something else and after you make the drawing increment the rotater variable... ( like rotater+=1.0 or rotater-=0.5)
I hope this helps... Im not soo good at OpenGL Im programming with it since one week so if this doesnt work ... you can ... suicide...
Cya lol dont suicide
Im just a newbie like you in OpenGL programming but it seems to me that you dont change the rotating value (decrease increase), logically I dont think it will rotate... Add the variable:
GLfloat rotater
and should be something like this...
rotatef(90,0,rotater,0)
...or... or something else and after you make the drawing increment the rotater variable... ( like rotater+=1.0 or rotater-=0.5)
I hope this helps... Im not soo good at OpenGL Im programming with it since one week so if this doesnt work ... you can ... suicide...
Cya lol dont suicide
glRotate() doesn''t require a factor to rotate, but the amount (in degrees, not radians) and the axes. Let''s say you want to rotate your sphere 0.15 degrees every game cycle. You don''t pass in the factor 0.15 because OpenGL doesn''t keep track of the objects you''re drawing, but you calculate the current rotation, and pass that to glRotate():
float rot = 0.0f;void YourDrawFunc(){//this will rotate the sphere by the amount of degrees on//two! axes - y and z glRotate(rot, 0, 1, 1);//draw spehere here//increase the rotation value - after 10 cycles this is 1.5rot += 0.15;}Hope this helps,Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement