Skip to content
Snippets Groups Projects
Select Git revision
  • 8ec66e47f7de9d99df6ab9e6a5fdf8d96e30c669
  • master default protected
2 results

EngineController.java

Blame
  • cube-7.c 669 B
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <GL/glut.h>
    #include "opengl-magic.h"
    
    float t = 0.0;
    
    void draw (void)
    {
      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      set_material_color (1.0, 0.7, 0.0);
      glPushMatrix ();
      glRotatef (20.0 * t, 0.5, 1.0, 0.0);
      glTranslatef (0.9, 0.0, 0.0);
      glutSolidCube (0.5);
      glPopMatrix ();
      glFlush ();
      glutSwapBuffers ();
    }
    
    void timer_handler (int value)
    {
      t += 0.05;
      glutPostRedisplay ();
      glutTimerFunc (50, timer_handler, 0);
    }
    
    int main (int argc, char **argv)
    {
      init_opengl (&argc, argv, "Cube");
      glutDisplayFunc (draw);
      glutTimerFunc (50, timer_handler, 0);
      glutMainLoop ();
      return 0;
    }