当前位置: 首页>>代码示例>>C++>>正文


C++ Framebuffer::BindFb方法代码示例

本文整理汇总了C++中Framebuffer::BindFb方法的典型用法代码示例。如果您正苦于以下问题:C++ Framebuffer::BindFb方法的具体用法?C++ Framebuffer::BindFb怎么用?C++ Framebuffer::BindFb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Framebuffer的用法示例。


在下文中一共展示了Framebuffer::BindFb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
    // int noiseDataSize = ssaoNoiseSize * ssaoNoiseSize;
    // glm::vec3 *noiseData = new glm::vec3[noiseDataSize];
    // srandTimeSeed();
    // for (int i = 0; i < noiseDataSize; i++) {
    //     noiseData[i] = glm::vec3(
    //             randMToN(-1.0f, 1.0f),
    //             randMToN(-1.0f, 1.0f),
    //             0.0f);
    //     noiseData[i] = glm::normalize(noiseData[i]);
    // }
    // 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())
    {
开发者ID:cHoco,项目名称:cgBentRendering,代码行数:67,代码来源:cgBentRendering.cpp


注:本文中的Framebuffer::BindFb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。