首先想到的是应用多个调用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)
归档时间: |
|
查看次数: |
510 次 |
最近记录: |