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 2 of 2

Thread: Trouble Getting Two Windows to display correctly

  1. #1
    Newbie Newbie
    Join Date
    Nov 2013
    Posts
    1

    Trouble Getting Two Windows to display correctly

    Title pretty much sums it up. The first window works perfectly fine and loads the spinning Sierpinski gasket. However, the second window appears (the border of it) but nothing inside of it.

    The code for display2
    Code :
    void display2()
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
    	glMatrixMode(GL_MODELVIEW);
    	glLoadIdentity();
    	glRotatef(15.0,0.0,0.0,1.0);
    	glCallList(COMP1);
     
    	glTranslatef(1.0, 0.0, 0.0);
     
    	glScalef(0.5, 1.0,0.5);
        glCallList(CYLINDER);
    	glFlush();
    }

    And the code for the main
    Code :
    void main(int argc, char **argv)
    {
        n=2;//atoi(argv[1]); /* or enter number of subdivision steps here */
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
        glutInitWindowSize(500, 500);
    	glClearColor (1.0, 1.0, 1.0, 1.0);
    	glEnable(GL_DEPTH_TEST);
     
     
        glutCreateWindow("3D Gasket Single Buffer");
    	glutReshapeFunc(myReshape);
    	glutIdleFunc(spinIt);
     
    	computeSierpinski();
     
        glutDisplayFunc(display);
     
    	glMatrixMode(GL_MODELVIEW);
    	glRotatef(150.0,1.0,1.0,1.0);
     
    	glClearColor (1.0, 1.0, 1.0, 1.0);
        glutCreateWindow("3D Gasket Double Buffer");
    	glutPositionWindow(510,23);
    	glutIdleFunc(spinIt);
    	glutReshapeFunc(myReshape);
     
    	init();
    	compositionCal();
    	glutDisplayFunc(display2);
     
    	glutMainLoop();
    }

    Any suggestions? If you need more of the code, just ask. Thanks for your help!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    786
    You use double buffering but don't call glutSwapBuffers() at the end of display2().

Posting Permissions

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