Skip to content

Commit

Permalink
Adds testgles2
Browse files Browse the repository at this point in the history
Source code copied from: https://github.com/fantasydr/sdl-2.0-gles (thanks!)

Minor fixes, configure script changes done by me.
  • Loading branch information
gabomdq committed Nov 19, 2013
1 parent fdfea4a commit 47139fb
Show file tree
Hide file tree
Showing 5 changed files with 713 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android-project/jni/src/Android.mk
Expand Up @@ -14,6 +14,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \

LOCAL_SHARED_LIBRARIES := SDL2

LOCAL_LDLIBS := -lGLESv1_CM -llog
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog

include $(BUILD_SHARED_LIBRARY)
4 changes: 4 additions & 0 deletions test/Makefile.in
Expand Up @@ -21,6 +21,7 @@ TARGETS = \
testgesture$(EXE) \
testgl2$(EXE) \
testgles$(EXE) \
testgles2$(EXE) \
testhaptic$(EXE) \
testrumble$(EXE) \
testthread$(EXE) \
Expand Down Expand Up @@ -131,6 +132,9 @@ testgl2$(EXE): $(srcdir)/testgl2.c
testgles$(EXE): $(srcdir)/testgles.c
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLESLIB@ @MATHLIB@

testgles2$(EXE): $(srcdir)/testgles2.c
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLES2LIB@ @MATHLIB@

testhaptic$(EXE): $(srcdir)/testhaptic.c
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)

Expand Down
38 changes: 38 additions & 0 deletions test/configure
Expand Up @@ -587,6 +587,7 @@ LIBOBJS
SDL_TTF_LIB
XLIB
GLESLIB
GLES2LIB
GLLIB
CPP
XMKMF
Expand Down Expand Up @@ -3860,12 +3861,49 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5
$as_echo "$have_opengles" >&6; }

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5
$as_echo_n "checking for OpenGL ES2 support... " >&6; }
have_opengles2=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined (__IPHONEOS__)
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

have_opengles2=yes

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5
$as_echo "$have_opengles2" >&6; }

GLLIB=""
GLESLIB=""
GLES2LIB=""
if test x$have_opengles = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES"
GLESLIB="$XPATH -lGLESv1_CM"
fi
if test x$have_opengles2 = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
GLES2LIB="$XPATH -lGLESv2"
fi
if test x$have_opengl = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGL"
GLLIB="$XPATH $SYS_GL_LIBS"
Expand Down
23 changes: 23 additions & 0 deletions test/configure.in
Expand Up @@ -135,19 +135,42 @@ have_opengles=yes
])
AC_MSG_RESULT($have_opengles)

dnl Check for OpenGL ES2
AC_MSG_CHECKING(for OpenGL ES2 support)
have_opengles2=no
AC_TRY_COMPILE([
#if defined (__IPHONEOS__)
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
],[
],[
have_opengles2=yes
])
AC_MSG_RESULT($have_opengles2)

GLLIB=""
GLESLIB=""
GLES2LIB=""
if test x$have_opengles = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES"
GLESLIB="$XPATH -lGLESv1_CM"
fi
if test x$have_opengles2 = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
GLES2LIB="$XPATH -lGLESv2"
fi
if test x$have_opengl = xyes; then
CFLAGS="$CFLAGS -DHAVE_OPENGL"
GLLIB="$XPATH $SYS_GL_LIBS"
fi

AC_SUBST(GLLIB)
AC_SUBST(GLESLIB)
AC_SUBST(GLES2LIB)
AC_SUBST(XLIB)

dnl Check for SDL_ttf
Expand Down

0 comments on commit 47139fb

Please sign in to comment.