From 5ede0ee3b8a64a2d99d1d7425765e450da2ca01a Mon Sep 17 00:00:00 2001 From: John Galvin <96908304+Johnnyg63@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:12:53 +0100 Subject: [PATCH 1/2] Added Apple Mac support OLC_GFX_OPENGL33 Johnngy63 & Sigonasr2: Added Apple Mac support OLC_GFX_OPENGL33 Updated Sections and Lines: Section: pragma region opengl33_iface Line: 1421, Updated Apple MARCOS Line: 1491, Added definitions to support EGL and Swap Intervals --- Section: START RENDERER: OpenGL 1.0 (the original, the best...) Line: 4515, add Define Apple conditional statement --- Section: START RENDERER: OpenGL 3.3 (3.0 es) (sh-sh-sh-shaders....) Line: 5028, @Sigonasr2, added GLUT_3_2_CORE_PROFILE and conditional statement --- This update will allow the PGE 2.0 to run successfully on the Apple MAC. At present this update will use GLUT to create the required Window. However as there is a bug in GLUT when ran on the MAC, the resizing of the Window is currently not possible. I will work on a solution where the PGE 2.0 will not require GLUT in the coming weeks Kind regards John --- olcPixelGameEngine.h | 61 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/olcPixelGameEngine.h b/olcPixelGameEngine.h index 1fc11c46..1b6aa696 100644 --- a/olcPixelGameEngine.h +++ b/olcPixelGameEngine.h @@ -331,7 +331,7 @@ +adv_FlushLayerDecals() - [ADVANCED] Force layer's decal render to buffer +FillTriangleDecal() - Draws a triangle decal +GradientTriangleDecal() - Draws a triangle decal with unique vertex colours - 2.27: + 2.27: Added Apple MAC support for OLC_GFX_OPENGL33 !! Apple Platforms will not see these updates immediately - Sorry, I dont have a mac to test... !! !! Volunteers willing to help appreciated, though PRs are manually integrated with credit !! @@ -1418,12 +1418,18 @@ namespace olc #define CALLSTYLE #endif - #if defined(__APPLE__) - #define GL_SILENCE_DEPRECATION - #include - #include - #include - #endif + #if defined(__APPLE__) // John Galvin: Added Apple Mac support OLC_GFX_OPENGL33 + #define GL_SILENCE_DEPRECATION + #define CALLSTYLE + #define OGL_LOAD(t, n) n; + #define GL_GLEXT_PROTOTYPES + #include + #include + #include + #include + #include + + #endif #if defined(OLC_PLATFORM_EMSCRIPTEN) #include @@ -1481,7 +1487,21 @@ namespace olc typedef void CALLSTYLE locShaderSource_t(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); typedef EGLBoolean(locSwapInterval_t)(EGLDisplay display, EGLint interval); #else - typedef void CALLSTYLE locShaderSource_t(GLuint shader, GLsizei count, const GLchar** string, const GLint* length); + +#if defined(__APPLE__) // John Galvin: Added Apple Mac support OLC_GFX_OPENGL33 + typedef int EGLBoolean; + typedef int32_t EGLint; + typedef void *EGLDisplay; + typedef void *EGLConfig; + typedef void *EGLSurface; + typedef void *EGLContext; + + typedef EGLBoolean(locSwapInterval_t)(EGLDisplay display, GLint interval); + typedef void CALLSTYLE locShaderSource_t(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); +#else + typedef void CALLSTYLE locShaderSource_t(GLuint shader, GLsizei count, const GLchar** string, const GLint* length); +#endif + #endif } // olc namespace @@ -4493,10 +4513,18 @@ namespace olc #endif #if defined(__APPLE__) - #define GL_SILENCE_DEPRECATION - #include - #include - #include + #define GL_SILENCE_DEPRECATION +#if defined (OLC_GFX_OPENGL33) // John Galvin: Added Apple Mac support OLC_GFX_OPENGL33 + #include + #include + #include + #include +#else + #include + #include + #include + #include +#endif #endif namespace olc @@ -4996,7 +5024,12 @@ namespace olc glutInit(&argc, argv); glutInitWindowPosition(0, 0); glutInitWindowSize(512, 512); - glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA); + +#if defined(__APPLE__) // John Galvin : (A big thank you to Dense Dance) Added Apple Mac support OLC_GFX_OPENGL33 + glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA | GLUT_3_2_CORE_PROFILE); +#else + glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA); +#endif // Creates the window and the OpenGL context for it glutCreateWindow("OneLoneCoder.com - Pixel Game Engine"); glEnable(GL_TEXTURE_2D); // Turn on texturing @@ -5703,7 +5736,7 @@ namespace olc vWinPos = vWindowPos; vWinSize = vWindowSize; - + // Define window furniture DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; DWORD dwStyle = WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_THICKFRAME; From 57e9c6f9821c8cf6fc739a8bbcdf37a4094b9ab6 Mon Sep 17 00:00:00 2001 From: John Galvin <96908304+Johnnyg63@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:46:13 +0100 Subject: [PATCH 2/2] Added Apple Mac support OLC_GFX_OPENGL33_2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Johnngy63 & Sigonasr2 & Ciarán: Added Apple Mac support OLC_GFX_OPENGL33 Updated Sections and Lines: Section: STANDARD INCLUDES Line: 412, added #include Section: pragma region opengl33_iface: Line: 1421, Updated Apple MARCOS Line: 1491, Added definitions to support EGL and Swap Intervals --- Section: START RENDERER: OpenGL 1.0 (the original, the best...) Line: 4515, add Define Apple conditional statement --- Section: START RENDERER: OpenGL 3.3 (3.0 es) (sh-sh-sh-shaders....) Line: 5028, @sigonasr2, added GLUT_3_2_CORE_PROFILE and conditional statement --- This update will allow the PGE 2.0 to run successfully on the Apple MAC. At present this update will use GLUT to create the required Window. However as there is a bug in GLUT when ran on the MAC, the resizing of the Window is currently not possible. I will work on a solution where the PGE 2.0 will not require GLUT in the coming weeks Kind regards John --- olcPixelGameEngine.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/olcPixelGameEngine.h b/olcPixelGameEngine.h index 1b6aa696..0b246285 100644 --- a/olcPixelGameEngine.h +++ b/olcPixelGameEngine.h @@ -409,6 +409,9 @@ int main() #include #include #include +#if defined (__APPLE__) // John Galvin: @Ciarán, Added Apple Mac support OLC_GFX_OPENGL33 +#include +#endif #pragma endregion #define PGE_VER 227