necesito su ayuda que le falta a este programa para q se desplaze - TopicsExpress



          

necesito su ayuda que le falta a este programa para q se desplaze cuando se clickee a #include #include GLfloat xpos=0,ypos=0; void reshape(int w, int h) { /* Because Gil specified screen coordinates (presumably with an upper-left origin), this short bit of code sets up the coordinate system to correspond to actual window coodrinates. This code wouldnt be required if you chose a (more typical in 3D) abstract coordinate system. */ //glViewport(0, 0, w, h); /* Establish viewing area to cover entire window. */ glMatrixMode(GL_PROJECTION); /* Start modifying the projection matrix. */ glLoadIdentity(); /* Cargamos la matriz identidad */ glOrtho(0, w, 0, h, -1, 1); /* Map abstract coords directly to window coords. */ //glMatrixMode (GL_MODELVIEW); // glLoadIdentity (); //glScalef(1, -1, 1); /* Invert Y axis so increasing Y goes down. */ //glMatrixMode (GL_MODELVIEW); glTranslatef(w/2, h/2, 0); /* Shift origin up to upper-left corner. */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void ControlTeclado( unsigned char key, int xpos, int ypos ) { switch (key) { case a: xpos++; break;} } void display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f (0.0, 0.0, 1.0); glLoadIdentity (); glPointSize(50); glBegin(GL_POINTS); //glRotatef(180, 6.0, 0.0, 0.0); glColor3f(0.0, 0.0, 1.0); /* blue */ glPushMatrix(); glTranslatef(600, 800, ypos); glPopMatrix(); glVertex2i(0, 0); glFlush(); /* Single buffered, so needs a flush. */ glutSwapBuffers( ); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitWindowSize(1200,600); glutInitWindowPosition(100,100); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutCreateWindow(single triangle); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(ControlTeclado); glutIdleFunc(display); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ }
Posted on: Sun, 31 Aug 2014 06:04:18 +0000

Trending Topics



Recently Viewed Topics




© 2015