本文整理汇总了C++中FrameBuffer::Bind方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBuffer::Bind方法的具体用法?C++ FrameBuffer::Bind怎么用?C++ FrameBuffer::Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBuffer
的用法示例。
在下文中一共展示了FrameBuffer::Bind方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxiliary)
{
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
{
auxiliary.Bind();
glUseProgram(FullScreenShader::Gaussian6VBlurShader::Program);
glBindVertexArray(FullScreenShader::Gaussian6VBlurShader::vao);
glUniform2f(FullScreenShader::Gaussian6VBlurShader::uniform_pixel, inv_width, inv_height);
setTexture(0, in_fbo.getRTT()[0], GL_LINEAR, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glUniform1i(FullScreenShader::Gaussian6VBlurShader::uniform_tex, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
{
in_fbo.Bind();
glUseProgram(FullScreenShader::Gaussian6HBlurShader::Program);
glBindVertexArray(FullScreenShader::Gaussian6HBlurShader::vao);
glUniform2f(FullScreenShader::Gaussian6HBlurShader::uniform_pixel, inv_width, inv_height);
setTexture(0, auxiliary.getRTT()[0], GL_LINEAR, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glUniform1i(FullScreenShader::Gaussian6HBlurShader::uniform_tex, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
}
示例2: RenderFrame
virtual void RenderFrame()
{
FBO.Bind();
FBO.DrawFrameBuffer();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, GetWindowWidth(), GetWindowHeight());
float r = flow / 100.0f;
ProgramRender["varyingcolor"] = glm::vec4(r, 0.0f, 1.0f, 1.0f);
ProgramRender["MVP"] = FPSCamera.GetModelViewProjection();
ProgramRender.Use();
Plain.DrawMesh();
FBO.UnBind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, GetWindowWidth(), GetWindowHeight());
Text1.Activate();
ProgramDraw.Use();
glm::mat4 MVP = FPSCamera.GetModelViewProjection();
ProgramDraw["transformMatrix"] = MVP;
Android.DrawMesh();
if (flow >= 100)
{
flow = 0;
}
flow++;
}
示例3: renderMotionBlur
void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBuffer &out_fbo)
{
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
getCallback(ES_MOTIONBLUR);
scene::ICameraSceneNode * const camnode =
Camera::getCamera(cam)->getCameraSceneNode();
// Calculate the kart's Y position on screen
const core::vector3df pos =
Camera::getCamera(cam)->getKart()->getNode()->getPosition();
float ndc[4];
core::matrix4 trans = camnode->getProjectionMatrix();
trans *= camnode->getViewMatrix();
trans.transformVect(ndc, pos);
const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f;
setMotionBlurCenterY(cam, karty);
out_fbo.Bind();
glClear(GL_COLOR_BUFFER_BIT);
FullScreenShader::MotionBlurShader::getInstance()->SetTextureUnits(createVector<GLuint>(in_fbo.getRTT()[0], irr_driver->getDepthStencilTexture()));
DrawFullScreenEffect<FullScreenShader::MotionBlurShader>(
// Todo : use a previousPVMatrix per cam, not global
irr_driver->getPreviousPVMatrix(),
cb->getCenter(cam),
cb->getBoostTime(0) * 10, // Todo : should be framerate dependent
0.15f);
}
示例4: renderMotionBlur
void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBuffer &out_fbo)
{
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
getCallback(ES_MOTIONBLUR);
scene::ICameraSceneNode * const camnode =
Camera::getCamera(cam)->getCameraSceneNode();
// Calculate the kart's Y position on screen
const core::vector3df pos =
Camera::getCamera(cam)->getKart()->getNode()->getPosition();
float ndc[4];
core::matrix4 trans = camnode->getProjectionMatrix();
trans *= camnode->getViewMatrix();
trans.transformVect(ndc, pos);
const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f;
setMotionBlurCenterY(cam, karty);
out_fbo.Bind();
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(FullScreenShader::MotionBlurShader::Program);
glBindVertexArray(FullScreenShader::MotionBlurShader::vao);
setTexture(0, in_fbo.getRTT()[0], GL_NEAREST, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
FullScreenShader::MotionBlurShader
::setUniforms(cb->getBoostTime(cam), cb->getCenter(cam),
cb->getDirection(cam), 0.15f,
cb->getMaxHeight(cam) * 0.7f, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
示例5: assert
void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxiliary)
{
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
{
auxiliary.Bind();
FullScreenShader::Gaussian6VBlurShader::getInstance()->SetTextureUnits(createVector<GLuint>(in_fbo.getRTT()[0]));
DrawFullScreenEffect<FullScreenShader::Gaussian6VBlurShader>(core::vector2df(inv_width, inv_height));
}
{
in_fbo.Bind();
FullScreenShader::Gaussian6HBlurShader::getInstance()->SetTextureUnits(createVector<GLuint>(auxiliary.getRTT()[0]));
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(inv_width, inv_height));
}
}
示例6: assert
void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &auxiliary)
{
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
if (CVS->supportsComputeShadersFiltering())
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT);
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
{
if (!CVS->supportsComputeShadersFiltering())
{
auxiliary.Bind();
FullScreenShader::Gaussian17TapHShader::getInstance()->SetTextureUnits(in_fbo.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]);
DrawFullScreenEffect<FullScreenShader::Gaussian17TapHShader>(core::vector2df(inv_width, inv_height));
}
else
{
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->Program);
glBindSampler(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, 0);
FullScreenShader::ComputeGaussian17TapHShader::getInstance()->SetTextureUnits(in_fbo.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]);
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
FullScreenShader::ComputeGaussian17TapHShader::getInstance()->setUniforms(core::vector2df(inv_width, inv_height));
glDispatchCompute((int)in_fbo.getWidth() / 8 + 1, (int)in_fbo.getHeight() / 8 + 1, 1);
}
}
if (CVS->supportsComputeShadersFiltering())
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
{
if (!CVS->supportsComputeShadersFiltering())
{
in_fbo.Bind();
FullScreenShader::Gaussian17TapVShader::getInstance()->SetTextureUnits(auxiliary.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]);
DrawFullScreenEffect<FullScreenShader::Gaussian17TapVShader>(core::vector2df(inv_width, inv_height));
}
else
{
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->Program);
glBindSampler(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, 0);
FullScreenShader::ComputeGaussian17TapVShader::getInstance()->SetTextureUnits(auxiliary.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]);
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
FullScreenShader::ComputeGaussian17TapVShader::getInstance()->setUniforms(core::vector2df(inv_width, inv_height));
glDispatchCompute((int)in_fbo.getWidth() / 8 + 1, (int)in_fbo.getHeight() / 8 + 1, 1);
}
}
if (CVS->supportsComputeShadersFiltering())
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
}
示例7: assert
void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxiliary, float sigmaV, float sigmaH)
{
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
{
if (!irr_driver->hasARBComputeShaders())
{
auxiliary.Bind();
FullScreenShader::Gaussian6VBlurShader::getInstance()->SetTextureUnits(in_fbo.getRTT()[0]);
DrawFullScreenEffect<FullScreenShader::Gaussian6VBlurShader>(core::vector2df(inv_width, inv_height), sigmaV);
}
else
{
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
glUseProgram(FullScreenShader::ComputeGaussian6VBlurShader::getInstance()->Program);
FullScreenShader::ComputeGaussian6VBlurShader::getInstance()->SetTextureUnits(in_fbo.getRTT()[0]);
glBindSampler(FullScreenShader::ComputeGaussian6VBlurShader::getInstance()->TU_dest, 0);
glBindImageTexture(FullScreenShader::ComputeGaussian6VBlurShader::getInstance()->TU_dest, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F);
FullScreenShader::ComputeGaussian6VBlurShader::getInstance()->setUniforms(core::vector2df(inv_width, inv_height), sigmaV);
glDispatchCompute((int)in_fbo.getWidth() / 8 + 1, (int)in_fbo.getHeight() / 8 + 1, 1);
}
}
{
if (!irr_driver->hasARBComputeShaders())
{
in_fbo.Bind();
FullScreenShader::Gaussian6HBlurShader::getInstance()->SetTextureUnits(auxiliary.getRTT()[0]);
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(inv_width, inv_height), sigmaH);
}
else
{
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
glUseProgram(FullScreenShader::ComputeGaussian6HBlurShader::getInstance()->Program);
FullScreenShader::ComputeGaussian6HBlurShader::getInstance()->SetTextureUnits(auxiliary.getRTT()[0]);
glBindSampler(FullScreenShader::ComputeGaussian6HBlurShader::getInstance()->TU_dest, 0);
glBindImageTexture(FullScreenShader::ComputeGaussian6HBlurShader::getInstance()->TU_dest, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F);
FullScreenShader::ComputeGaussian6HBlurShader::getInstance()->setUniforms(core::vector2df(inv_width, inv_height), sigmaH);
glDispatchCompute((int)in_fbo.getWidth() / 8 + 1, (int)in_fbo.getHeight() / 8 + 1, 1);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
}
}
}
示例8: renderDoF
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
{
fbo.Bind();
glUseProgram(FullScreenShader::DepthOfFieldShader::Program);
glBindVertexArray(FullScreenShader::DepthOfFieldShader::vao);
setTexture(0, rtt, GL_LINEAR, GL_LINEAR);
setTexture(1, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
FullScreenShader::DepthOfFieldShader::setUniforms(0, 1);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
示例9: toneMap
static void toneMap(FrameBuffer &fbo, GLuint rtt)
{
fbo.Bind();
glUseProgram(FullScreenShader::ToneMapShader::Program);
glBindVertexArray(FullScreenShader::ToneMapShader::vao);
setTexture(0, rtt, GL_NEAREST, GL_NEAREST);
setTexture(1, irr_driver->getRenderTargetTexture(RTT_LOG_LUMINANCE), GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
FullScreenShader::ToneMapShader::setUniforms(irr_driver->getExposure(), irr_driver->getLwhite(), 0, 1);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
示例10: renderDoF
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
{
fbo.Bind();
FullScreenShader::DepthOfFieldShader::getInstance()->SetTextureUnits(createVector<GLuint>(rtt, irr_driver->getDepthStencilTexture()));
DrawFullScreenEffect<FullScreenShader::DepthOfFieldShader>();
}
示例11: toneMap
static void toneMap(FrameBuffer &fbo, GLuint rtt)
{
fbo.Bind();
FullScreenShader::ToneMapShader::getInstance()->SetTextureUnits(createVector<GLuint>(rtt));
DrawFullScreenEffect<FullScreenShader::ToneMapShader>();
}
示例12: toneMap
static void toneMap(FrameBuffer &fbo, GLuint rtt, float vignette_weight)
{
fbo.Bind();
FullScreenShader::ToneMapShader::getInstance()->SetTextureUnits(rtt);
DrawFullScreenEffect<FullScreenShader::ToneMapShader>(vignette_weight);
}