Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#172 full cpu usage /w GLUT_DOUBLE, two windows and threads

open
nobody
moderate (59)
5
2012-04-22
2012-04-22
Guest0x539
No

If I run the following code once it consumes ~0% cpu but when I run it twice at once both instances use 25% cpu (4 cores).
If I remove GLUT_DOUBLE and run it twice both instances use ~0% cpu only.
Same happens if I remove the thread.
Similar code (two windows, double buffering, rgba) with SDL runs fine, too.
Works fine on other Windows 7 PCs.
OS: Windows 7 64 Bit (program compiled with gcc, 32 Bit, options like -o/s/etc don't appear to matter)
Laptop: Asus K52JB
CPU: intel core i3
GPU: ATI Mobility Radeon HD 4500/5100 Series
CPU usage "measured" with windows task manager but since the laptop produces way more heat when running two instances I think it is ture.

#include <GL/freeglut.h>

void display(){
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}

void work(int unused){
glutPostRedisplay();
glutTimerFunc(20, work, unused);
}

int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA
| GLUT_DOUBLE//works if this line is removed
);
glutInitWindowSize(512, 512);
glutCreateWindow("Title");

glutDisplayFunc(display);

work(0);
glutMainLoop();

return 0;
}

Discussion

  • There have been some changes to how drawing is done that might affect this. Could you retest with current trunk and see if the problem persists?