Skybox bugfix
This commit is contained in:
+9
-4
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user