aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/OpenGL/OpenGLRendererAPI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform/OpenGL/OpenGLRendererAPI.cpp')
-rw-r--r--src/Platform/OpenGL/OpenGLRendererAPI.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Platform/OpenGL/OpenGLRendererAPI.cpp b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
index 3660555..5ee7d8d 100644
--- a/src/Platform/OpenGL/OpenGLRendererAPI.cpp
+++ b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
@@ -8,6 +8,11 @@ namespace Donut
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ glFrontFace(GL_CCW);
}
void OpenGLRendererAPI::SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
@@ -30,6 +35,18 @@ namespace Donut
glEnable(GL_DEPTH_TEST);
}
+ void OpenGLRendererAPI::SetFaceCulling(bool enabled)
+ {
+ if (enabled)
+ {
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ glFrontFace(GL_CCW);
+ }
+ else
+ glDisable(GL_CULL_FACE);
+ }
+
void OpenGLRendererAPI::DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray, uint32_t indexCount)
{
uint32_t count = indexCount ? indexCount : vertexArray->GetIndexBuffer()->GetCount();