Removed one more reference to global function, renamed functions

Bind and BindLayer to bind and bindLayer.
This commit is contained in:
hiker 2015-05-22 09:29:42 +10:00
parent 3a64d2c70e
commit cc9163ca77
7 changed files with 67 additions and 59 deletions

View File

@ -244,7 +244,7 @@ FrameBuffer::~FrameBuffer()
glDeleteFramebuffers(1, &fbolayer); glDeleteFramebuffers(1, &fbolayer);
} }
void FrameBuffer::Bind() void FrameBuffer::bind() const
{ {
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glViewport(0, 0, (int)width, (int)height); glViewport(0, 0, (int)width, (int)height);
@ -252,7 +252,7 @@ void FrameBuffer::Bind()
glDrawBuffers((int)RenderTargets.size(), bufs); glDrawBuffers((int)RenderTargets.size(), bufs);
} }
void FrameBuffer::BindLayer(unsigned i) void FrameBuffer::bindLayer(unsigned i)
{ {
glBindFramebuffer(GL_FRAMEBUFFER, fbolayer); glBindFramebuffer(GL_FRAMEBUFFER, fbolayer);
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, RenderTargets[0], 0, i); glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, RenderTargets[0], 0, i);

View File

@ -69,8 +69,8 @@ public:
FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false); FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false);
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false); FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
~FrameBuffer(); ~FrameBuffer();
void Bind(); void bind() const;
void BindLayer(unsigned); void bindLayer(unsigned);
const std::vector<GLuint> &getRTT() const { return RenderTargets; } const std::vector<GLuint> &getRTT() const { return RenderTargets; }
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; } GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
size_t getWidth() const { return width; } size_t getWidth() const { return width; }

View File

@ -379,7 +379,7 @@ public:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void render(FrameBuffer &fbo, GLuint rtt, float vignette_weight) void render(FrameBuffer &fbo, GLuint rtt, float vignette_weight)
{ {
fbo.Bind(); fbo.bind();
setTextureUnits(rtt); setTextureUnits(rtt);
drawFullScreenEffect(vignette_weight); drawFullScreenEffect(vignette_weight);
} // render } // render
@ -398,6 +398,14 @@ public:
assignSamplerNames(0, "tex", ST_BILINEAR_FILTERED, assignSamplerNames(0, "tex", ST_BILINEAR_FILTERED,
1, "dtex", ST_NEAREST_FILTERED); 1, "dtex", ST_NEAREST_FILTERED);
} // DepthOfFieldShader } // DepthOfFieldShader
// ------------------------------------------------------------------------
void render(const FrameBuffer &fb, GLuint rtt)
{
fb.bind();
setTextureUnits(rtt, irr_driver->getDepthStencilTexture());
drawFullScreenEffect();
} // render
}; // DepthOfFieldShader }; // DepthOfFieldShader
// ============================================================================ // ============================================================================
@ -1039,12 +1047,12 @@ void PostProcessing::renderGaussian3Blur(FrameBuffer &in_fbo,
float inv_width = 1.0f / in_fbo.getWidth(); float inv_width = 1.0f / in_fbo.getWidth();
float inv_height = 1.0f / in_fbo.getHeight(); float inv_height = 1.0f / in_fbo.getHeight();
{ {
auxiliary.Bind(); auxiliary.bind();
Gaussian3VBlurShader::getInstance()->render(in_fbo, inv_width, Gaussian3VBlurShader::getInstance()->render(in_fbo, inv_width,
inv_height); inv_height);
} }
{ {
in_fbo.Bind(); in_fbo.bind();
Gaussian3HBlurShader::getInstance()->render(auxiliary, inv_width, Gaussian3HBlurShader::getInstance()->render(auxiliary, inv_width,
inv_height); inv_height);
} }
@ -1062,12 +1070,12 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo,
if (!CVS->supportsComputeShadersFiltering()) if (!CVS->supportsComputeShadersFiltering())
{ {
// Used as temp // Used as temp
irr_driver->getFBO(FBO_SCALAR_1024).Bind(); irr_driver->getFBO(FBO_SCALAR_1024).bind();
Gaussian6VBlurShader::getInstance() Gaussian6VBlurShader::getInstance()
->render(layer_tex, UserConfigParams::m_shadows_resolution, ->render(layer_tex, UserConfigParams::m_shadows_resolution,
UserConfigParams::m_shadows_resolution, sigma_v); UserConfigParams::m_shadows_resolution, sigma_v);
in_fbo.BindLayer(layer); in_fbo.bindLayer(layer);
Gaussian6HBlurShader::getInstance() Gaussian6HBlurShader::getInstance()
->render(irr_driver->getFBO(FBO_SCALAR_1024), ->render(irr_driver->getFBO(FBO_SCALAR_1024),
UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution,
@ -1122,12 +1130,12 @@ void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo,
if (!CVS->supportsComputeShadersFiltering()) if (!CVS->supportsComputeShadersFiltering())
{ {
auxiliary.Bind(); auxiliary.bind();
Gaussian6VBlurShader::getInstance() Gaussian6VBlurShader::getInstance()
->render(in_fbo.getRTT()[0], in_fbo.getWidth(), in_fbo.getWidth(), ->render(in_fbo.getRTT()[0], in_fbo.getWidth(), in_fbo.getWidth(),
sigma_v); sigma_v);
in_fbo.Bind(); in_fbo.bind();
Gaussian6HBlurShader::getInstance()->setTextureUnits(auxiliary.getRTT()[0]); Gaussian6HBlurShader::getInstance()->setTextureUnits(auxiliary.getRTT()[0]);
Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(), Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(),
in_fbo.getHeight(), sigma_h); in_fbo.getHeight(), sigma_h);
@ -1176,10 +1184,10 @@ void PostProcessing::renderHorizontalBlur(FrameBuffer &in_fbo,
float inv_width = 1.0f / in_fbo.getWidth(); float inv_width = 1.0f / in_fbo.getWidth();
float inv_height = 1.0f / in_fbo.getHeight(); float inv_height = 1.0f / in_fbo.getHeight();
auxiliary.Bind(); auxiliary.bind();
Gaussian6HBlurShader::getInstance()->render(in_fbo, in_fbo.getWidth(), Gaussian6HBlurShader::getInstance()->render(in_fbo, in_fbo.getWidth(),
in_fbo.getHeight(), 2.0f ); in_fbo.getHeight(), 2.0f );
in_fbo.Bind(); in_fbo.bind();
Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(), Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(),
in_fbo.getHeight(), 2.0f); in_fbo.getHeight(), 2.0f);
} // renderHorizontalBlur } // renderHorizontalBlur
@ -1198,7 +1206,7 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo,
{ {
if (!CVS->supportsComputeShadersFiltering()) if (!CVS->supportsComputeShadersFiltering())
{ {
auxiliary.Bind(); auxiliary.bind();
Gaussian17TapHShader::getInstance()->render(in_fbo, Gaussian17TapHShader::getInstance()->render(in_fbo,
in_fbo.getWidth(), in_fbo.getWidth(),
in_fbo.getHeight()); in_fbo.getHeight());
@ -1216,7 +1224,7 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo,
{ {
if (!CVS->supportsComputeShadersFiltering()) if (!CVS->supportsComputeShadersFiltering())
{ {
in_fbo.Bind(); in_fbo.bind();
Gaussian17TapVShader::getInstance()->render(auxiliary, Gaussian17TapVShader::getInstance()->render(auxiliary,
in_fbo.getWidth(), in_fbo.getWidth(),
in_fbo.getHeight()); in_fbo.getHeight());
@ -1267,9 +1275,9 @@ void PostProcessing::renderSSAO()
glDisable(GL_BLEND); glDisable(GL_BLEND);
// Generate linear depth buffer // Generate linear depth buffer
irr_driver->getFBO(FBO_LINEAR_DEPTH).Bind(); irr_driver->getFBO(FBO_LINEAR_DEPTH).bind();
LinearizeDepthShader::getInstance()->render(); LinearizeDepthShader::getInstance()->render();
irr_driver->getFBO(FBO_SSAO).Bind(); irr_driver->getFBO(FBO_SSAO).bind();
SSAOShader::getInstance()->render(); SSAOShader::getInstance()->render();
} // renderSSAO } // renderSSAO
@ -1299,7 +1307,7 @@ void PostProcessing::renderMotionBlur(unsigned , FrameBuffer &in_fbo,
else else
setMotionBlurCenterY(camID, 0.5f); setMotionBlurCenterY(camID, 0.5f);
out_fbo.Bind(); out_fbo.bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
float boost_time = cb->getBoostTime(cam->getIndex()) * 10; float boost_time = cb->getBoostTime(cam->getIndex()) * 10;
@ -1308,12 +1316,9 @@ void PostProcessing::renderMotionBlur(unsigned , FrameBuffer &in_fbo,
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static void renderDoF(FrameBuffer &fbo, GLuint rtt) static void renderDoF(const FrameBuffer &fbo, GLuint rtt)
{ {
fbo.Bind(); DepthOfFieldShader::getInstance()->render(fbo, rtt);
DepthOfFieldShader::getInstance()
->setTextureUnits(rtt, irr_driver->getDepthStencilTexture());
DrawFullScreenEffect<DepthOfFieldShader>();
} // renderDoF } // renderDoF
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1323,7 +1328,7 @@ void PostProcessing::applyMLAA()
core::vector2df(1.0f / UserConfigParams::m_width, core::vector2df(1.0f / UserConfigParams::m_width,
1.0f / UserConfigParams::m_height); 1.0f / UserConfigParams::m_height);
irr_driver->getFBO(FBO_MLAA_TMP).Bind(); irr_driver->getFBO(FBO_MLAA_TMP).bind();
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
glClearColor(0.0, 0.0, 0.0, 1.0); glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
@ -1340,7 +1345,7 @@ void PostProcessing::applyMLAA()
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
// Pass 2: blend weights // Pass 2: blend weights
irr_driver->getFBO(FBO_MLAA_BLEND).Bind(); irr_driver->getFBO(FBO_MLAA_BLEND).bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
MLAABlendWeightSHader::getInstance()->use(); MLAABlendWeightSHader::getInstance()->use();
@ -1354,7 +1359,7 @@ void PostProcessing::applyMLAA()
irr_driver->getFBO(FBO_MLAA_TMP)); irr_driver->getFBO(FBO_MLAA_TMP));
// Pass 3: gather // Pass 3: gather
irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); irr_driver->getFBO(FBO_MLAA_COLORS).bind();
MLAAGatherSHader::getInstance()->use(); MLAAGatherSHader::getInstance()->use();
MLAAGatherSHader::getInstance() MLAAGatherSHader::getInstance()
@ -1403,7 +1408,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
// Grab the sky // Grab the sky
out_fbo->Bind(); out_fbo->bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
// irr_driver->renderSkybox(camnode); // irr_driver->renderSkybox(camnode);
@ -1420,7 +1425,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
// Fade to quarter // Fade to quarter
irr_driver->getFBO(FBO_QUARTER1).Bind(); irr_driver->getFBO(FBO_QUARTER1).bind();
glViewport(0, 0, irr_driver->getActualScreenSize().Width / 4, glViewport(0, 0, irr_driver->getActualScreenSize().Width / 4,
irr_driver->getActualScreenSize().Height / 4); irr_driver->getActualScreenSize().Height / 4);
GodFadeShader::getInstance()->render(out_fbo->getRTT()[0], col); GodFadeShader::getInstance()->render(out_fbo->getRTT()[0], col);
@ -1446,7 +1451,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
const float suny = ((ndc[1] / ndc[3]) * 0.5f + 0.5f) * texh; const float suny = ((ndc[1] / ndc[3]) * 0.5f + 0.5f) * texh;
// Rays please // Rays please
irr_driver->getFBO(FBO_QUARTER2).Bind(); irr_driver->getFBO(FBO_QUARTER2).bind();
GodRayShader::getInstance() GodRayShader::getInstance()
->render(irr_driver->getRenderTargetTexture(RTT_QUARTER1), ->render(irr_driver->getRenderTargetTexture(RTT_QUARTER1),
core::vector2df(sunx, suny) ); core::vector2df(sunx, suny) );
@ -1461,7 +1466,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE);
glBlendEquation(GL_FUNC_ADD); glBlendEquation(GL_FUNC_ADD);
in_fbo->Bind(); in_fbo->bind();
renderPassThrough(irr_driver->getRenderTargetTexture(RTT_QUARTER2), renderPassThrough(irr_driver->getRenderTargetTexture(RTT_QUARTER2),
in_fbo->getWidth(), in_fbo->getHeight()); in_fbo->getWidth(), in_fbo->getHeight());
glDisable(GL_BLEND); glDisable(GL_BLEND);
@ -1482,7 +1487,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
FrameBuffer::Blit(*in_fbo, irr_driver->getFBO(FBO_BLOOM_1024), FrameBuffer::Blit(*in_fbo, irr_driver->getFBO(FBO_BLOOM_1024),
GL_COLOR_BUFFER_BIT, GL_LINEAR); GL_COLOR_BUFFER_BIT, GL_LINEAR);
irr_driver->getFBO(FBO_BLOOM_512).Bind(); irr_driver->getFBO(FBO_BLOOM_512).bind();
renderBloom(irr_driver->getRenderTargetTexture(RTT_BLOOM_1024)); renderBloom(irr_driver->getRenderTargetTexture(RTT_BLOOM_1024));
// Downsample // Downsample
@ -1522,7 +1527,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
// Additively blend on top of tmp1 // Additively blend on top of tmp1
in_fbo->Bind(); in_fbo->bind();
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
glBlendEquation(GL_FUNC_ADD); glBlendEquation(GL_FUNC_ADD);
@ -1577,7 +1582,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
return in_fbo; return in_fbo;
glEnable(GL_FRAMEBUFFER_SRGB); glEnable(GL_FRAMEBUFFER_SRGB);
irr_driver->getFBO(FBO_MLAA_COLORS).Bind(); irr_driver->getFBO(FBO_MLAA_COLORS).bind();
renderPassThrough(in_fbo->getRTT()[0], renderPassThrough(in_fbo->getRTT()[0],
irr_driver->getFBO(FBO_MLAA_COLORS).getWidth(), irr_driver->getFBO(FBO_MLAA_COLORS).getWidth(),
irr_driver->getFBO(FBO_MLAA_COLORS).getHeight()); irr_driver->getFBO(FBO_MLAA_COLORS).getHeight());

View File

@ -427,7 +427,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
if (CVS->isDefferedEnabled() || forceRTT) if (CVS->isDefferedEnabled() || forceRTT)
{ {
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).Bind(); m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
glClearColor(0., 0., 0., 0.); glClearColor(0., 0., 0., 0.);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
renderSolidFirstPass(); renderSolidFirstPass();
@ -437,7 +437,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
// We need a cleared depth buffer for some effect (eg particles depth blending) // We need a cleared depth buffer for some effect (eg particles depth blending)
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING)) if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
glDisable(GL_FRAMEBUFFER_SRGB); glDisable(GL_FRAMEBUFFER_SRGB);
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).Bind(); m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
// Bind() modifies the viewport. In order not to affect anything else, // Bind() modifies the viewport. In order not to affect anything else,
// the viewport is just reset here and not removed in Bind(). // the viewport is just reset here and not removed in Bind().
const core::recti &vp = Camera::getActiveCamera()->getViewport(); const core::recti &vp = Camera::getActiveCamera()->getViewport();
@ -474,7 +474,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF); PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF);
if (CVS->isDefferedEnabled() || forceRTT) if (CVS->isDefferedEnabled() || forceRTT)
{ {
m_rtts->getFBO(FBO_COLORS).Bind(); m_rtts->getFBO(FBO_COLORS).bind();
SColor clearColor(0, 150, 150, 150); SColor clearColor(0, 150, 150, 150);
if (World::getWorld() != NULL) if (World::getWorld() != NULL)
clearColor = World::getWorld()->getClearColor(); clearColor = World::getWorld()->getClearColor();
@ -489,9 +489,9 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
if (getNormals()) if (getNormals())
{ {
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).Bind(); m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
renderNormalsVisualisation(); renderNormalsVisualisation();
m_rtts->getFBO(FBO_COLORS).Bind(); m_rtts->getFBO(FBO_COLORS).bind();
} }
// Render ambient scattering // Render ambient scattering
@ -524,14 +524,17 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
if (getRH()) if (getRH())
{ {
glDisable(GL_BLEND); glDisable(GL_BLEND);
m_rtts->getFBO(FBO_COLORS).Bind(); m_rtts->getFBO(FBO_COLORS).bind();
m_post_processing->renderRHDebug(m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2], rh_matrix, rh_extend); m_post_processing->renderRHDebug(m_rtts->getRH().getRTT()[0],
m_rtts->getRH().getRTT()[1],
m_rtts->getRH().getRTT()[2],
rh_matrix, rh_extend);
} }
if (getGI()) if (getGI())
{ {
glDisable(GL_BLEND); glDisable(GL_BLEND);
m_rtts->getFBO(FBO_COLORS).Bind(); m_rtts->getFBO(FBO_COLORS).bind();
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH()); m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH());
} }
@ -709,7 +712,7 @@ void IrrDriver::renderShadowsDebug()
void IrrDriver::renderGlow(std::vector<GlowData>& glows) void IrrDriver::renderGlow(std::vector<GlowData>& glows)
{ {
m_scene_manager->setCurrentRendertime(scene::ESNRP_SOLID); m_scene_manager->setCurrentRendertime(scene::ESNRP_SOLID);
m_rtts->getFBO(FBO_TMP1_WITH_DS).Bind(); m_rtts->getFBO(FBO_TMP1_WITH_DS).bind();
glClearStencil(0); glClearStencil(0);
glClearColor(0, 0, 0, 0); glClearColor(0, 0, 0, 0);
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
@ -776,7 +779,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glStencilFunc(GL_EQUAL, 0, ~0); glStencilFunc(GL_EQUAL, 0, ~0);
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
m_rtts->getFBO(FBO_COLORS).Bind(); m_rtts->getFBO(FBO_COLORS).bind();
m_post_processing->renderGlow(m_rtts->getRenderTarget(RTT_QUARTER1)); m_post_processing->renderGlow(m_rtts->getRenderTarget(RTT_QUARTER1));
glDisable(GL_STENCIL_TEST); glDisable(GL_STENCIL_TEST);
} }

View File

@ -1560,9 +1560,9 @@ void IrrDriver::renderTransparent()
return; return;
// Render displacement nodes // Render displacement nodes
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind(); irr_driver->getFBO(FBO_TMP1_WITH_DS).bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
irr_driver->getFBO(FBO_DISPLACE).Bind(); irr_driver->getFBO(FBO_DISPLACE).bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
DisplaceProvider * const cb = DisplaceProvider * const cb =
@ -1581,7 +1581,7 @@ void IrrDriver::renderTransparent()
glBindVertexArray(VAOManager::getInstance()->getVAO(video::EVT_2TCOORDS)); glBindVertexArray(VAOManager::getInstance()->getVAO(video::EVT_2TCOORDS));
// Generate displace mask // Generate displace mask
// Use RTT_TMP4 as displace mask // Use RTT_TMP4 as displace mask
irr_driver->getFBO(FBO_TMP1_WITH_DS).Bind(); irr_driver->getFBO(FBO_TMP1_WITH_DS).bind();
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
{ {
const GLMesh &mesh = const GLMesh &mesh =
@ -1608,7 +1608,7 @@ void IrrDriver::renderTransparent()
(GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex); (GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex);
} }
irr_driver->getFBO(FBO_DISPLACE).Bind(); irr_driver->getFBO(FBO_DISPLACE).bind();
if (!displaceTex) if (!displaceTex)
displaceTex = irr_driver->getTexture(FileManager::TEXTURE, "displace.png"); displaceTex = irr_driver->getTexture(FileManager::TEXTURE, "displace.png");
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
@ -1640,7 +1640,7 @@ void IrrDriver::renderTransparent()
(int)mesh.vaoBaseVertex); (int)mesh.vaoBaseVertex);
} }
irr_driver->getFBO(FBO_COLORS).Bind(); irr_driver->getFBO(FBO_COLORS).bind();
glStencilFunc(GL_EQUAL, 1, 0xFF); glStencilFunc(GL_EQUAL, 1, 0xFF);
m_post_processing->renderPassThrough(m_rtts->getRenderTarget(RTT_DISPLACE), m_post_processing->renderPassThrough(m_rtts->getRenderTarget(RTT_DISPLACE),
irr_driver->getFBO(FBO_COLORS).getWidth(), irr_driver->getFBO(FBO_COLORS).getWidth(),
@ -1757,7 +1757,7 @@ void IrrDriver::renderShadows()
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND); glDisable(GL_BLEND);
m_rtts->getShadowFBO().Bind(); m_rtts->getShadowFBO().bind();
if (!CVS->isESMEnabled()) if (!CVS->isESMEnabled())
{ {
glDrawBuffer(GL_NONE); glDrawBuffer(GL_NONE);
@ -1923,7 +1923,7 @@ void IrrDriver::renderRSM()
if (m_rsm_map_available) if (m_rsm_map_available)
return; return;
ScopedGPUTimer Timer(getGPUTimer(Q_RSM)); ScopedGPUTimer Timer(getGPUTimer(Q_RSM));
m_rtts->getRSM().Bind(); m_rtts->getRSM().bind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
drawRSM<DefaultMaterial, 3, 1>(rsm_matrix); drawRSM<DefaultMaterial, 3, 1>(rsm_matrix);

View File

@ -405,7 +405,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
{ {
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_RH)); ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_RH));
glDisable(GL_BLEND); glDisable(GL_BLEND);
m_rtts->getRH().Bind(); m_rtts->getRH().bind();
glBindVertexArray(SharedGPUObjects::getFullScreenQuadVAO()); glBindVertexArray(SharedGPUObjects::getFullScreenQuadVAO());
if (CVS->needRHWorkaround()) if (CVS->needRHWorkaround())
{ {
@ -442,17 +442,17 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
for (unsigned i = 0; i < sun_ortho_matrix.size(); i++) for (unsigned i = 0; i < sun_ortho_matrix.size(); i++)
sun_ortho_matrix[i] *= getInvViewMatrix(); sun_ortho_matrix[i] *= getInvViewMatrix();
m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind(); m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_rtts->getFBO(FBO_DIFFUSE).Bind(); m_rtts->getFBO(FBO_DIFFUSE).bind();
if (CVS->isGlobalIlluminationEnabled() && hasShadow) if (CVS->isGlobalIlluminationEnabled() && hasShadow)
{ {
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_GI)); ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_GI));
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH()); m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH());
} }
m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind(); m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind();
{ {
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_ENVMAP)); ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_ENVMAP));
@ -508,7 +508,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void IrrDriver::renderSSAO() void IrrDriver::renderSSAO()
{ {
m_rtts->getFBO(FBO_SSAO).Bind(); m_rtts->getFBO(FBO_SSAO).bind();
glClearColor(1., 1., 1., 1.); glClearColor(1., 1., 1., 1.);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_post_processing->renderSSAO(); m_post_processing->renderSSAO();
@ -548,7 +548,7 @@ void IrrDriver::renderAmbientScatter()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void IrrDriver::renderLightsScatter(unsigned pointlightcount) void IrrDriver::renderLightsScatter(unsigned pointlightcount)
{ {
getFBO(FBO_HALF1).Bind(); getFBO(FBO_HALF1).bind();
glClearColor(0., 0., 0., 0.); glClearColor(0., 0., 0., 0.);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
@ -588,7 +588,7 @@ void IrrDriver::renderLightsScatter(unsigned pointlightcount)
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
getFBO(FBO_COLORS).Bind(); getFBO(FBO_COLORS).bind();
m_post_processing->renderPassThrough(getRenderTargetTexture(RTT_HALF1), m_post_processing->renderPassThrough(getRenderTargetTexture(RTT_HALF1),
getFBO(FBO_COLORS).getWidth(), getFBO(FBO_COLORS).getWidth(),
getFBO(FBO_COLORS).getHeight()); getFBO(FBO_COLORS).getHeight());

View File

@ -257,11 +257,11 @@ RTT::RTT(size_t width, size_t height)
} }
// Clear this FBO to 1s so that if no SSAO is computed we can still use it. // Clear this FBO to 1s so that if no SSAO is computed we can still use it.
getFBO(FBO_HALF1_R).Bind(); getFBO(FBO_HALF1_R).bind();
glClearColor(1., 1., 1., 1.); glClearColor(1., 1., 1., 1.);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind(); getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind();
glClearColor(.5, .5, .5, .5); glClearColor(.5, .5, .5, .5);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);