本文整理汇总了C++中FrameBuffer::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBuffer::GetID方法的具体用法?C++ FrameBuffer::GetID怎么用?C++ FrameBuffer::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBuffer
的用法示例。
在下文中一共展示了FrameBuffer::GetID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VisitWaterNode
void TerrainRenderingView::VisitWaterNode(WaterNode* node) {
IShaderResourcePtr shader = node->GetWaterShader();
if (shader != NULL){
FrameBuffer* reflection = node->GetReflectionFbo();
Vector<2, int> refDim = reflection->GetDimension();
// setup water clipping plane
double plane[4] = {0.0, -1.0, 0.0, 0.0}; //water at y~~0
glEnable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE0, plane);
glViewport(0, 0, refDim[0], refDim[1]);
// store previous frame buffer
GLint prevFbo;
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &prevFbo);
// Render reflection
// Enable frame buffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, reflection->GetID());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glCullFace(GL_FRONT);
glPushMatrix();
glScalef(1, -1, 1);
glTranslatef(0, -2, 0);
// Render scene
node->VisitSubNodes(*this);
glPopMatrix();
glCullFace(GL_BACK);
// Restore the previous frame buffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prevFbo);
glDisable(GL_CLIP_PLANE0);
// Reset viewport
glViewport(0, 0, arg->canvas.GetWidth(), arg->canvas.GetHeight());
// Render reflection
node->VisitSubNodes(*this);
ApplyGeometrySet(GeometrySetPtr());
glDisable(GL_TEXTURE_2D);
glUseProgram(0);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, node->GetBottomVerticeArray());
glColor4fv(node->GetFloorColor());
glDrawArrays(GL_TRIANGLE_FAN, 0, 26);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// set shader uniforms
Vector<3, float> viewPos = arg->canvas.GetViewingVolume()->GetPosition();
shader->SetUniform("viewpos", viewPos);
float time = (float)node->GetElapsedTime();
shader->SetUniform("time", time / 8000000000.0f);
shader->SetUniform("time2", time / 4000000.0f);
shader->SetUniform("lightDir", lightDir);
shader->ApplyShader();
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, node->GetWaterVerticeArray());
glNormalPointer(GL_FLOAT, 0, node->GetWaterNormalArray());
glTexCoordPointer(2, GL_FLOAT, 0, node->GetTextureCoordArray());
glNormal3f(0, 1, 0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 26);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
shader->ReleaseShader();
this->currentShader.reset();
glDisable(GL_BLEND);
}else{
node->VisitSubNodes(*this);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, node->GetBottomVerticeArray());
glColor4fv(node->GetFloorColor());
glDrawArrays(GL_TRIANGLE_FAN, 0, 26);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glVertexPointer(3, GL_FLOAT, 0, node->GetWaterVerticeArray());
//.........这里部分代码省略.........