Minor cleanup

opengl3
Martin Felis 2019-04-23 23:30:36 +02:00
parent b456d24934
commit 851a26c445
4 changed files with 12 additions and 5 deletions

View File

@ -143,7 +143,7 @@ void RuntimeModuleManager::UnloadModules() {
} }
} }
gLog ("Writting state to file %s", state_file); gLog ("Writing state to file %s", state_file);
gWriteSerializer->Close(); gWriteSerializer->Close();
} }

View File

@ -333,6 +333,8 @@ int main(void)
} }
} }
gLog ("Exiting application");
module_manager.UnregisterModules(); module_manager.UnregisterModules();
gRenderer = nullptr; gRenderer = nullptr;

View File

@ -131,6 +131,7 @@ static void module_finalize(struct module_state *state) {
assert (state->renderer != nullptr); assert (state->renderer != nullptr);
delete state->renderer; delete state->renderer;
gVertexArray.Cleanup();
free(state); free(state);
} }
@ -563,7 +564,7 @@ void Renderer::CheckRenderBuffers() {
if (mSceneAreaWidth != mRenderOutput.mWidth if (mSceneAreaWidth != mRenderOutput.mWidth
|| mSceneAreaHeight != mRenderOutput.mHeight || mSceneAreaHeight != mRenderOutput.mHeight
|| mForwardRenderingTarget.mFlags != required_render_flags ) { || mForwardRenderingTarget.mFlags != required_render_flags ) {
mRenderOutput.Resize(mSceneAreaWidth, mSceneAreaHeight, required_render_flags); mRenderOutput.Resize(mSceneAreaWidth, mSceneAreaHeight, RenderTarget::EnableColor);
mForwardRenderingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, required_render_flags); mForwardRenderingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, required_render_flags);
mDeferredLightingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight, mDeferredLightingTarget.Resize(mSceneAreaWidth, mSceneAreaHeight,
RenderTarget::EnableColor RenderTarget::EnableColor
@ -696,7 +697,7 @@ void Renderer::RenderGl() {
DebugDrawFrame( DebugDrawFrame(
mSimpleProgram, mSimpleProgram,
TranslateMat44(0.0f, 0.002f, 0.0f) TranslateMat44(1.0f, 0.002f, 0.0f)
* mCamera.mViewMatrix * mCamera.mViewMatrix
* mCamera.mProjectionMatrix * mCamera.mProjectionMatrix
); );
@ -750,6 +751,7 @@ void Renderer::RenderGl() {
program->SetVec4("uShadowSplitBias", mLight.mSplitBias); program->SetVec4("uShadowSplitBias", mLight.mSplitBias);
program->SetFloat("uShowCascadesAlpha", mLight.mShowCascadesAlpha); program->SetFloat("uShowCascadesAlpha", mLight.mShowCascadesAlpha);
program->SetMat44Array("uViewToLightMatrix", cNumSplits, light_matrices); program->SetMat44Array("uViewToLightMatrix", cNumSplits, light_matrices);
program->SetMat44("uLightSpaceMatrix", mLight.mLightSpaceMatrix); program->SetMat44("uLightSpaceMatrix", mLight.mLightSpaceMatrix);
} }

View File

@ -594,6 +594,9 @@ void VertexArray::Initialize(const int& size, GLenum usage) {
} }
void VertexArray::Cleanup() { void VertexArray::Cleanup() {
gLog ("deleting vertex buffer: %d", mVertexBuffer);
int is_buffer = glIsBuffer(mVertexBuffer);
gLog ("is buffer %d", is_buffer);
glDeleteBuffers(1, &mVertexBuffer); glDeleteBuffers(1, &mVertexBuffer);
mVertexBuffer = -1; mVertexBuffer = -1;
glDeleteVertexArrays(1, &mVertexArrayId); glDeleteVertexArrays(1, &mVertexArrayId);