Przeglądaj źródła

gl: use Glew if available.

legacy
Sam Hocevar sam 13 lat temu
rodzic
commit
666efd14ee
4 zmienionych plików z 27 dodań i 5 usunięć
  1. +12
    -2
      configure.ac
  2. +4
    -2
      src/lolgl.h
  3. +10
    -0
      src/sdlapp.cpp
  4. +1
    -1
      src/video.cpp

+ 12
- 2
configure.ac Wyświetl plik

@@ -104,6 +104,15 @@ if test "${ac_cv_my_have_gl}" = "no"; then
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
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.
save_LIBS="${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
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(LOL_CFLAGS)


+ 4
- 2
src/lolgl.h Wyświetl plik

@@ -24,7 +24,9 @@
#endif

/* 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__
# include <OpenGL/gl.h>
# else
@@ -46,8 +48,8 @@

/* Redefine some function names */
#if defined HAVE_GL_2X
# define glClearDepthf glClearDepth
#elif defined HAVE_GLES_2X
# define glClearDepth glClearDepthf
# define glGenVertexArrays glGenVertexArraysOES
# define glDeleteVertexArrays glDeleteVertexArraysOES
# define glBindVertexArray glBindVertexArrayOES


+ 10
- 0
src/sdlapp.cpp Wyświetl plik

@@ -17,6 +17,7 @@
#endif

#include "core.h"
#include "lolgl.h"
#include "sdlapp.h"

namespace lol
@@ -58,6 +59,15 @@ SdlApp::SdlApp(char const *title, vec2i res, float fps) :
SDL_Quit();
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_ShowCursor(0);


+ 1
- 1
src/video.cpp Wyświetl plik

@@ -59,7 +59,7 @@ void Video::Setup(vec2i size)
#endif

glClearColor(0.1f, 0.2f, 0.3f, 0.0f);
glClearDepthf(1.0);
glClearDepth(1.0);

#if defined HAVE_GL_2X
glShadeModel(GL_SMOOTH);


Ładowanie…
Anuluj
Zapisz