Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: Performace Problem

  1. #1
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Performace Problem

    Code :
     #ifdef _WIN32
    	#include <windows.h>
    	#include <gl\gl.h>
    	#include <gl\glut.h>
    #endif
     
    #ifndef _WIN32
    	#include <glut/glut.h>
    #endif
     
    #include <stdlib.h>
    #include <iostream.h>
     
    void init(void) 
    {
       glClearColor (0.0, 0.0, 0.0, 0.0);
       glShadeModel (GL_SMOOTH);
       glEnable(GL_LIGHTING);
       glEnable(GL_LIGHT0);
       glEnable(GL_DEPTH_TEST);						
       glDepthFunc(GL_LEQUAL);	
    }
     
    GLfloat spin=0.0;
     
    void display(void)
    {
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
       glColor3f (1.0, 1.0, 1.0);
       glLoadIdentity ();             /* clear the matrix */
               /* viewing transformation  */
       gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
       glScalef (1.0, 2.0, 1.0);      /* modeling transformation */ 
       spin+=0.2;
       if(spin>=360) spin=0;
       glRotatef(spin,1.0,1.0,1.0);
       glutSolidCube (1.0);
       glFlush();
       glutSwapBuffers();
    }
     
    void reshape (int w, int h)
    {
       glViewport (0, 0, (GLsizei) w, (GLsizei) h); 
       glMatrixMode (GL_PROJECTION);
       glLoadIdentity ();
       glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
       glMatrixMode (GL_MODELVIEW);
    }
     
    void keyboard(unsigned char key, int x, int y)
    {
       switch (key) {
          case 27:
             exit(0);
             break;
       }
    }
     
    void animation(void)
    {
       glutPostRedisplay();
    }
     
    int main(int argc, char** argv)
    {
       glutInit(&amp;argc, argv);
       glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);	
       glutInitWindowSize (500, 500); 
       glutInitWindowPosition (100, 100);
       glutCreateWindow (argv[0]);
       init();
       glutDisplayFunc(display); 
       glutReshapeFunc(reshape);
       glutIdleFunc(animation);
       glutKeyboardFunc(keyboard);
       glutMainLoop();
       return 0;
    }
    what is wrong with this code? it is a modified example of my opengl book...the framerate on my low end mac is much higher than the framerate on my windows xp...
    is this a windows specific problem....i don't know,,,please help......

    thank you

  2. #2
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    i use vc++ 6.0...maybe the libs are too old.....any ideas?

  3. #3
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    the cpu usage: 7%

    if i change the display mode to single -> amazing framerate but display bugs and shimmering..and display bugs

  4. #4
    Junior Member Regular Contributor
    Join Date
    Aug 2004
    Location
    Angers, France
    Posts
    248

    Re: Performace Problem

    GLUT isn't particulary good for the performances
    if your machine is also old, the latest OS from microsoft willbe lazy (when you have got few RAm or bad video card)

    VC 6.0 is old but it's work fine on my computer
    The .Product will make you .Believe

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: Performace Problem

    The lower performance is most likely because of vsync. Your graphics driver control panel will let you turn it off globally. For starters: right click on desktop, "settings", "advanced" and then just look around for it.

    I don't think this is about GLUT or the other stuff Gollum said -- which I couldn't make sense of

  6. #6
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    sounds good...because if i use the highest resolution with anti aliasing and stuff like that de framerate is much higher......

    thank y

  7. #7
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    thank you...vsync was the problem...
    is it possible to control vsync with opengl code?

    thank you

  8. #8
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    thank you...vsync was the problem...
    is it possible to control vsync with opengl code?

    thank you

  9. #9
    Guest

    Re: Performace Problem

    Look at WGL_EXT_swap_control extension:

    WGL_EXT_swap_control

  10. #10
    Junior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    153

    Re: Performace Problem

    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •