From 09a1b24b429327df16b5efdcf97ac919fc9b0cb4 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Mon, 17 Dec 2018 22:35:45 +0100 Subject: [PATCH] Fix issues on my laptop --- src/main.cc | 2 +- src/modules/RenderModule.cc | 22 ---------------------- src/modules/RenderModule.h | 8 ++++---- src/modules/RenderUtils.cc | 3 +++ 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/main.cc b/src/main.cc index e468db2..a171e4b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -119,7 +119,7 @@ int main(void) const char* glsl_version = "#version 130"; glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_SAMPLES, 16); // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); diff --git a/src/modules/RenderModule.cc b/src/modules/RenderModule.cc index bf9961e..fdb0fe8 100644 --- a/src/modules/RenderModule.cc +++ b/src/modules/RenderModule.cc @@ -867,28 +867,6 @@ void Renderer::RenderGl() { if (mDrawDebugCamera) { 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, mForwardRenderingTarget.mFrameBufferId); - GLenum buffers[] = { GL_COLOR_ATTACHMENT0}; - glDrawBuffers (1, buffers); - - glBlitFramebuffer( - 0, mDeferredLightingTarget.mWidth, - 0, mDeferredLightingTarget.mHeight, - 0, mForwardRenderingTarget.mWidth, - 0, mForwardRenderingTarget.mHeight, - GL_COLOR_BUFFER_BIT, - GL_NEAREST - ); - - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - } } void Renderer::DebugDrawShadowCascades() { diff --git a/src/modules/RenderModule.h b/src/modules/RenderModule.h index c999552..b0841e0 100644 --- a/src/modules/RenderModule.h +++ b/src/modules/RenderModule.h @@ -76,10 +76,10 @@ struct Renderer { bool mUseDeferred = false; bool mDrawDebugCamera = false; - uint32_t mWidth = 1; - uint32_t mHeight = 1; - uint32_t mSceneAreaWidth = 1; - uint32_t mSceneAreaHeight = 1; + int mWidth = 1; + int mHeight = 1; + int mSceneAreaWidth = 1; + int mSceneAreaHeight = 1; Light mLight; Camera mCamera; diff --git a/src/modules/RenderUtils.cc b/src/modules/RenderUtils.cc index dc03096..dc1d65c 100644 --- a/src/modules/RenderUtils.cc +++ b/src/modules/RenderUtils.cc @@ -668,6 +668,9 @@ bool VertexArray::IsBound() { } void VertexArrayMesh::Initialize(VertexArray &array, const int& size) { + mIndexBuffer = -1; + mIndexCount = -1; + mVertexArray = &array; mIndexOffset = mVertexArray->AllocateMesh(size); mOffsetPtr = (void*) (sizeof(VertexArray::VertexData) * mIndexOffset);