From 2a111a237d49b6e07a872681acfdbe39ae12b8e0 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 3 Jan 2020 20:30:08 +0100 Subject: [PATCH] Move OpenGL headers from API to implementation. We don't want to expose any OpenGL functions to client code. Because if we do, there is a chance we break client code if we switch implementation (Direct3D). --- include/Spectre/Graphics/OpenGL.h | 7 ------- source/Graphics/BatchRenderer2D.cpp | 2 +- source/Graphics/DefaultRenderer2D.cpp | 2 +- source/Graphics/GL/CheckError.h | 2 +- source/Graphics/GL/gl.h | 7 +++++++ source/Graphics/GL/glad.c | 2 +- {include/Spectre => source}/Graphics/GL/glad.h | 0 {include/Spectre => source}/Graphics/GL/khr.h | 0 source/Graphics/OpenGL.cpp | 2 +- source/Graphics/Shader.cpp | 2 +- source/Graphics/ShaderProgram.cpp | 2 +- source/Graphics/Texture.cpp | 2 +- source/Platform/Win32/glad_wgl.h | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 include/Spectre/Graphics/OpenGL.h create mode 100644 source/Graphics/GL/gl.h rename {include/Spectre => source}/Graphics/GL/glad.h (100%) rename {include/Spectre => source}/Graphics/GL/khr.h (100%) diff --git a/include/Spectre/Graphics/OpenGL.h b/include/Spectre/Graphics/OpenGL.h deleted file mode 100644 index a999a76..0000000 --- a/include/Spectre/Graphics/OpenGL.h +++ /dev/null @@ -1,7 +0,0 @@ - -#ifndef SPECTRE_OPENGL_H -#define SPECTRE_OPENGL_H - -#include - -#endif /* SPECTRE_OPENGL_H */ diff --git a/source/Graphics/BatchRenderer2D.cpp b/source/Graphics/BatchRenderer2D.cpp index bad2251..0d3161a 100644 --- a/source/Graphics/BatchRenderer2D.cpp +++ b/source/Graphics/BatchRenderer2D.cpp @@ -1,12 +1,12 @@ #include -#include #include #include #include #include #include #include +#include #include diff --git a/source/Graphics/DefaultRenderer2D.cpp b/source/Graphics/DefaultRenderer2D.cpp index 8076d47..112854e 100644 --- a/source/Graphics/DefaultRenderer2D.cpp +++ b/source/Graphics/DefaultRenderer2D.cpp @@ -1,8 +1,8 @@ #include -#include #include #include +#include namespace sp { diff --git a/source/Graphics/GL/CheckError.h b/source/Graphics/GL/CheckError.h index 192ac5f..0ed7f3b 100644 --- a/source/Graphics/GL/CheckError.h +++ b/source/Graphics/GL/CheckError.h @@ -2,7 +2,7 @@ #ifndef SPECTRE_GRAPHICS_GL_CHECKERROR_H #define SPECTRE_GRAPHICS_GL_CHECKERROR_H -#include +#include "gl.h" #define checkGLError(expr) do { expr; glCheckError(__FILE__, __LINE__, #expr); } while(false) diff --git a/source/Graphics/GL/gl.h b/source/Graphics/GL/gl.h new file mode 100644 index 0000000..287d8bb --- /dev/null +++ b/source/Graphics/GL/gl.h @@ -0,0 +1,7 @@ + +#ifndef SPECTRE_GRAPHICS_GL_GL_H +#define SPECTRE_GRAPHICS_GL_GL_H + +#include "glad.h" + +#endif /* SPECTRE_GRAPHICS_GL_GL_H */ diff --git a/source/Graphics/GL/glad.c b/source/Graphics/GL/glad.c index 8ae58e1..9dc2931 100644 --- a/source/Graphics/GL/glad.c +++ b/source/Graphics/GL/glad.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include "glad.h" #ifndef GLAD_IMPL_UTIL_C_ #define GLAD_IMPL_UTIL_C_ diff --git a/include/Spectre/Graphics/GL/glad.h b/source/Graphics/GL/glad.h similarity index 100% rename from include/Spectre/Graphics/GL/glad.h rename to source/Graphics/GL/glad.h diff --git a/include/Spectre/Graphics/GL/khr.h b/source/Graphics/GL/khr.h similarity index 100% rename from include/Spectre/Graphics/GL/khr.h rename to source/Graphics/GL/khr.h diff --git a/source/Graphics/OpenGL.cpp b/source/Graphics/OpenGL.cpp index 55ecee9..6a1e6ff 100644 --- a/source/Graphics/OpenGL.cpp +++ b/source/Graphics/OpenGL.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace sp { diff --git a/source/Graphics/Shader.cpp b/source/Graphics/Shader.cpp index c1827c5..6fdee60 100644 --- a/source/Graphics/Shader.cpp +++ b/source/Graphics/Shader.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include namespace sp { diff --git a/source/Graphics/ShaderProgram.cpp b/source/Graphics/ShaderProgram.cpp index 79da3c4..c8baf0b 100644 --- a/source/Graphics/ShaderProgram.cpp +++ b/source/Graphics/ShaderProgram.cpp @@ -1,8 +1,8 @@ #include -#include #include #include +#include namespace sp { diff --git a/source/Graphics/Texture.cpp b/source/Graphics/Texture.cpp index 954adf7..ddf8397 100644 --- a/source/Graphics/Texture.cpp +++ b/source/Graphics/Texture.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include namespace sp { diff --git a/source/Platform/Win32/glad_wgl.h b/source/Platform/Win32/glad_wgl.h index 446e880..daa6c29 100644 --- a/source/Platform/Win32/glad_wgl.h +++ b/source/Platform/Win32/glad_wgl.h @@ -29,7 +29,7 @@ #define GLAD_WGL_H_ #include -#include +#include #define GLAD_WGL #define GLAD_OPTION_WGL_LOADER