本文整理汇总了C++中Framebuffer::UnbindFb方法的典型用法代码示例。如果您正苦于以下问题:C++ Framebuffer::UnbindFb方法的具体用法?C++ Framebuffer::UnbindFb怎么用?C++ Framebuffer::UnbindFb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framebuffer
的用法示例。
在下文中一共展示了Framebuffer::UnbindFb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// }
// Texture noiseTex;
//
// noiseTex.Bind();
// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ssaoNoiseSize, ssaoNoiseSize, 0, GL_RGB, GL_FLOAT, noiseData);
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// noiseTex.Unbind();
Shader lightingShader("shaders/quad.vert", "shaders/lighting.frag");
lightingShader.Link();
Shader simpleShader("shaders/simple.vert", "shaders/simple.frag");
simpleShader.Link();
// Load models
Model demonHeadModel("models/bake/monkeyright.obj");
Texture bentNormalsTexture("models/bake/nice_bent_normals.png", GL_REPEAT, GL_REPEAT, GL_NEAREST, GL_NEAREST);
// Setup gBuffer
Framebuffer *gBuffer = new Framebuffer();
gBuffer->BindFb();
gBuffer->addTextureAttachment(TexAttachmentType::DEPTH, window->GetFramebufferSize());
gBuffer->addTextureAttachment(TexAttachmentType::RGBA, window->GetFramebufferSize(), "position");
gBuffer->addTextureAttachment(TexAttachmentType::RGB, window->GetFramebufferSize(), "normal");
gBuffer->addTextureAttachment(TexAttachmentType::RGB, window->GetFramebufferSize(), "bentNormal");
gBuffer->addTextureAttachment(TexAttachmentType::RGB, window->GetFramebufferSize(), "color");
gBuffer->setupMRT();
if(!gBuffer->isReady())
std::cerr << "Gbuffer incomplete" << std::endl;
gBuffer->UnbindFb();
// Get textures from gBuffer
Texture depthTex = gBuffer->getTextureAttachment(DEPTH);
Texture positionTex = gBuffer->getTextureAttachment("position");
Texture normalTex = gBuffer->getTextureAttachment("normal");
Texture bentNormalsTex = gBuffer->getTextureAttachment("bentNormal");
Texture colorTex = gBuffer->getTextureAttachment("color");
// // Setup bent_normalsBuffer
// Framebuffer *bentNormalsBuffer = new Framebuffer();
// bentNormalsBuffer->BindFb();
// bentNormalsBuffer->addTextureAttachment(TexAttachmentType::RGBA, window->GetFramebufferSize(), "bent_normals");
// if(!bentNormalsBuffer->isReady())
// std::cerr << "Bent normals buffer incomplete" << std::endl;
// bentNormalsBuffer->UnbindFb();
// // Get bent normals texture
// Texture bentNormalsTex = bentNormalsBuffer->getTextureAttachment("bent_normals");
bool useBentNormals = false;
float bentNormalsInfluence = 0.3f;
EinInputManager *inputManager = window->GetInputManager();
while(!window->ShouldClose())
{
// Set frame time
GLfloat currentFrame = app->GetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// Pool events
inputManager->pollEvents();
if(inputManager->isExit(KeyActionType::KEY_UP)) {
window->SetShouldClose(true);
}