Skybox bugfix

This commit is contained in:
Tleety
2014-05-31 02:03:50 +02:00
parent ee2f7fcecf
commit a459a1c69b
+9 -4
View File
@@ -392,6 +392,7 @@ void Renderer::DrawWorld(RenderQueuePair &rq)
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
DrawSkybox();
DrawFBOScene(rq.Deferred);
/*
@@ -593,12 +594,16 @@ void Renderer::Swap()
void Renderer::DrawSkybox()
{
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
//glViewport(0, 0, m_Width, m_Height);
//glScissor(0, 0, m_Width, m_Height);
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_ShaderProgramSkybox.Bind();
glm::mat4 cameraMatrix = m_Camera->ProjectionMatrix((float)m_Width / m_Height) * glm::toMat4(glm::inverse(m_Camera->Orientation()));
//glm::mat4 cameraProjection = m_Camera->ProjectionMatrix((float)m_Viewport.Width / m_Viewport.Height);
//glm::mat4 cameraMatrix = cameraProjection * m_Camera->ViewMatrix();
glm::mat4 cameraMatrix = m_Camera->ProjectionMatrix((float)m_Viewport.Width / m_Viewport.Height) * glm::inverse(glm::toMat4(m_Camera->Orientation()));
glUniformMatrix4fv(glGetUniformLocation(m_ShaderProgramSkybox.GetHandle(), "MVP"), 1, GL_FALSE, glm::value_ptr(cameraMatrix));
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
m_Skybox->Draw();