diff --git a/configure.ac b/configure.ac index 1f8d50d..d230a55 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,9 @@ GN_ARG_ENABLE(mingw, [--enable-mingw Enable MinGW build]) GN_ARG_ENABLE(dingux, [--enable-dingux Enable DINGUX build]) GN_ARG_ENABLE(embedded,[--enable-embedded Enable Embedded directory structure]) +# Specific path for GLEW, needed for GLSL support on OpenGL +AC_ARG_WITH([glew], + AS_HELP_STRING([--with-glew], [Path the the OpenGL Extension Wrangler Library])) # Setup platform specific optimisation/source/cflags/libs/etc. if test "x$enable_gp2x" = xtrue ; then @@ -107,6 +110,15 @@ if test "x$enable_mingw" = xtrue ; then CPPFLAGS="$CPPFLAGS -I/usr/${host}/include -I/usr/local/${host}/include" LDFLAGS="$LDFLAGS -L/usr/${host}/lib -L/usr/local/${host}/lib" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/${host}/lib/pkgconfig" + if test "x$with_glew" != "xno" ; then + GL_CFLAGS="-I${with_glew}/include $GL_CFLAGS" + GL_LDFLAGS="-L${with_glew}/bin/Release/x64" + case $target_cpu in + x86_64) GL_LDFLAGS="-L${with_glew}/bin/Release/x64" ;; + *) GL_LDFLAGS="-L${with_glew}/bin/Release/Win32" ;; + esac + GL_LIBS="-lglew32 -lopengl32 $GL_LIBS" + fi AC_DEFINE([MINGW],[1],[Define if you build for MinGW]) fi if test "x$enable_embedded" = xtrue ; then @@ -232,18 +244,28 @@ pushdef([_AX_CHECK_GL_PROGRAM], # if defined(HAVE_WINDOWS_H) && defined(_WIN32) # include # endif -# ifdef HAVE_GL_GL_H -# include -# elif defined(HAVE_OPENGL_GL_H) -# include +# if defined(MINGW) +# include # else -# error no gl.h +# ifdef HAVE_GL_GL_H +# include +# elif defined(HAVE_OPENGL_GL_H) +# include +# else +# error no gl.h +# endif # endif ]],[[glCreateProgram()]])]) AX_CHECK_GL AM_CONDITIONAL(USE_OPENGL,[test "X$no_gl" != "Xyes"]) +backup_CFLAGS="$CFLAGS" +backup_CPPFLAGS="$CPPFLAGS" +backup_LDFLAGS="$LDFLAGS" +CFLAGS="$CFLAGS $GL_CFLAGS" +CPPFLAGS="$CPPFLAGS $GL_CFLAGS" +LDFLAGS="$LDFLAGS $GL_LDFLAGS $GL_LIBS" # dnl if GL was detected, configure blitter and compile flags AS_IF([test "X$no_gl" != "Xyes"],[ # dnl distinguish between OpenGL and OpenGL ES @@ -251,9 +273,14 @@ AC_MSG_CHECKING([whether the OpenGL library is OpenGL ES]) AC_LINK_IFELSE([_AX_CHECK_GL_PROGRAM], [AC_MSG_RESULT([no]) AC_DEFINE([USE_GL2],[1],[Define to use alternative opengl blitter]) + if test "x$enable_mingw" = xtrue ; then + glewname=glew32 + else + glewname=GLEW + fi AC_CHECK_HEADERS(GL/glew.h) - AC_CHECK_LIB(GLEW, glewInit, - [LIBS="$LIBS -lGLEW" + AC_CHECK_LIB(${glewname}, glewInit, + [LIBS="$LIBS -l${glewname}" ng_cv_use_glsl=yes]) ], [AC_MSG_RESULT([yes]) @@ -263,6 +290,8 @@ AS_IF([test "x$ng_cv_use_glsl" = "xyes"],[ AC_DEFINE([USE_GLSL],[1],[Define to use alternative glsl blitter]) ]) ]) +CFLAGS="$backup_CFLAGS" +LDFLAGS="$backup_LDFLAGS" AM_CONDITIONAL(HAVE_NASM,[test x$have_nasm = xtrue]) AM_CONDITIONAL(USE_STARSCREAM,[test x$use_starscream = xtrue]) diff --git a/src/menu.c b/src/menu.c index 95f92c5..cfbb388 100644 --- a/src/menu.c +++ b/src/menu.c @@ -606,9 +606,10 @@ int pbar_anim_thread(void *data) { SDL_BlitSurface(pbar_logo, &src_r, menu_buf, &dst_r); SDL_BlitSurface(menu_buf, NULL, buffer, NULL); -#ifndef __APPLE__ - // macOS OpenGL call must be done from the thread - // that created the OpenGL context +#if !defined(__APPLE__) && !defined(MINGW) + // Various OpenGL implementations limit the use of + // OpenGL API to the thread that created the OpenGL + // context. Update the screen only if we can. screen_update(); #endif frame_skip(0); @@ -616,7 +617,7 @@ int pbar_anim_thread(void *data) { } SDL_BlitSurface(gngeo_logo, NULL, pbar_logo, NULL); SDL_BlitSurface(pbar_logo, &src_r, menu_buf, &dst_r); -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(MINGW) screen_update(); #endif frame_skip(0); @@ -1178,9 +1179,10 @@ int rom_browser_scanning_anim(void *data) { draw_string(menu_buf, sfont, MENU_TITLE_X, MENU_TITLE_Y, "Scanning"); SDL_BlitSurface(menu_buf, NULL, buffer, NULL); -#ifndef __APPLE__ - // macOS OpenGL call must be done from the thread - // that created the OpenGL context +#if !defined(__APPLE__) && !defined(MINGW) + // Various OpenGL implementations limit the use of + // OpenGL API to the thread that created the OpenGL + // context. Update the screen only if we can. screen_update(); #endif frame_skip(0);