PDA

View Full Version : Rotation problem.



Joshhua5
01-18-2011, 02:48 AM
I don't know what the problem is, the cross draws properly.
but there's no rotation.

helps?!



#include <iostream>
#include <gl\glut.h>

using namespace std;
float Color(0.0);
int Frame(0);
int Angle(40);
float interval(0);
void FrameCount(void)
{
cout << "Frame: " << Frame << "\n";
}
void glCross (void)
{
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glOrtho(-1, 1,-1,1,-1,1);
glLineWidth(10.0);
glBegin(GL_LINES);
glRotatef(Angle, 1, 0, 0);
glColor3f(0, 0, 0);
glVertex2f(-1, 0);
glVertex2f(1, 0);
glVertex2f(0, 1);
glVertex2f(0, -1);
glEnd();
glutSwapBuffers();
glFlush();
Frame++;
Angle++;
FrameCount();
}
void main(int argc, char **argv)
{
glutInit(&amp;argc, argv);
glutInitWindowPosition(500,500);
glutInitWindowSize(500,500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Cross");
glutDisplayFunc(glCross);
glutIdleFunc(glCross);
glutMainLoop();
}

mobeen
01-18-2011, 03:52 AM
HI,
Keep your glRotate cal outside glBegin/glEnd call
call it before glBegin.

Joshhua5
01-18-2011, 04:31 AM
Okay Thank you :D