@@ -104,6 +104,15 @@ if test "${ac_cv_my_have_gl}" = "no"; then | |||||
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]]) | AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]]) | ||||
fi | fi | ||||
dnl Use Glew? | |||||
ac_cv_my_have_glew="no" | |||||
PKG_CHECK_MODULES(GLEW, glew, [ac_cv_my_have_glew="yes"], [:]) | |||||
if test "${ac_cv_my_have_glew}" != "no"; then | |||||
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) | |||||
AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew) | |||||
fi | |||||
AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no") | |||||
dnl Poor man's GL feature detection. | dnl Poor man's GL feature detection. | ||||
save_LIBS="${LIBS}" | save_LIBS="${LIBS}" | ||||
LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}" | LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}" | ||||
@@ -194,8 +203,9 @@ AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes") | |||||
dnl How to use the Lol Engine inside this tree | dnl How to use the Lol Engine inside this tree | ||||
LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src $SDL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS" | |||||
LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $LIBPNG_LIBS" | |||||
LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src" | |||||
LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $EGL_CFLAGS $GLEW_CFLAGS $LIBPNG_CFLAGS" | |||||
LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $GLEW_LIBS $LIBPNG_LIBS" | |||||
AC_SUBST(MATH_LIBS) | AC_SUBST(MATH_LIBS) | ||||
AC_SUBST(LOL_CFLAGS) | AC_SUBST(LOL_CFLAGS) | ||||
@@ -24,7 +24,9 @@ | |||||
#endif | #endif | ||||
/* Include GL */ | /* Include GL */ | ||||
#if defined HAVE_GL_2X | |||||
#if defined USE_GLEW | |||||
# include <GL/glew.h> | |||||
#elif defined HAVE_GL_2X | |||||
# if defined __APPLE__ && defined __MACH__ | # if defined __APPLE__ && defined __MACH__ | ||||
# include <OpenGL/gl.h> | # include <OpenGL/gl.h> | ||||
# else | # else | ||||
@@ -46,8 +48,8 @@ | |||||
/* Redefine some function names */ | /* Redefine some function names */ | ||||
#if defined HAVE_GL_2X | #if defined HAVE_GL_2X | ||||
# define glClearDepthf glClearDepth | |||||
#elif defined HAVE_GLES_2X | #elif defined HAVE_GLES_2X | ||||
# define glClearDepth glClearDepthf | |||||
# define glGenVertexArrays glGenVertexArraysOES | # define glGenVertexArrays glGenVertexArraysOES | ||||
# define glDeleteVertexArrays glDeleteVertexArraysOES | # define glDeleteVertexArrays glDeleteVertexArraysOES | ||||
# define glBindVertexArray glBindVertexArrayOES | # define glBindVertexArray glBindVertexArrayOES | ||||
@@ -17,6 +17,7 @@ | |||||
#endif | #endif | ||||
#include "core.h" | #include "core.h" | ||||
#include "lolgl.h" | |||||
#include "sdlapp.h" | #include "sdlapp.h" | ||||
namespace lol | namespace lol | ||||
@@ -58,6 +59,15 @@ SdlApp::SdlApp(char const *title, vec2i res, float fps) : | |||||
SDL_Quit(); | SDL_Quit(); | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
#if defined USE_GLEW | |||||
GLenum glerr = glewInit(); | |||||
if (glerr != GLEW_OK) | |||||
{ | |||||
Log::Error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr)); | |||||
SDL_Quit(); | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
#endif | |||||
SDL_WM_SetCaption(title, NULL); | SDL_WM_SetCaption(title, NULL); | ||||
SDL_ShowCursor(0); | SDL_ShowCursor(0); | ||||
@@ -59,7 +59,7 @@ void Video::Setup(vec2i size) | |||||
#endif | #endif | ||||
glClearColor(0.1f, 0.2f, 0.3f, 0.0f); | glClearColor(0.1f, 0.2f, 0.3f, 0.0f); | ||||
glClearDepthf(1.0); | |||||
glClearDepth(1.0); | |||||
#if defined HAVE_GL_2X | #if defined HAVE_GL_2X | ||||
glShadeModel(GL_SMOOTH); | glShadeModel(GL_SMOOTH); | ||||