OPENGL: Fix OpenGL ES v1 builds without GLAD

This commit is contained in:
Cameron Cawley 2022-03-06 16:35:05 +00:00 committed by aquadran
parent b3f98810a2
commit 460bc32cd9
3 changed files with 21 additions and 1 deletions

View file

@ -204,8 +204,10 @@ void OpenGLGraphicsManager::initializeGLContext() {
} }
// Log features supported by GL context. // Log features supported by GL context.
#if !USE_FORCED_GLES
if (g_context.shadersSupported) if (g_context.shadersSupported)
debug(5, "GLSL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); debug(5, "GLSL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
#endif
debug(5, "OpenGL vendor: %s", glGetString(GL_VENDOR)); debug(5, "OpenGL vendor: %s", glGetString(GL_VENDOR));
debug(5, "OpenGL renderer: %s", glGetString(GL_RENDERER)); debug(5, "OpenGL renderer: %s", glGetString(GL_RENDERER));
debug(5, "OpenGL: NPOT texture support: %d", g_context.NPOTSupported); debug(5, "OpenGL: NPOT texture support: %d", g_context.NPOTSupported);

8
configure vendored
View file

@ -5400,8 +5400,9 @@ if test "$_opengl_glad" = "no" -a "$_opengl_mode" != "none"; then
# 1) GL/gl.h This is usually used on POSIX and Windows systems # 1) GL/gl.h This is usually used on POSIX and Windows systems
# 2) OpenGL/gl.h This is used on macOS # 2) OpenGL/gl.h This is used on macOS
# 3) GLES2/gl2.h This is used for OpenGL ES 2.x # 3) GLES2/gl2.h This is used for OpenGL ES 2.x
# 3) GLES/gl.h This is used for OpenGL ES 1.x
_opengl_can_compile=no _opengl_can_compile=no
for i in "GL/gl.h" "OpenGL/gl.h" "GLES2/gl2.h"; do for i in "GL/gl.h" "OpenGL/gl.h" "GLES2/gl2.h" "GLES/gl.h"; do
# Test the current header for OpenGL # Test the current header for OpenGL
if test "$_opengl_mode" = "gl" -o "$_opengl_mode" = "any" ; then if test "$_opengl_mode" = "gl" -o "$_opengl_mode" = "any" ; then
cat > $TMPC << EOF cat > $TMPC << EOF
@ -5449,6 +5450,11 @@ EOF
break break
fi fi
done done
elif test "$_opengl_mode" = "gles" ; then
OPENGL_LIBS="-lGLESv1_CM"
if cc_check_no_clean $DEFINES $OPENGL_CFLAGS $OPENGL_LIBS; then
_opengl_can_compile=yes
fi
else else
case $_host_os in case $_host_os in
darwin*) darwin*)

View file

@ -84,6 +84,18 @@
#define GL_MAX_SAMPLES 0x8D57 #define GL_MAX_SAMPLES 0x8D57
#endif #endif
#elif USE_FORCED_GLES
#define GL_GLEXT_PROTOTYPES
#if defined(IPHONE)
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#else
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#undef GL_GLEXT_PROTOTYPES
#endif #endif
#endif #endif