diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a5310b4..3a7fcbb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ set(SOURCE_FILES MobileGL/MG_Impl/EGLImpl/EGLWrapper/EGLWrapper.cpp # @INSERTION_POINT:SOURCE_FILE_GLIMPL@ # + MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.cpp MobileGL/MG_Impl/GLImpl/RenderState/GL_RenderState.cpp MobileGL/MG_Impl/GLImpl/Framebuffer/Validators.cpp MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp diff --git a/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.cpp b/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.cpp new file mode 100644 index 00000000..aa00db64 --- /dev/null +++ b/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.cpp @@ -0,0 +1,33 @@ +#include "GL_Drawing.h" +#include +#include +#include + +namespace MobileGL { + namespace MG_Impl::GLImpl { + void Clear_Backend(GLbitfield mask) { + +#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES + auto clearColor = MG_State::pGLContext->GetClearColor(); + MG_External::GLES::glClearColor(clearColor.r(), clearColor.g(), clearColor.b(), clearColor.a()); + auto clearDepth = MG_State::pGLContext->GetClearDepth(); + MG_External::GLES::glClearDepthf(clearDepth); + MG_External::GLES::glClear(mask); +#endif + } + + void DrawElements_Backend(GLenum mode, GLsizei count, GLenum type, const void* indices) { + // TODO + } + + /* @INSERTION_POINT:FUNCTION_IMPLEMENTATION@ */ + void Clear(GLbitfield mask) { + Clear_Backend(mask); + } + + void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { + DrawElements_Backend(mode, count, type, indices); + } + + } // namespace MG_Impl::GLImpl +} // namespace MobileGL diff --git a/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.h b/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.h new file mode 100644 index 00000000..04e6cd70 --- /dev/null +++ b/MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.h @@ -0,0 +1,10 @@ +#pragma once +#include + +namespace MobileGL { + namespace MG_Impl::GLImpl { + /* @INSERTION_POINT:FUNCTION_DECLARATION@ */ + void Clear(GLbitfield mask); + void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices); + } // namespace MG_Impl::GLImpl +} // namespace MobileGL diff --git a/MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp b/MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp index e9694af2..2d7d3175 100644 --- a/MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp +++ b/MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp @@ -3,6 +3,7 @@ #include "../Getter/GL_Getter.h" #include "../Program/GL_Program.h" #include "../Texture/GL_Texture.h" +#include "../Drawing/GL_Drawing.h" #include "../RenderState/GL_RenderState.h" #include "../Framebuffer/GL_Framebuffer.h" #include "../VertexArray/GL_VertexArray.h" @@ -51,7 +52,7 @@ DECLARE_GL_FUNCTION_HEAD(void, BlendFuncSeparate, GLenum sfactorRGB, GLenum dfac DECLARE_GL_FUNCTION_HEAD(void, BufferData, GLenum target, GLsizeiptr size, const void* data, GLenum usage) DECLARE_GL_FUNCTION_END_NO_RETURN(void, BufferData, target, size, data, usage) DECLARE_GL_FUNCTION_HEAD(void, BufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) DECLARE_GL_FUNCTION_END_NO_RETURN(void, BufferSubData, target, offset, size, data) DECLARE_GL_FUNCTION_HEAD(GLenum, CheckFramebufferStatus, GLenum target) DECLARE_GL_FUNCTION_END(GLenum, CheckFramebufferStatus, target) -DECLARE_GL_FUNCTION_STUB_HEAD(void, Clear, GLbitfield mask) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Clear, mask) +DECLARE_GL_FUNCTION_HEAD(void, Clear, GLbitfield mask) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Clear, mask) DECLARE_GL_FUNCTION_HEAD(void, ClearColor, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) DECLARE_GL_FUNCTION_END_NO_RETURN(void, ClearColor, red, green, blue, alpha) DECLARE_GL_FUNCTION_STUB_HEAD(void, ClearDepthf, GLfloat d) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, ClearDepthf, d) DECLARE_GL_FUNCTION_HEAD(void, ClearStencil, GLint s) DECLARE_GL_FUNCTION_END_NO_RETURN(void, ClearStencil, s) @@ -77,7 +78,7 @@ DECLARE_GL_FUNCTION_HEAD(void, DetachShader, GLuint program, GLuint shader) DECL DECLARE_GL_FUNCTION_HEAD(void, Disable, GLenum cap) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Disable, cap) DECLARE_GL_FUNCTION_HEAD(void, DisableVertexAttribArray, GLuint index) DECLARE_GL_FUNCTION_END_NO_RETURN(void, DisableVertexAttribArray, index) DECLARE_GL_FUNCTION_STUB_HEAD(void, DrawArrays, GLenum mode, GLint first, GLsizei count) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, DrawArrays, mode, first, count) -DECLARE_GL_FUNCTION_STUB_HEAD(void, DrawElements, GLenum mode, GLsizei count, GLenum type, const void* indices) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, DrawElements, mode, count, type, indices) +DECLARE_GL_FUNCTION_HEAD(void, DrawElements, GLenum mode, GLsizei count, GLenum type, const void* indices) DECLARE_GL_FUNCTION_END_NO_RETURN(void, DrawElements, mode, count, type, indices) DECLARE_GL_FUNCTION_HEAD(void, Enable, GLenum cap) DECLARE_GL_FUNCTION_END_NO_RETURN(void, Enable, cap) DECLARE_GL_FUNCTION_HEAD(void, EnableVertexAttribArray, GLuint index) DECLARE_GL_FUNCTION_END_NO_RETURN(void, EnableVertexAttribArray, index) DECLARE_GL_FUNCTION_STUB_HEAD(void, Finish) DECLARE_GL_FUNCTION_STUB_END_NO_RETURN(void, Finish)