Fixes compilation on Mingw.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
diff --git a/configure b/configure
index be2cb61..0e10125 100755
--- a/configure
+++ b/configure
@@ -20703,6 +20703,84 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
fi
}
+CheckWINDOWSGLES()
+{
+ if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5
+$as_echo_n "checking for EGL support... " >&6; }
+ video_opengl_egl=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <EGL/egl.h>
+
+int
+main ()
+{
+
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ video_opengl_egl=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5
+$as_echo "$video_opengl_egl" >&6; }
+ if test x$video_opengl_egl = xyes; then
+
+$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
+
+
+$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h
+
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5
+$as_echo_n "checking for OpenGL ES v2 headers... " >&6; }
+ video_opengles_v2=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+
+int
+main ()
+{
+
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ video_opengles_v2=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5
+$as_echo "$video_opengles_v2" >&6; }
+ if test x$video_opengles_v2 = xyes; then
+
+$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
+
+
+$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h
+
+
+$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
+
+ fi
+ fi
+}
+
CheckHaikuGL()
{
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
@@ -22261,6 +22339,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
CheckDummyAudio
CheckWINDOWS
CheckWINDOWSGL
+ CheckWINDOWSGLES
CheckDIRECTX
# Set up the core platform files
diff --git a/configure.in b/configure.in
index e3f094c..8d116a5 100644
--- a/configure.in
+++ b/configure.in
@@ -1738,6 +1738,43 @@ CheckWINDOWSGL()
fi
}
+dnl Check for Windows OpenGL
+CheckWINDOWSGLES()
+{
+ if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
+
+ AC_MSG_CHECKING(for EGL support)
+ video_opengl_egl=no
+ AC_TRY_COMPILE([
+ #include <EGL/egl.h>
+ ],[
+ ],[
+ video_opengl_egl=yes
+ ])
+ AC_MSG_RESULT($video_opengl_egl)
+ if test x$video_opengl_egl = xyes; then
+ AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
+ AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
+ fi
+
+ AC_MSG_CHECKING(for OpenGL ES v2 headers)
+ video_opengles_v2=no
+ AC_TRY_COMPILE([
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+ ],[
+ ],[
+ video_opengles_v2=yes
+ ])
+ AC_MSG_RESULT($video_opengles_v2)
+ if test x$video_opengles_v2 = xyes; then
+ AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
+ AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
+ AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
+ fi
+ fi
+}
+
dnl Check for Haiku OpenGL
CheckHaikuGL()
{
@@ -2515,6 +2552,7 @@ case "$host" in
CheckDummyAudio
CheckWINDOWS
CheckWINDOWSGL
+ CheckWINDOWSGLES
CheckDIRECTX
# Set up the core platform files
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index 3156c1a..2960bc5 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -585,6 +585,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES &&
!_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) {
+#if SDL_VIDEO_OPENGL_EGL
/* Switch to EGL based functions */
WIN_GL_UnloadLibrary(_this);
_this->GL_LoadLibrary = WIN_GLES_LoadLibrary;
@@ -602,6 +603,9 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
}
return WIN_GLES_CreateContext(_this, window);
+#else
+ return SDL_SetError("SDL not configured with EGL support");
+#endif
}
if (_this->gl_config.share_with_current_context) {