PiP in OpenGL causing flickering

扶醉桌前 提交于 2019-12-11 05:13:00

问题


I am trying to set up a Picture in picture style "map" display for a graphics program that displays a car. (Just shows the view from top again in a smaller view port.) However, the second viewport seems to flicker. I thought I was doing this correctly, but I may be not conceptualizing this correctly.

void display(void) {


    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);


    // Set Perspective

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(fov, aspect, near, far);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, 500, 500);
    // Lighting follows Camera if inserted here.


    //Set Camera
    calculateCamera();
    gluLookAt(eyeX + carPosX, eyeY + carPosY, eyeZ + carPosZ, cX + carPosX, 
              cY + carPosY, cZ + carPosZ, 0, 1, 0);


    displayEnvironment();


    glClear(GL_DEPTH_BUFFER_BIT);

    // Set Perspective

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(fov, aspect, near, far);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0,0,150,150);

    gluLookAt(0, 140, 0,0, 0, 0, 1, 0, 0);

    displayEnvironment();

    }

回答1:


Where/when are you swapping buffers? Maybe you're not waiting for the render to finish?



来源:https://stackoverflow.com/questions/8320667/pip-in-opengl-causing-flickering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!