本文整理汇总了C++中Viewport::getClearColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewport::getClearColor方法的具体用法?C++ Viewport::getClearColor怎么用?C++ Viewport::getClearColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewport
的用法示例。
在下文中一共展示了Viewport::getClearColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderViewport
void Renderer::renderViewport( Viewport& viewport )
{
Texture* rt = viewport.getRenderTarget();
if( rt )
rt->bindAsRenderTarget( true ); //TODO guess if this viewport doesn't render 3D layers to save memory?
else
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glFrontFace( rt ? GL_CW : GL_CCW ); //invert vertex winding when inverting the view
currentState.targetDimension.x = (float)(rt ? rt->getWidth() : width);
currentState.targetDimension.y = (float)(rt ? rt->getHeight() : height);
glViewport(0, 0, (GLsizei) currentState.targetDimension.x, (GLsizei)currentState.targetDimension.y);
//clear the viewport
if (viewport.getClearEnabled()) {
glClearColor(
viewport.getClearColor().r,
viewport.getClearColor().g,
viewport.getClearColor().b,
viewport.getClearColor().a);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
currentState.view = viewport.getViewTransform();
currentState.viewDirection = viewport.getWorldDirection();
frameStarted = true;
if( viewport.getVisibleLayers().empty() ) //using the default layer ordering/visibility
{
//first render from the most negative to -1
for( int i = (int)negativeLayers.size()-1; i >= 0; --i )
renderLayer( viewport, negativeLayers[i] );
//then from 0 to the most positive
for (auto& l : positiveLayers)
renderLayer( viewport, l );
}
else //use the custom layer ordering/visibility
{
for( auto& layer : viewport.getVisibleLayers() )
renderLayer(viewport, getLayer(layer));
}
}