Working Debug mode

This commit is contained in:
Tleety
2014-04-27 03:59:41 +02:00
parent 90e929131f
commit a199e777bc
6 changed files with 60 additions and 31 deletions
+9 -8
View File
@@ -119,7 +119,7 @@ void Renderer::LoadContent()
m_FirstPassProgram.Link();
m_SecondPassProgram.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Vertex2.glsl")));
m_SecondPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Fragment2.glsl")));
m_SecondPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Fragment2-Debug.glsl")));
m_SecondPassProgram.Compile();
m_SecondPassProgram.Link();
@@ -530,8 +530,8 @@ void Renderer::FrameBufferTextures()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//Generate and bind position texture
glGenTextures(1, &m_fPositionTexture);
@@ -539,8 +539,8 @@ void Renderer::FrameBufferTextures()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//Generate and bind normal texture
glGenTextures(1, &m_fNormalsTexture);
@@ -548,8 +548,8 @@ void Renderer::FrameBufferTextures()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//Bind fb
glBindFramebuffer(GL_FRAMEBUFFER, m_fb);
@@ -668,7 +668,7 @@ void Renderer::DrawFBO()
glBindVertexArray(m_ScreenQuad);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(2);
/* glEnableVertexAttribArray(2);*/
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -747,6 +747,7 @@ void Renderer::DrawFBOScene()
MVP = cameraMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(m_FirstPassProgram.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(MVP));
glUniformMatrix4fv(glGetUniformLocation(m_FirstPassProgram.GetHandle(), "ModelMatrix"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
glBindVertexArray(model->VAO);
for (auto texGroup : model->TextureGroups)
{
+33
View File
@@ -0,0 +1,33 @@
#version 430
layout (binding=0) uniform sampler2D DiffuseTexture;
layout (binding=1) uniform sampler2D PositionTexture;
layout (binding=2) uniform sampler2D NormalTexture;
in VertexData
{
vec3 Position;
vec3 Normal;
vec2 TextureCoord;
} Input;
out vec4 FragColor;
void DrawQuadrant(vec4 texel, vec2 quadrant)
{
if (-quadrant.x * Input.Position.x < 0 && -quadrant.y * Input.Position.y < 0)
{
FragColor = texel;
}
}
void main()
{
//FragColor = texture2D(DiffuseTexture, Input.TextureCoord * 2 + vec2(0, -1));
DrawQuadrant(texture2D(DiffuseTexture, Input.TextureCoord * 2), vec2(-1, 1));
DrawQuadrant(texture2D(PositionTexture, Input.TextureCoord * 2), vec2(1, 1));
DrawQuadrant(texture2D(NormalTexture, Input.TextureCoord * 2), vec2(-1, -1));
vec4 AllTexel = texture2D(DiffuseTexture, Input.TextureCoord*2)*texture2D(PositionTexture, Input.TextureCoord*2)*texture2D(NormalTexture, Input.TextureCoord*2);
DrawQuadrant(AllTexel, vec2(1, -1));
}
+1 -1
View File
@@ -15,5 +15,5 @@ out vec4 FragColor;
void main()
{
FragColor = texture2D(DiffuseTexture, Input.TextureCoord);
FragColor = texture2D(NormalTexture, Input.TextureCoord);
}
+2 -1
View File
@@ -1,6 +1,7 @@
#version 430
uniform mat4 MVP;
uniform mat4 ModelMatrix;
layout (location = 0) in vec3 Position;
layout (location = 1) in vec3 Normal;
@@ -18,6 +19,6 @@ void main()
gl_Position = MVP * vec4(Position, 1.0);
Output.Position = gl_Position.xyz;
Output.Normal = Normal;
Output.Normal = normalize((ModelMatrix * vec4(Normal, 0.0)).xyz);
Output.TextureCoord = TextureCoord;
}
+1 -17
View File
@@ -167,27 +167,11 @@
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\Shaders\AABB.frag.glsl" />
<None Include="..\..\src\Shaders\First_pass.frag.glsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</None>
<None Include="..\..\src\Shaders\First_pass.vert.glsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
</None>
<None Include="..\..\src\Shaders\Fragment.glsl" />
<None Include="..\..\src\Shaders\Fragment2-Debug.glsl" />
<None Include="..\..\src\Shaders\Fragment2.glsl" />
<None Include="..\..\src\Shaders\Normals.frag.glsl" />
<None Include="..\..\src\Shaders\Normals.geo.glsl" />
<None Include="..\..\src\Shaders\Second_pass.frag.glsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</None>
<None Include="..\..\src\Shaders\Second_pass.vert.glsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</None>
<None Include="..\..\src\Shaders\ShadowMap.frag.glsl" />
<None Include="..\..\src\Shaders\ShadowMap.vert.glsl" />
<None Include="..\..\src\Shaders\Skybox.frag.glsl" />
+14 -4
View File
@@ -226,12 +226,10 @@
<ClInclude Include="..\..\src\Components\Wheel.h">
<Filter>Physics\Components</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Util\defferedUtil.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\Shaders\AABB.frag.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\Fragment.glsl">
<None Include="..\..\src\Shaders\Fragment2.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\Normals.frag.glsl">
@@ -255,11 +253,23 @@
<None Include="..\..\src\Shaders\Vertex.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\Vertex2.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\VisualizeDepth.frag.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\VisualizeDepth.vert.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\AABB.frag.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\Fragment.glsl">
<Filter>Shaders</Filter>
</None>
<None Include="..\..\src\Shaders\Fragment2-Debug.glsl">
<Filter>Shaders</Filter>
</None>
</ItemGroup>
</Project>