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


C++ FrameBufferObject类代码示例

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


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

示例1: drawTextureShader

void DrawShader::drawTextureShader(bool isReflection, Shader& shader, const std::vector<Drawable>& drawables,
      const glm::mat4& viewMatrix, const glm::vec3& sunDir, float sunIntensity, 
      int lightning, const FrameBufferObject& reflection_fbo) {

   shader.sendUniform(Uniform::PROJECTION, uniforms, gProjectionMatrix);
   shader.sendUniform(Uniform::VIEW, uniforms, viewMatrix);

   shader.sendUniform(Uniform::LIGHTNING, uniforms, lightning);
   SendSun(shader, uniforms, sunIntensity, sunDir);

   for (auto& drawable : drawables) {
      if (drawable.draw_template.shader_type == ShaderType::TEXTURE ||
          drawable.draw_template.shader_type == ShaderType::DEFERRED) { 
         {
         // Per-Drawable Texture Shader Setup
            //SendHeightMap(shader, drawable);
            SendBones(shader, drawable);
            SendTexture(shader, drawable);

            if (!isReflection && drawable.draw_template.effects.count(EffectType::IS_WATER)) {
               shader.sendUniform(Uniform::IS_WATER, uniforms, 1);
               shader.sendUniform(Uniform::REFLECTION_TEXTURE, uniforms, reflection_fbo.texture_slot());  
               reflection_fbo.texture().enable(texture_cache_);
            }
            else
               shader.sendUniform(Uniform::IS_WATER, uniforms, 0);

            drawable.draw_template.material.sendMaterial(shader, uniforms);
         }
         if (!drawable.draw_template.effects.count(EffectType::IS_WATER) || !isReflection)
            drawModelTransforms(shader, drawable, viewMatrix, true, uniforms);
      }
   }
}
开发者ID:Ethanmn,项目名称:CPE476Final,代码行数:34,代码来源:draw_shaders.cpp

示例2: FNOTICE

void DepthPeelingStage::postProcess(DrawEnv *pEnv, bool isPing)
{
    Window *win = pEnv->getWindow();

    if(win->hasExtOrVersion(_uiFramebufferObjectExt, 0x0300, 0x0200) == false)
    {
        FNOTICE(("Framebuffer objects not supported on Window %p!\n", win));
        return;
    }

    DepthPeelingStageData *pData =
        pEnv->getData<DepthPeelingStageData *>(_iDataSlotId);

    if(!pData)
        return;

    FrameBufferObject *pBlendFBO  = pData->getBlendFBO();
    pBlendFBO->activate(pEnv);

    ChunkMaterial *pMaterial;
    if (isPing)
        pMaterial = pData->getPeelPingMaterial();
    else
        pMaterial = pData->getPeelPongMaterial();

    pEnv->activateState(pMaterial->getState(), NULL);

    drawQuad();

    pEnv->deactivateState();

    pBlendFBO->deactivate(pEnv);
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:33,代码来源:OSGDepthPeelingStage.cpp

示例3: onCreate

void FrameBufferObjectBase::onCreate(const FrameBufferObject *source)
{
    Inherited::onCreate(source);

    if(source != NULL)
    {
        FrameBufferObject *pThis = static_cast<FrameBufferObject *>(this);

        MFUnrecFrameBufferAttachmentPtr::const_iterator ColorAttachmentsIt  =
            source->_mfColorAttachments.begin();
        MFUnrecFrameBufferAttachmentPtr::const_iterator ColorAttachmentsEnd =
            source->_mfColorAttachments.end  ();

        while(ColorAttachmentsIt != ColorAttachmentsEnd)
        {
            pThis->pushToColorAttachments(*ColorAttachmentsIt);

            ++ColorAttachmentsIt;
        }

        pThis->setDepthAttachment(source->getDepthAttachment());

        pThis->setStencilAttachment(source->getStencilAttachment());
    }
}
开发者ID:Langkamp,项目名称:OpenSGDevMaster_Toolbox,代码行数:25,代码来源:OSGFrameBufferObjectBase.cpp

示例4: updatePointLightRenderTargets

void ShaderShadowMapEngine::updatePointLightRenderTargets(SSMEngineData *data)
{
    if(data->getMFRenderTargets()->empty() == true)
    {
        for(UInt16 i = 0; i < 6; ++i)
        {
            FrameBufferObjectUnrecPtr newTarget =
                FrameBufferObject::createLocal();
            newTarget->setWidth          (this->getWidth           ( ));
            newTarget->setHeight         (this->getHeight          ( ));
            newTarget->setDepthAttachment(data->getShadowTexBuffers(i));

            data->editMFRenderTargets()->push_back(newTarget);
        }
    }
    else
    {
        for(UInt16 i = 0; i < 6; ++i)
        {
            FrameBufferObject *target = data->getRenderTargets(i);

            if((target->getWidth () != this->getWidth ()) ||
               (target->getHeight() != this->getHeight())   )
            {
                target->setWidth (this->getWidth ());
                target->setHeight(this->getHeight());
            }
        }
    }
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:30,代码来源:OSGShaderShadowMapEngine.cpp

示例5: render_fps

void TextRenderer::
render_fps(RenderContext const& ctx, FrameBufferObject& target,
           float application_fps, float rendering_fps) const {

    target.bind(ctx);

    math::mat4 fs_projection = scm::math::make_ortho_matrix(
                                  0.0f, static_cast<float>(target.width()),
                                  0.0f, static_cast<float>(target.height()),
                                  -1.0f, 1.0f);

    text_renderer_->projection_matrix(fs_projection);

    frame_counter_text_->text_string("Application FPS: "
                            + string_utils::to_string(application_fps)
                            + "\nRendering FPS: "
                            + string_utils::to_string(rendering_fps));

    math::vec2i text_ur = math::vec2i(40, target.height()
                            - frame_counter_text_->text_bounding_box().y + 10);

    text_renderer_->draw_outlined(
                            ctx.render_context, text_ur, frame_counter_text_);

    target.unbind(ctx);
}
开发者ID:thelaui,项目名称:guacamole-attic,代码行数:26,代码来源:TextRenderer.cpp

示例6: while

int         FrameBufferObjectsRepository::releaseFbo(IFrameBufferObject* p)
{
    FrameBufferObject* pp = static_cast<FrameBufferObject*>(p);
    FboMap::iterator iR = m_FBOs.begin();
    while(iR != m_FBOs.end())
    {
        if(iR->second.p == pp)
        {
            iR->second.refCnt--;
            if(iR->second.refCnt == 0)
            {
                LOGD("Delete FBO %s and remove it from repository\n", pp->getName());
                pp->invalidate();
                delete pp;
                m_FBOs.erase(iR);
                return 0;
            } else {
                LOGD("Released FBO %s to refCnt=%d\n", pp->getName(), iR->second.refCnt);
                return iR->second.refCnt;
            }
        }
        ++iR;
    }
    return -1;
}
开发者ID:2php,项目名称:nvFX,代码行数:25,代码来源:resources.cpp

示例7: SendShadow

void DrawShader::SendShadow(Shader& shader, const UniformLocationMap& uniforms,
         const FrameBufferObject& shadow_map_fbo_,
         const glm::vec3& deerPos, const glm::vec3& sunDir) {
      shadow_map_fbo_.texture().enable(texture_cache_);
      shader.sendUniform(Uniform::HAS_SHADOWS, uniforms, 1);
      shader.sendUniform(Uniform::SHADOW_MAP_TEXTURE, uniforms, shadow_map_fbo_.texture_slot());
      SendInverseShadow(shader, uniforms, sunDir, deerPos);
}
开发者ID:Ethanmn,项目名称:CPE476Final,代码行数:8,代码来源:draw_shaders.cpp

示例8: glBindFramebufferEXT

//-----------------------------------------------------------------------------
void Widget3d::pushFrameBuffer(const FrameBufferObject& iF /*=FrameBufferObject()*/)
{
  mFrameBuffers.push_back(iF);
  GLint frameBufferId = 0;
  if(iF.isValid())
    frameBufferId = iF.getFrameBufferId();
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId);  
}
开发者ID:realisim,项目名称:realisim,代码行数:9,代码来源:Widget3d.cpp

示例9: deleteEqFrameBufferObject

void ObjectManager::deleteEqFrameBufferObject( const void* key )
{
    FBOHash::iterator i = _impl->eqFrameBufferObjects.find(key);
    if( i == _impl->eqFrameBufferObjects.end( ))
        return;

    FrameBufferObject* frameBufferObject = i->second;
    _impl->eqFrameBufferObjects.erase( i );

    frameBufferObject->exit();
    delete frameBufferObject;
}
开发者ID:Angels-group,项目名称:Equalizer,代码行数:12,代码来源:objectManager.cpp

示例10: execSyncV

void FrameBufferObjectBase::execSyncV(      FieldContainer    &oFrom,
                                        ConstFieldMaskArg  whichField,
                                        AspectOffsetStore &oOffsets,
                                        ConstFieldMaskArg  syncMode,
                                  const UInt32             uiSyncInfo)
{
    FrameBufferObject *pThis = static_cast<FrameBufferObject *>(this);

    pThis->execSync(static_cast<FrameBufferObject *>(&oFrom),
                    whichField,
                    oOffsets,
                    syncMode,
                    uiSyncInfo);
}
开发者ID:Langkamp,项目名称:OpenSGDevMaster_Toolbox,代码行数:14,代码来源:OSGFrameBufferObjectBase.cpp

示例11: resizeStageData

void DisplayFilterStage::resizeStageData(DisplayFilterStageData *pData,
                                         Int32                   iPixelWidth,
                                         Int32                   iPixelHeight)
{
    FrameBufferObject *pFBO = pData->getTarget();

    if(pFBO == NULL)
        return;

    TextureBuffer *pTexBuffer = 
        dynamic_cast<TextureBuffer *>(pFBO->getColorAttachments(0));

    if(pTexBuffer == NULL)
        return;

    TextureObjChunk *pTex = pTexBuffer->getTexture();

    if(pTex == NULL)
        return;

    Image *pImg = pTex->getImage();

    if(pImg == NULL)
        return;

    pImg->set(Image::OSG_RGB_PF, 
              iPixelWidth, 
              iPixelHeight,
              1,
              1,
              1,
              0.0,
              0,
              Image::OSG_UINT8_IMAGEDATA,
              false);

    pFBO->setSize(iPixelWidth, iPixelHeight);

    pData->setWidth (iPixelWidth );
    pData->setHeight(iPixelHeight);

    commitChanges();
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:43,代码来源:OSGDisplayFilterStage.cpp

示例12: drawModelTransforms

void DrawShader::drawModelTransforms(
      Shader& shader,
      const Drawable& drawable,
      const glm::mat4& view,
      const FrameBufferObject& deferred_diffuse_fbo,
      const FrameBufferObject& deferred_position_fbo,
      const FrameBufferObject& deferred_normal_fbo,
      bool needsModel,
      const UniformLocationMap& uniforms) {
   for(const auto& instance : drawable.draw_instances) {
      if (instance.material) {
         instance.material->sendMaterial(shader, uniforms);
      }

      const auto model_view = view * instance.model_transform;
      shader.sendUniform(Uniform::MODEL_VIEW_PROJECTION, uniforms, gProjectionMatrix * model_view);
      SendModelAndNormal(shader, uniforms, model_view, instance.model_transform, needsModel);
      for (int i = 0; i < LAST_DEFERRED; ++i) {
         const auto deferred_type(static_cast<DeferredType>(i));
         switch (deferred_type) {
            case DEFERRED_DIFFUSE:
               deferred_diffuse_fbo.bind();
               break;
            case DEFERRED_POSITION:
               deferred_position_fbo.bind();
               break;
            case DEFERRED_NORMAL:
               deferred_normal_fbo.bind();
               break;
            default: break;
         }
         shader.sendUniform(Uniform::OUTPUT_SHADER_TYPE, uniforms, i);
         shader.drawMesh(drawable.draw_template.mesh);
      }
   }
}
开发者ID:Ethanmn,项目名称:CPE476Final,代码行数:36,代码来源:draw_shaders.cpp

示例13: resizeStageData

void HDRStage::resizeStageData(HDRStageData *pData,
                               Int32         iPixelWidth,
                               Int32         iPixelHeight)
{
    FrameBufferObject *pSceneFBO = this->getRenderTarget();

    pSceneFBO->resizeAll(iPixelWidth, iPixelHeight);


    FrameBufferObject *pShrinkFBO = pData->getShrinkRenderTarget();

    pShrinkFBO->resizeAll(iPixelWidth / 2, iPixelHeight / 2);


    FrameBufferObject *pBlurFBO = pData->getBlurRenderTarget();

    pBlurFBO->resizeAll(iPixelWidth  / 4,
                        iPixelHeight / 4);


    SimpleSHLChunk *pHBlurShader = pData->getHBlurShader();

    std::string szNewFragProg =         
        generate1DConvolutionFilterFPString(getBlurWidth(), 
                                            false, 
                                            true, 
                                            iPixelWidth  / 2, 
                                            iPixelHeight / 2);

    pHBlurShader->setFragmentProgram(szNewFragProg);

    szNewFragProg = generate1DConvolutionFilterFPString(getBlurWidth(),  
                                                        true, 
                                                        true, 
                                                        iPixelWidth  / 2, 
                                                        iPixelHeight / 2);

    SimpleSHLChunkUnrecPtr pVBlurShader = pData->getVBlurShader();

    pVBlurShader->setFragmentProgram(szNewFragProg);

    commitChanges();
} 
开发者ID:jondo2010,项目名称:OpenSG,代码行数:43,代码来源:OSGHDRStage.cpp

示例14: resizeStageData

void DepthPeelingStage::resizeStageData(DepthPeelingStageData *pData,
                                        Int32                  iPixelWidth,
                                        Int32                  iPixelHeight)
{
    FrameBufferObject *pSceneFBO = pData->getBlendFBO();

    pSceneFBO->resizeAll(iPixelWidth, iPixelHeight);


    FrameBufferObject *pPeelPingFBO = pData->getPeelPingFBO();

    pPeelPingFBO->resizeAll(iPixelWidth, iPixelHeight);

    FrameBufferObject *pPeelPongFBO = pData->getPeelPongFBO();

    pPeelPongFBO->resizeAll(iPixelWidth, iPixelHeight);

    commitChanges();
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:19,代码来源:OSGDepthPeelingStage.cpp

示例15: AttachCubeSide

static void AttachCubeSide(int i, FrameBufferObject & reflection_fbo, std::ostream & error_output)
{
	switch (i)
	{
		case 0:
		reflection_fbo.SetCubeSide(FrameBufferTexture::POSX);
		break;

		case 1:
		reflection_fbo.SetCubeSide(FrameBufferTexture::NEGX);
		break;

		case 2:
		reflection_fbo.SetCubeSide(FrameBufferTexture::POSY);
		break;

		case 3:
		reflection_fbo.SetCubeSide(FrameBufferTexture::NEGY);
		break;

		case 4:
		reflection_fbo.SetCubeSide(FrameBufferTexture::POSZ);
		break;

		case 5:
		reflection_fbo.SetCubeSide(FrameBufferTexture::NEGZ);
		break;

		default:
		error_output << "Reached odd spot while attaching cubemap side. How many sides are in a cube, anyway? " << i << "?" << std::endl;
		assert(0);
		break;
	};

	CheckForOpenGLErrors("cubemap generation: FBO cube side attachment", error_output);
}
开发者ID:lwllovewf2010,项目名称:vdrift,代码行数:36,代码来源:graphics_gl2.cpp


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