本文整理汇总了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);
}
}
}
示例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);
}
示例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());
}
}
示例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());
}
}
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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);
}