本文整理汇总了C++中GLView::setViewport方法的典型用法代码示例。如果您正苦于以下问题:C++ GLView::setViewport方法的具体用法?C++ GLView::setViewport怎么用?C++ GLView::setViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLView
的用法示例。
在下文中一共展示了GLView::setViewport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Handle_Display
void GLUINavigationProgram::Handle_Display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
DEBUG_GL_ERRORS()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//SetWorldLights();
camera.toCamera(viewport);
GLView view;
view.setViewport(viewport);
view.setCurrentGL();
SetWorldLights();
DEBUG_GL_ERRORS()
if(stereo_mode){
glColorMask(GL_FALSE,GL_TRUE,GL_TRUE,GL_TRUE); // draw only to green, blue and alpha
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glTranslatef(-stereo_offset*camera.dist,0,0);
RenderWorld();
glPopMatrix();
glClear(GL_DEPTH_BUFFER_BIT); // leave the blue image but clear Z (NOTE: may need to clear alpha as well for transparency effects!)
glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_TRUE); // draw only to red and alpha
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glTranslatef(stereo_offset*camera.dist,0,0);
RenderWorld();
glPopMatrix();
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);}
else {
RenderWorld();
if(show_view_target) DisplayCameraTarget();
}
DEBUG_GL_ERRORS()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,viewport.w,viewport.h,0,-100,100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
RenderScreen();
DEBUG_GL_ERRORS()
++frames_rendered;
glutSwapBuffers();
SleepIdleCallback(0);
}