Trying to copy the deferred result onto the main render target
parent
8694cddcdf
commit
54d67cdeac
|
@ -635,9 +635,6 @@ void Renderer::Initialize(int width, int height) {
|
||||||
mSSAOTarget.Initialize(width, height, RenderTarget::EnableColor);
|
mSSAOTarget.Initialize(width, height, RenderTarget::EnableColor);
|
||||||
mSSAOBlurTarget.Initialize(width, height, RenderTarget::EnableColor);
|
mSSAOBlurTarget.Initialize(width, height, RenderTarget::EnableColor);
|
||||||
|
|
||||||
// Postprocess Target
|
|
||||||
mPostprocessTarget.Initialize(width, height, RenderTarget::EnableColor);
|
|
||||||
|
|
||||||
mDeferredLightingTarget.Initialize(width, height, RenderTarget::EnableColor);
|
mDeferredLightingTarget.Initialize(width, height, RenderTarget::EnableColor);
|
||||||
|
|
||||||
// Light
|
// Light
|
||||||
|
@ -694,7 +691,6 @@ void Renderer::CheckRenderBuffers() {
|
||||||
|| mSceneAreaHeight != mRenderTarget.mHeight
|
|| mSceneAreaHeight != mRenderTarget.mHeight
|
||||||
|| mRenderTarget.mFlags != required_render_flags ) {
|
|| mRenderTarget.mFlags != required_render_flags ) {
|
||||||
mRenderTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, required_render_flags);
|
mRenderTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, required_render_flags);
|
||||||
mPostprocessTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, RenderTarget::EnableColor);
|
|
||||||
|
|
||||||
if (mUseDeferred) {
|
if (mUseDeferred) {
|
||||||
mDeferredLightingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, RenderTarget::EnableColor);
|
mDeferredLightingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, RenderTarget::EnableColor);
|
||||||
|
@ -787,9 +783,6 @@ void Renderer::RenderGl() {
|
||||||
glDrawBuffers(3, buffers);
|
glDrawBuffers(3, buffers);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
} else {
|
} else {
|
||||||
if (program->SetMat44("uViewProjectionMatrix", mLight.mLightSpaceMatrix) == -1) {
|
|
||||||
gLog ("Warning: Uniform %s not found!", "uLightSpaceMatrix");
|
|
||||||
}
|
|
||||||
GLenum buffers[] = { GL_COLOR_ATTACHMENT0};
|
GLenum buffers[] = { GL_COLOR_ATTACHMENT0};
|
||||||
glDrawBuffers (1, buffers);
|
glDrawBuffers (1, buffers);
|
||||||
}
|
}
|
||||||
|
@ -976,9 +969,31 @@ void Renderer::RenderGl() {
|
||||||
gScreenQuad.Draw(GL_TRIANGLES);
|
gScreenQuad.Draw(GL_TRIANGLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDrawDebugCamera && mUseDeferred) {
|
if (mDrawDebugCamera) {
|
||||||
DebugDrawShadowCascades();
|
DebugDrawShadowCascades();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mUseDeferred) {
|
||||||
|
// Blit the deferred result onto the main render target
|
||||||
|
// glBindFramebuffer
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, mDeferredLightingTarget.mFrameBufferId);
|
||||||
|
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderTarget.mFrameBufferId);
|
||||||
|
GLenum buffers[] = { GL_COLOR_ATTACHMENT0};
|
||||||
|
glDrawBuffers (1, buffers);
|
||||||
|
|
||||||
|
glBlitFramebuffer(
|
||||||
|
0, mDeferredLightingTarget.mWidth,
|
||||||
|
0, mDeferredLightingTarget.mHeight,
|
||||||
|
0, mRenderTarget.mWidth,
|
||||||
|
0, mRenderTarget.mHeight,
|
||||||
|
GL_COLOR_BUFFER_BIT,
|
||||||
|
GL_NEAREST
|
||||||
|
);
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DebugDrawShadowCascades() {
|
void Renderer::DebugDrawShadowCascades() {
|
||||||
|
@ -1126,7 +1141,9 @@ void Renderer::DrawGui() {
|
||||||
switch (sRendererSettings.RenderMode) {
|
switch (sRendererSettings.RenderMode) {
|
||||||
case SceneRenderModeDefault:
|
case SceneRenderModeDefault:
|
||||||
mRenderTextureRef.mTextureIdPtr =
|
mRenderTextureRef.mTextureIdPtr =
|
||||||
mUseDeferred ? &mDeferredLightingTarget.mColorTexture : &mPostprocessTarget.mColorTexture;
|
&mRenderTarget.mColorTexture;
|
||||||
|
// &mDeferredLightingTarget.mColorTexture;
|
||||||
|
// mUseDeferred ? &mDeferredLightingTarget.mColorTexture : &mRenderTarget.mColorTexture;
|
||||||
break;
|
break;
|
||||||
case SceneRenderModeColor:
|
case SceneRenderModeColor:
|
||||||
mRenderTextureRef.mTextureIdPtr = &mRenderTarget.mColorTexture;
|
mRenderTextureRef.mTextureIdPtr = &mRenderTarget.mColorTexture;
|
||||||
|
|
|
@ -100,7 +100,6 @@ struct Renderer {
|
||||||
RenderTarget mDeferredLightingTarget;
|
RenderTarget mDeferredLightingTarget;
|
||||||
RenderTarget mSSAOTarget;
|
RenderTarget mSSAOTarget;
|
||||||
RenderTarget mSSAOBlurTarget;
|
RenderTarget mSSAOBlurTarget;
|
||||||
RenderTarget mPostprocessTarget;
|
|
||||||
|
|
||||||
GLTextureRef mRenderTextureRef = { (int)0xbadface };
|
GLTextureRef mRenderTextureRef = { (int)0xbadface };
|
||||||
GLTextureRef mPositionTextureRef = { (int)0xbadface };
|
GLTextureRef mPositionTextureRef = { (int)0xbadface };
|
||||||
|
|
Loading…
Reference in New Issue