egl: remove duplicate ARRAY_SIZE() macro declaration
[mesa.git] / progs / demos / cubemap.c
index 015d50d86bea16f71e2d60ec8e76dab0a501b932..3e79d6a55890ce513ee6a0425a459c7642b3196c 100644 (file)
@@ -59,6 +59,8 @@ static GLboolean supportFBO = GL_FALSE;
 static GLboolean supportSeamless = GL_FALSE;
 static GLboolean seamless = GL_FALSE;
 static GLuint TexObj = 0;
+static GLint T0 = 0;
+static GLint Frames = 0;
 
 
 static struct {
@@ -283,6 +285,20 @@ static void draw( void )
    glPopMatrix();
 
    glutSwapBuffers();
+
+   Frames++;
+
+   {
+      GLint t = glutGet(GLUT_ELAPSED_TIME);
+      if (t - T0 >= 5000) {
+        GLfloat seconds = (t - T0) / 1000.0;
+        GLfloat fps = Frames / seconds;
+        printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+        fflush(stdout);
+        T0 = t;
+        Frames = 0;
+      }
+   }
 }
 
 
@@ -597,9 +613,8 @@ static void parse_args(int argc, char *argv[])
 
 int main( int argc, char *argv[] )
 {
-   glutInit(&argc, argv);
-   glutInitWindowPosition(0, 0);
    glutInitWindowSize(600, 500);
+   glutInit(&argc, argv);
    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
    glutCreateWindow("Texture Cube Mapping");
    glewInit();