aboutsummaryrefslogtreecommitdiff
path: root/src/Platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform')
-rw-r--r--src/Platform/OpenGL/OpenGLRendererAPI.cpp5
-rw-r--r--src/Platform/OpenGL/OpenGLRendererAPI.h1
-rw-r--r--src/Platform/OpenGL/OpenGLShader.cpp3
-rw-r--r--src/Platform/OpenGL/OpenGLVertexArray.cpp2
4 files changed, 9 insertions, 2 deletions
diff --git a/src/Platform/OpenGL/OpenGLRendererAPI.cpp b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
index c1c2e9b..3660555 100644
--- a/src/Platform/OpenGL/OpenGLRendererAPI.cpp
+++ b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
@@ -25,6 +25,11 @@ namespace Donut
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
+ void OpenGLRendererAPI::EnableDepthTest()
+ {
+ glEnable(GL_DEPTH_TEST);
+ }
+
void OpenGLRendererAPI::DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray, uint32_t indexCount)
{
uint32_t count = indexCount ? indexCount : vertexArray->GetIndexBuffer()->GetCount();
diff --git a/src/Platform/OpenGL/OpenGLRendererAPI.h b/src/Platform/OpenGL/OpenGLRendererAPI.h
index 33547c0..f37cc79 100644
--- a/src/Platform/OpenGL/OpenGLRendererAPI.h
+++ b/src/Platform/OpenGL/OpenGLRendererAPI.h
@@ -13,6 +13,7 @@ namespace Donut
virtual void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override;
virtual void SetClearColor(const glm::vec4& color) override;
virtual void Clear() override;
+ virtual void EnableDepthTest() override;
virtual void DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray, uint32_t indexCount = 0) override;
};
diff --git a/src/Platform/OpenGL/OpenGLShader.cpp b/src/Platform/OpenGL/OpenGLShader.cpp
index bb75f3d..39e95b7 100644
--- a/src/Platform/OpenGL/OpenGLShader.cpp
+++ b/src/Platform/OpenGL/OpenGLShader.cpp
@@ -65,7 +65,8 @@ namespace Donut
const char* typeToken = "#type";
size_t typeTokenLength = strlen(typeToken);
size_t pos = source.find(typeToken, 0);
- while (pos != std::string::npos) {
+ while (pos != std::string::npos)
+ {
size_t eol = source.find_first_of("\r\n", pos);
size_t begin = pos + typeTokenLength + 1;
std::string type = source.substr(begin, eol - begin);
diff --git a/src/Platform/OpenGL/OpenGLVertexArray.cpp b/src/Platform/OpenGL/OpenGLVertexArray.cpp
index f172b9f..c24441e 100644
--- a/src/Platform/OpenGL/OpenGLVertexArray.cpp
+++ b/src/Platform/OpenGL/OpenGLVertexArray.cpp
@@ -39,7 +39,7 @@ namespace Donut
element.type,
element.normalized ? GL_TRUE : GL_FALSE,
layout.GetStride(),
- (const void*)element.offset);
+ reinterpret_cast<const void*>(static_cast<uintptr_t>(element.offset)));
m_VertexBufferIndex++;
}