Changeset 796


Ignore:
Timestamp:
Aug 2, 2011, 2:27:12 AM (8 years ago)
Author:
sam
Message:

gl: use Glew if available.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r795 r796  
    105105fi
    106106
     107dnl Use Glew?
     108ac_cv_my_have_glew="no"
     109PKG_CHECK_MODULES(GLEW, glew, [ac_cv_my_have_glew="yes"], [:])
     110if test "${ac_cv_my_have_glew}" != "no"; then
     111  AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     112  AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
     113fi
     114AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
     115
    107116dnl Poor man's GL feature detection.
    108117save_LIBS="${LIBS}"
     
    195204
    196205dnl How to use the Lol Engine inside this tree
    197 LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src $SDL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
    198 LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $LIBPNG_LIBS"
     206LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
     207LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $EGL_CFLAGS $GLEW_CFLAGS $LIBPNG_CFLAGS"
     208LOL_LIBS="$LOL_LIBS $SDL_LIBS $EGL_LIBS $GLEW_LIBS $LIBPNG_LIBS"
    199209
    200210AC_SUBST(MATH_LIBS)
  • trunk/src/lolgl.h

    r758 r796  
    2525
    2626/* Include GL */
    27 #if defined HAVE_GL_2X
     27#if defined USE_GLEW
     28#   include <GL/glew.h>
     29#elif defined HAVE_GL_2X
    2830#   if defined __APPLE__ && defined __MACH__
    2931#       include <OpenGL/gl.h>
     
    4749/* Redefine some function names */
    4850#if defined HAVE_GL_2X
    49 #   define glClearDepthf glClearDepth
    5051#elif defined HAVE_GLES_2X
     52#   define glClearDepth glClearDepthf
    5153#   define glGenVertexArrays glGenVertexArraysOES
    5254#   define glDeleteVertexArrays glDeleteVertexArraysOES
  • trunk/src/sdlapp.cpp

    r755 r796  
    1818
    1919#include "core.h"
     20#include "lolgl.h"
    2021#include "sdlapp.h"
    2122
     
    5960        exit(EXIT_FAILURE);
    6061    }
     62#if defined USE_GLEW
     63    GLenum glerr = glewInit();
     64    if (glerr != GLEW_OK)
     65    {
     66        Log::Error("cannot initialise GLEW: %s\n", glewGetErrorString(glerr));
     67        SDL_Quit();
     68        exit(EXIT_FAILURE);
     69    }
     70#endif
    6171
    6272    SDL_WM_SetCaption(title, NULL);
  • trunk/src/video.cpp

    r784 r796  
    6060
    6161    glClearColor(0.1f, 0.2f, 0.3f, 0.0f);
    62     glClearDepthf(1.0);
     62    glClearDepth(1.0);
    6363
    6464#if defined HAVE_GL_2X
Note: See TracChangeset for help on using the changeset viewer.