PDA

View Full Version : turn a square



mapers
10-29-2010, 11:44 AM
good people of the forum would give me a hand on how to spin my way infinite square through an infinite while ahy is my code thanks for your help




#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>

#include <GL/glut.h>

#include <iostream.h>
int angulo=1;
void display(void) {

glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0.0,1.0);
glOrtho(-10.0,10.0,-10.0,10.0,-10.0,10.0);
glPointSize(3.0);
glPushMatrix();
glRotatef(angulo, 0, 0, 1);
while(angulo>0)
{
glBegin(GL_QUADS);
glVertex2i(0,0);
glVertex2i(0,3);
glVertex2i(3,3);
glVertex2i(3,0);
glEnd();
angulo++;
}
glEnd();
glFlush();
glPopMatrix();
glutSwapBuffers();
}


int main(int argc, char *argv[]) {
angulo=1;
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(400, 400);
glutInitWindowPosition(100, 100);
glutCreateWindow("giro");
glutDisplayFunc(display);

glutMainLoop();
return 0;
}