Skip to content

Commit

Permalink
Fix usage of IdleFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtrujy committed Sep 9, 2024
1 parent 235ce1e commit 63b46ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
7 changes: 1 addition & 6 deletions examples/logo/logo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ GLint ps2_list, gl_list, wet_list, circle_list, tri_list, square_list, x_list;

int main(int argc, char** argv)
{
int dummy_argc = 1;
char iop_module_path[] = "iop_module_path=host0:/usr/local/sce/iop/modules";
char* dummy_argv[1];
dummy_argv[0] = iop_module_path;

glutInit(&dummy_argc, (char**)dummy_argv);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow(argv[0]);

Expand Down
11 changes: 6 additions & 5 deletions examples/nehe/lesson04/lesson4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ void init(GLvoid) // Create Some Everyday Functions
glEnable(GL_LIGHT0);
}

void frameEnd(void) {
// Swap The Buffers To Not Be Left With A Clear Screen
glutSwapBuffers();
}

void display(void) // Create The Display Function
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
Expand Down Expand Up @@ -64,10 +69,6 @@ void display(void) // Create The Display Fu
glPopMatrix();
rtri += 0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
rquad -= 0.15f; // Decrease The Rotation Variable For The Quad ( NEW )


glutSwapBuffers();
// Swap The Buffers To Not Be Left With A Clear Screen
}

void reshape(int w, int h) // Create The Reshape Function (the viewport)
Expand All @@ -92,7 +93,7 @@ int main(int argc, char **argv) // Create Main Function For Bri
glutCreateWindow("NeHe's OpenGL Framework"); // Window Title (argv[0] for current directory as title)
glutDisplayFunc(display); // Matching Earlier Functions To Their Counterparts
glutReshapeFunc(reshape);
glutIdleFunc(display);
glutIdleFunc(frameEnd);
glutMainLoop(); // Initialize The Main Loop

return 0;
Expand Down
11 changes: 6 additions & 5 deletions examples/nehe/lesson05/lesson5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ void InitGL(GLvoid) // Create Some Everyday Functions
glEnable(GL_LIGHT0);
}

void frameEnd(void) {
// Swap The Buffers To Not Be Left With A Clear Screen
glutSwapBuffers();
}

void display(void) // Create The Display Function
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
Expand Down Expand Up @@ -109,10 +114,6 @@ void display(void) // Create The Display Fu
glPopMatrix();
rtri += 0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
rquad -= 0.15f; // Decrease The Rotation Variable For The Quad ( NEW )


glutSwapBuffers();
// Swap The Buffers To Not Be Left With A Clear Screen
}

void reshape(int width, int height) // Create The Reshape Function (the viewport)
Expand Down Expand Up @@ -143,7 +144,7 @@ int main(int argc, char **argv) // Create Main Function For Br
InitGL();
glutDisplayFunc(display); // Matching Earlier Functions To Their Counterparts
glutReshapeFunc(reshape);
glutIdleFunc(display);
glutIdleFunc(frameEnd);
glutMainLoop(); // Initialize The Main Loop

return 0;
Expand Down

0 comments on commit 63b46ed

Please sign in to comment.