SSAO now working. Changed in DrawFinalePass so that th AOTexture is on texture position 0 and only get binded once.

Changed so that the picking pass get drawn once in the beginning so that the AO shatde could calculate AO from the depthbuffer generated during pthe pickingpass.

In the ImGUI debugg window there is now sliders to change the behavior of the AO shader. Only the minimum ambient lightning is HardCoded in to the frowardPlus fragmentshaders with a define in the begining.
This commit is contained in:
Teejoon
2016-02-22 14:48:20 +01:00
parent 201480b17f
commit adceccf402
18 changed files with 192 additions and 170 deletions
-7
View File
@@ -74,18 +74,13 @@ void DrawBloomPass::Draw(GLuint texture)
//Horizontal pass, first use the given texture then save it to the horizontal framebuffer.
m_GaussianFrameBuffer_horiz.Bind();
GLERROR("m_GaussianFrameBuffer_horiz.Bind()");
m_GaussianProgram_horiz->Bind();
GLERROR("m_GaussianProgram_horiz->Bind()");
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
GLERROR("glBindTexture");
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
GLERROR("GL_ELEMENT_ARRAY_BUFFER");
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
GLERROR("HEJ");
//Iterate some times to make it more gaussian.
for (int i = 1; i < m_iterations; i++) {
//Vertical pass
@@ -98,7 +93,6 @@ void DrawBloomPass::Draw(GLuint texture)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
GLERROR("HEJ LOOP");
//horizontal pass
m_GaussianFrameBuffer_horiz.Bind();
@@ -118,7 +112,6 @@ void DrawBloomPass::Draw(GLuint texture)
m_GaussianProgram_vert->Bind();
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
GLERROR("GL_TEXTURE_2D");
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1