本文整理汇总了C++中FrameBufferObject::editMFDrawBuffers方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBufferObject::editMFDrawBuffers方法的具体用法?C++ FrameBufferObject::editMFDrawBuffers怎么用?C++ FrameBufferObject::editMFDrawBuffers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBufferObject
的用法示例。
在下文中一共展示了FrameBufferObject::editMFDrawBuffers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postProcess
void HDRStage::postProcess(DrawEnv *pEnv)
{
Window *win = pEnv->getWindow();
if(win->hasExtension(_uiFramebuffer_object_extension) == false)
{
FNOTICE(("Framebuffer objects not supported on Window %p!\n", win));
return;
}
GLDrawBuffersEXTProcT glDrawBuffersEXTProc =
reinterpret_cast<GLDrawBuffersEXTProcT>(
win->getFunction(_uiFuncDrawBuffers));
glColor3f(1.f, 1.f, 1.f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
HDRStageData *pData = pEnv->getData<HDRStageData *>(_iDataSlotId);
if(pData == NULL)
{
return;
}
if((pData->getWidth () != pEnv->getPixelWidth() ) ||
(pData->getHeight() != pEnv->getPixelHeight()) )
{
resizeStageData(pData,
pEnv->getPixelWidth(),
pEnv->getPixelHeight());
}
// Shrink to w/2 h/2
FrameBufferObject *pShrinkTarget = pData->getShrinkRenderTarget();
ChunkMaterial *pSHM = pData->getShrinkMaterial();
pShrinkTarget->activate(pEnv);
glViewport(0,
0,
pEnv->getPixelWidth () / 2,
pEnv->getPixelHeight() / 2);
State *pShrinkState = pSHM->getState();
pEnv->activateState(pShrinkState, NULL);
glBegin(GL_QUADS);
{
glTexCoord2f(0.00, 0.00);
glVertex2f (0.00, 0.00);
glTexCoord2f(1.00, 0.00);
glVertex2f (1.00, 0.00);
glTexCoord2f(1.00, 1.00);
glVertex2f (1.00, 1.00);
glTexCoord2f(0.00, 1.00);
glVertex2f (0.00, 1.00);
}
glEnd();
pShrinkTarget->deactivate(pEnv);
// Shrink to w/4 h/4
FrameBufferObject *pBlurTarget = pData->getBlurRenderTarget();
pBlurTarget->editMFDrawBuffers()->clear();
pBlurTarget->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT);
pBlurTarget->activate(pEnv);
glViewport(0,
0,
pEnv->getPixelWidth () / 4,
pEnv->getPixelHeight() / 4);
ChunkMaterial *pBLM = pData->getBlurMaterial();
State *pBlurState = pBLM->getState();
pEnv->activateState(pBlurState, NULL);
glBegin(GL_QUADS);
{
glTexCoord2f(0.00, 0.00);
glVertex2f (0.00, 0.00);
//.........这里部分代码省略.........
示例2: updateStageData
void DeferredShadingStage::updateStageData(
DSStageData *data,
FrameBufferObject *shadingTarget,
RenderPartition *parentPart )
{
FrameBufferObject *gBufferTarget = data->getGBufferTarget();
Int32 targetWidth;
Int32 targetHeight;
Int32 targetLeft;
Int32 targetBottom;
if(shadingTarget != NULL)
{
targetWidth = shadingTarget->getWidth ();
targetHeight = shadingTarget->getHeight();
targetLeft = 0;
targetBottom = 0;
}
else
{
targetWidth = parentPart->getDrawEnv().getPixelWidth ();
targetHeight = parentPart->getDrawEnv().getPixelHeight();
targetLeft = parentPart->getDrawEnv().getPixelLeft ();
targetBottom = parentPart->getDrawEnv().getPixelBottom();
}
if(gBufferTarget->getWidth () != targetWidth ||
gBufferTarget->getHeight() != targetHeight )
{
_targetSizeChanged = true;
}
if(_targetSizeChanged == true)
{
gBufferTarget->setSize(targetWidth, targetHeight);
}
if(getMFPixelFormats()->size() != getMFPixelTypes()->size())
{
SWARNING << "DeferredShadingStage::updateStageData: "
<< "Number of PixelFormats and PixelTypes inconsistent."
<< std::endl;
}
UInt32 lightCount = getMFLights ()->size();
UInt32 bufferCount = osgMin(getMFPixelFormats()->size(),
getMFPixelTypes ()->size() );
// buffers changed - remove them here, recreate below
if((_changeCache & (PixelFormatsFieldMask |
PixelTypesFieldMask )) != 0)
{
gBufferTarget->editMFColorAttachments()->clear ( );
gBufferTarget->editMFColorAttachments()->resize(bufferCount, NULL );
gBufferTarget->editMFDrawBuffers ()->clear ( );
gBufferTarget->editMFDrawBuffers ()->resize(bufferCount, GL_NONE);
}
for(UInt32 i = 0; i < bufferCount; ++i)
{
TextureBuffer *buf =
dynamic_cast<TextureBuffer *>(gBufferTarget->getColorAttachments(i));
if(buf == NULL)
{
TextureBufferUnrecPtr newBuf =
createGBuffer(i, targetWidth, targetHeight);
buf = newBuf;
gBufferTarget->editMFColorAttachments()->replace(i, newBuf );
gBufferTarget->editMFDrawBuffers ()->replace(i, GL_COLOR_ATTACHMENT0_EXT + i);
}
else
{
updateGBuffer(buf, i, targetWidth, targetHeight);
}
}
if((_changeCache & LightsFieldMask) != 0)
{
data->editMFLightChunks ()->resize( lightCount, NULL);
data->editMFShadingStates ()->resize(1 + lightCount, NULL);
data->editMFShadingProgramChunks()->resize(1 + lightCount, NULL);
}
// update shading states
if((_changeCache & (PixelFormatsFieldMask |
PixelTypesFieldMask |
AmbientProgramFieldMask |
LightProgramsFieldMask |
LightsFieldMask )) != 0)
{
// copy ambient and light programs
DSStageData::MFShadingProgramChunksType::const_iterator spcIt =
data->editMFShadingProgramChunks()->begin();
DSStageData::MFShadingProgramChunksType::const_iterator spcEnd =
data->editMFShadingProgramChunks()->end ();
//.........这里部分代码省略.........
示例3: postProcess
void HDRStage::postProcess(DrawEnv *pEnv)
{
UInt32 uiActiveFBO = pEnv->getActiveFBO();
Window *win = pEnv->getWindow();
if(win->hasExtOrVersion(_uiFramebufferObjectExt, 0x0300, 0x0200) == false)
{
FNOTICE(("Framebuffer objects not supported on Window %p!\n",
static_cast<void *>(win)));
return;
}
OSGGETGLFUNCBYID_GL3( glDrawBuffers,
osgGlDrawBuffers,
_uiFuncDrawBuffers,
win);
glColor3f(1.f, 1.f, 1.f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
HDRStageData *pData = pEnv->getData<HDRStageData *>(_iDataSlotId);
if(pData == NULL)
{
return;
}
// Shrink to w/2 h/2
FrameBufferObject *pShrinkTarget = pData->getShrinkRenderTarget();
ChunkMaterial *pSHM = pData->getShrinkMaterial();
pShrinkTarget->activate(pEnv);
glViewport(0,
0,
pEnv->getPixelWidth () / 2,
pEnv->getPixelHeight() / 2);
State *pShrinkState = pSHM->getState();
pEnv->activateState(pShrinkState, NULL);
this->renderQuad();
pShrinkTarget->deactivate(pEnv);
// Shrink to w/4 h/4
FrameBufferObject *pBlurTarget = pData->getBlurRenderTarget();
pBlurTarget->editMFDrawBuffers()->clear();
pBlurTarget->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT);
pBlurTarget->activate(pEnv);
glViewport(0,
0,
pEnv->getPixelWidth () / 4,
pEnv->getPixelHeight() / 4);
ChunkMaterial *pBLM = pData->getBlurMaterial();
State *pBlurState = pBLM->getState();
pEnv->activateState(pBlurState, NULL);
this->renderQuad();
GLenum aDrawBuffers[] = { GL_COLOR_ATTACHMENT0_EXT };
// HBlur
pBlurTarget->activate(pEnv);
glViewport(0,
0,
pEnv->getPixelWidth () / 4,
pEnv->getPixelHeight() / 4);
#define OVERSHADER 1
#if OVERSHADER
//.........这里部分代码省略.........