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();
}

View File

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

View File

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

View File

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