OpenGL窗口中有多个垂直面板

men*_*ics 4 opengl

是否有可能在OpenGL中将窗口分成多个垂直"面板",使每个显示不同的形状集?

我想要在这些面板上同步水平轴,但垂直轴将是完全独立的(位置和比例).

JCo*_*per 5

首先想到的是应用多个调用glViewport().您必须依次渲染每个垂直条带,然后将视口设置为渲染到下一个垂直条带并重复.我这样做是为了将屏幕分成两半并从两个不同的视点渲染场景,但是没有理由要在第二个或第n个视口中渲染相同的场景.

所以我的{edited}代码看起来像这样:

glEnable(GL_SCISSOR_TEST);
...
// Draw the left scene
glViewport(0,0,halfWidth,fullHeight);
glScissor(0,0,halfWidth,fullHeight);
glClear(...);
glPushMatrix();
setLeftEyeModelView();
renderScene();
glPopMatrix();

// Draw the right scene
glViewport(halfWidth,0,halfWidth,fullHeight);
glScissor(halfWidth,0,halfWidth,fullHeight);
glClear(...);
glPushMatrix();
setRightEyeModelView();
renderScene();
glPopMatrix();
Run Code Online (Sandbox Code Playgroud)