Added minimal test project
authorPaul Hunkin
Thu, 17 Jun 2010 22:19:27 +1200
changeset 4704611d39792201
parent 4703 c93b44ddc63e
child 4705 190f043af37d
Added minimal test project
android/testproject/AndroidManifest.xml
android/testproject/build.properties
android/testproject/build.xml
android/testproject/default.properties
android/testproject/jni/Android.mk
android/testproject/jni/app-android.c
android/testproject/jni/importgl.c
android/testproject/jni/importgl.h
android/testproject/libs/armeabi/libsanangeles.so
android/testproject/local.properties
android/testproject/res/drawable-hdpi/icon.png
android/testproject/res/drawable-ldpi/icon.png
android/testproject/res/drawable-mdpi/icon.png
android/testproject/res/layout/main.xml
android/testproject/res/values/strings.xml
android/testproject/src/org/libsdl/android/TestActivity.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/android/testproject/AndroidManifest.xml	Thu Jun 17 22:19:27 2010 +1200
     1.3 @@ -0,0 +1,15 @@
     1.4 +<?xml version="1.0" encoding="utf-8"?>
     1.5 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     1.6 +      package="org.libsdl.android"
     1.7 +      android:versionCode="1"
     1.8 +      android:versionName="1.0">
     1.9 +    <application android:label="@string/app_name" android:icon="@drawable/icon">
    1.10 +        <activity android:name="TestActivity"
    1.11 +                  android:label="@string/app_name">
    1.12 +            <intent-filter>
    1.13 +                <action android:name="android.intent.action.MAIN" />
    1.14 +                <category android:name="android.intent.category.LAUNCHER" />
    1.15 +            </intent-filter>
    1.16 +        </activity>
    1.17 +    </application>
    1.18 +</manifest> 
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/android/testproject/build.properties	Thu Jun 17 22:19:27 2010 +1200
     2.3 @@ -0,0 +1,17 @@
     2.4 +# This file is used to override default values used by the Ant build system.
     2.5 +# 
     2.6 +# This file must be checked in Version Control Systems, as it is
     2.7 +# integral to the build system of your project.
     2.8 +
     2.9 +# This file is only used by the Ant script.
    2.10 +
    2.11 +# You can use this to override default values such as
    2.12 +#  'source.dir' for the location of your java source folder and
    2.13 +#  'out.dir' for the location of your output folder.
    2.14 +
    2.15 +# You can also use it define how the release builds are signed by declaring
    2.16 +# the following properties:
    2.17 +#  'key.store' for the location of your keystore and
    2.18 +#  'key.alias' for the name of the key to use.
    2.19 +# The password will be asked during the build when you use the 'release' target.
    2.20 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/android/testproject/build.xml	Thu Jun 17 22:19:27 2010 +1200
     3.3 @@ -0,0 +1,67 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<project name="Test" default="help">
     3.6 +
     3.7 +    <!-- The local.properties file is created and updated by the 'android' tool.
     3.8 +         It contains the path to the SDK. It should *NOT* be checked in in Version
     3.9 +         Control Systems. -->
    3.10 +    <property file="local.properties" />
    3.11 +
    3.12 +    <!-- The build.properties file can be created by you and is never touched
    3.13 +         by the 'android' tool. This is the place to change some of the default property values
    3.14 +         used by the Ant rules.
    3.15 +         Here are some properties you may want to change/update:
    3.16 +
    3.17 +         application.package
    3.18 +             the name of your application package as defined in the manifest. Used by the
    3.19 +             'uninstall' rule.
    3.20 +         source.dir
    3.21 +             the name of the source directory. Default is 'src'.
    3.22 +         out.dir
    3.23 +             the name of the output directory. Default is 'bin'.
    3.24 +
    3.25 +         Properties related to the SDK location or the project target should be updated
    3.26 +          using the 'android' tool with the 'update' action.
    3.27 +
    3.28 +         This file is an integral part of the build system for your application and
    3.29 +         should be checked in in Version Control Systems.
    3.30 +
    3.31 +         -->
    3.32 +    <property file="build.properties" />
    3.33 +
    3.34 +    <!-- The default.properties file is created and updated by the 'android' tool, as well
    3.35 +         as ADT.
    3.36 +         This file is an integral part of the build system for your application and
    3.37 +         should be checked in in Version Control Systems. -->
    3.38 +    <property file="default.properties" />
    3.39 +
    3.40 +    <!-- Custom Android task to deal with the project target, and import the proper rules.
    3.41 +         This requires ant 1.6.0 or above. -->
    3.42 +    <path id="android.antlibs">
    3.43 +        <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
    3.44 +        <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
    3.45 +        <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
    3.46 +        <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
    3.47 +        <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
    3.48 +    </path>
    3.49 +
    3.50 +    <taskdef name="setup"
    3.51 +        classname="com.android.ant.SetupTask"
    3.52 +        classpathref="android.antlibs" />
    3.53 +
    3.54 +    <!-- Execute the Android Setup task that will setup some properties specific to the target,
    3.55 +         and import the build rules files.
    3.56 +
    3.57 +         The rules file is imported from
    3.58 +            <SDK>/platforms/<target_platform>/templates/android_rules.xml
    3.59 +
    3.60 +         To customize some build steps for your project:
    3.61 +         - copy the content of the main node <project> from android_rules.xml
    3.62 +         - paste it in this build.xml below the <setup /> task.
    3.63 +         - disable the import by changing the setup task below to <setup import="false" />
    3.64 +
    3.65 +         This will ensure that the properties are setup correctly but that your customized
    3.66 +         build steps are used.
    3.67 +    -->
    3.68 +    <setup />
    3.69 +
    3.70 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/android/testproject/default.properties	Thu Jun 17 22:19:27 2010 +1200
     4.3 @@ -0,0 +1,11 @@
     4.4 +# This file is automatically generated by Android Tools.
     4.5 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
     4.6 +# 
     4.7 +# This file must be checked in Version Control Systems.
     4.8 +# 
     4.9 +# To customize properties used by the Ant build system use,
    4.10 +# "build.properties", and override values to adapt the script to your
    4.11 +# project structure.
    4.12 +
    4.13 +# Project target.
    4.14 +target=Google Inc.:Google APIs:7
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/android/testproject/jni/Android.mk	Thu Jun 17 22:19:27 2010 +1200
     5.3 @@ -0,0 +1,16 @@
     5.4 +LOCAL_PATH := $(call my-dir)
     5.5 +
     5.6 +include $(CLEAR_VARS)
     5.7 +
     5.8 +LOCAL_MODULE := sanangeles
     5.9 +
    5.10 +LOCAL_CFLAGS := -DANDROID_NDK \
    5.11 +                -DDISABLE_IMPORTGL
    5.12 +
    5.13 +LOCAL_SRC_FILES := \
    5.14 +    importgl.c \
    5.15 +    app-android.c \
    5.16 +
    5.17 +LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
    5.18 +
    5.19 +include $(BUILD_SHARED_LIBRARY)
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/android/testproject/jni/app-android.c	Thu Jun 17 22:19:27 2010 +1200
     6.3 @@ -0,0 +1,79 @@
     6.4 +/*******************************************************************************
     6.5 +                               Headers
     6.6 +*******************************************************************************/
     6.7 +#include <jni.h>
     6.8 +#include <sys/time.h>
     6.9 +#include <time.h>
    6.10 +#include <android/log.h>
    6.11 +#include <stdint.h>
    6.12 +
    6.13 +/*******************************************************************************
    6.14 +                               Globals
    6.15 +*******************************************************************************/
    6.16 +int gAppAlive = 1;
    6.17 +
    6.18 +static int sWindowWidth  = 320;
    6.19 +static int sWindowHeight = 480;
    6.20 +static int sDemoStopped  = 0;
    6.21 +
    6.22 +static long _getTime(void){
    6.23 +	struct timeval  now;
    6.24 +	gettimeofday(&now, NULL);
    6.25 +	return (long)(now.tv_sec*1000 + now.tv_usec/1000);
    6.26 +}
    6.27 +
    6.28 +/*******************************************************************************
    6.29 +                      Initialize the graphics state
    6.30 +*******************************************************************************/
    6.31 +void Java_org_libsdl_android_TestRenderer_nativeInit( JNIEnv*  env )
    6.32 +{
    6.33 +	importGLInit();
    6.34 +
    6.35 +	gAppAlive    = 1;
    6.36 +	sDemoStopped = 0;
    6.37 +}
    6.38 +
    6.39 +/*******************************************************************************
    6.40 +                                 Resize
    6.41 +*******************************************************************************/
    6.42 +void Java_org_libsdl_android_TestRenderer_nativeResize( JNIEnv*  env, 
    6.43 +														jobject  thiz, 
    6.44 +														jint w,
    6.45 +														jint h )
    6.46 +{
    6.47 +	sWindowWidth  = w;
    6.48 +	sWindowHeight = h;
    6.49 +	__android_log_print(ANDROID_LOG_INFO, "SDL", "resize w=%d h=%d", w, h);
    6.50 +}
    6.51 +
    6.52 +/*******************************************************************************
    6.53 +                         Finalize (ie: shutdown)
    6.54 +*******************************************************************************/
    6.55 +void Java_org_libsdl_android_TestRenderer_nativeDone( JNIEnv*  env )
    6.56 +{
    6.57 +
    6.58 +	//shut down the app
    6.59 +
    6.60 +	importGLDeinit();
    6.61 +}
    6.62 +
    6.63 +/*******************************************************************************
    6.64 +                   Pause (ie: stop as soon as possible)
    6.65 +*******************************************************************************/
    6.66 +void Java_org_libsdl_android_TestGLSurfaceView_nativePause( JNIEnv*  env )
    6.67 +{
    6.68 +	sDemoStopped = !sDemoStopped;
    6.69 +	if (sDemoStopped) {
    6.70 +		//we paused
    6.71 +	} else {
    6.72 +		//we resumed
    6.73 +	}
    6.74 +}
    6.75 +
    6.76 +/*******************************************************************************
    6.77 +                     Render the next frame
    6.78 +*******************************************************************************/
    6.79 +void Java_org_libsdl_android_TestRenderer_nativeRender( JNIEnv*  env )
    6.80 +{    
    6.81 +	//TODO: Render here
    6.82 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/android/testproject/jni/importgl.c	Thu Jun 17 22:19:27 2010 +1200
     7.3 @@ -0,0 +1,168 @@
     7.4 +/* San Angeles Observation OpenGL ES version example
     7.5 + * Copyright 2004-2005 Jetro Lauha
     7.6 + * All rights reserved.
     7.7 + * Web: http://iki.fi/jetro/
     7.8 + *
     7.9 + * This source is free software; you can redistribute it and/or
    7.10 + * modify it under the terms of EITHER:
    7.11 + *   (1) The GNU Lesser General Public License as published by the Free
    7.12 + *       Software Foundation; either version 2.1 of the License, or (at
    7.13 + *       your option) any later version. The text of the GNU Lesser
    7.14 + *       General Public License is included with this source in the
    7.15 + *       file LICENSE-LGPL.txt.
    7.16 + *   (2) The BSD-style license that is included with this source in
    7.17 + *       the file LICENSE-BSD.txt.
    7.18 + *
    7.19 + * This source is distributed in the hope that it will be useful,
    7.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
    7.22 + * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
    7.23 + *
    7.24 + * $Id: importgl.c,v 1.4 2005/02/08 18:42:55 tonic Exp $
    7.25 + * $Revision: 1.4 $
    7.26 + */
    7.27 +
    7.28 +#undef WIN32
    7.29 +#undef LINUX
    7.30 +#ifdef _MSC_VER
    7.31 +// Desktop or mobile Win32 environment:
    7.32 +#define WIN32
    7.33 +#else
    7.34 +// Linux environment:
    7.35 +#define LINUX
    7.36 +#endif
    7.37 +
    7.38 +#ifndef DISABLE_IMPORTGL
    7.39 +
    7.40 +#if defined(WIN32)
    7.41 +#define WIN32_LEAN_AND_MEAN
    7.42 +#include <windows.h>
    7.43 +#include <tchar.h>
    7.44 +static HMODULE sGLESDLL = NULL;
    7.45 +#endif // WIN32
    7.46 +
    7.47 +#ifdef LINUX
    7.48 +#include <stdlib.h>
    7.49 +#include <dlfcn.h>
    7.50 +static void *sGLESSO = NULL;
    7.51 +#endif // LINUX
    7.52 +
    7.53 +#endif /* DISABLE_IMPORTGL */
    7.54 +
    7.55 +#define IMPORTGL_NO_FNPTR_DEFS
    7.56 +#define IMPORTGL_API
    7.57 +#define IMPORTGL_FNPTRINIT = NULL
    7.58 +#include "importgl.h"
    7.59 +
    7.60 +
    7.61 +/* Imports function pointers to selected function calls in OpenGL ES Common
    7.62 + * or Common Lite profile DLL or shared object. The function pointers are
    7.63 + * stored as global symbols with equivalent function name but prefixed with
    7.64 + * "funcPtr_". Standard gl/egl calls are redirected to the function pointers
    7.65 + * with preprocessor macros (see importgl.h).
    7.66 + */
    7.67 +int importGLInit()
    7.68 +{
    7.69 +    int result = 1;
    7.70 +
    7.71 +#ifndef DISABLE_IMPORTGL
    7.72 +
    7.73 +#undef IMPORT_FUNC
    7.74 +
    7.75 +#ifdef WIN32
    7.76 +    sGLESDLL = LoadLibrary(_T("libGLES_CM.dll"));
    7.77 +    if (sGLESDLL == NULL)
    7.78 +        sGLESDLL = LoadLibrary(_T("libGLES_CL.dll"));
    7.79 +    if (sGLESDLL == NULL)
    7.80 +        return 0;   // Cannot find OpenGL ES Common or Common Lite DLL.
    7.81 +
    7.82 +    /* The following fetches address to each egl & gl function call
    7.83 +     * and stores it to the related function pointer. Casting through
    7.84 +     * void * results in warnings with VC warning level 4, which
    7.85 +     * could be fixed by casting to the true type for each fetch.
    7.86 +     */
    7.87 +#define IMPORT_FUNC(funcName) do { \
    7.88 +        void *procAddress = (void *)GetProcAddress(sGLESDLL, _T(#funcName)); \
    7.89 +        if (procAddress == NULL) result = 0; \
    7.90 +        *((void **)&FNPTR(funcName)) = procAddress; } while (0)
    7.91 +#endif // WIN32
    7.92 +
    7.93 +#ifdef LINUX
    7.94 +#ifdef ANDROID_NDK
    7.95 +    sGLESSO = dlopen("libGLESv1_CM.so", RTLD_NOW);
    7.96 +#else /* !ANDROID_NDK */
    7.97 +    sGLESSO = dlopen("libGLES_CM.so", RTLD_NOW);
    7.98 +    if (sGLESSO == NULL)
    7.99 +        sGLESSO = dlopen("libGLES_CL.so", RTLD_NOW);
   7.100 +#endif /* !ANDROID_NDK */
   7.101 +    if (sGLESSO == NULL)
   7.102 +        return 0;   // Cannot find OpenGL ES Common or Common Lite SO.
   7.103 +
   7.104 +#define IMPORT_FUNC(funcName) do { \
   7.105 +        void *procAddress = (void *)dlsym(sGLESSO, #funcName); \
   7.106 +        if (procAddress == NULL) result = 0; \
   7.107 +        *((void **)&FNPTR(funcName)) = procAddress; } while (0)
   7.108 +#endif // LINUX
   7.109 +
   7.110 +#ifndef ANDROID_NDK
   7.111 +    IMPORT_FUNC(eglChooseConfig);
   7.112 +    IMPORT_FUNC(eglCreateContext);
   7.113 +    IMPORT_FUNC(eglCreateWindowSurface);
   7.114 +    IMPORT_FUNC(eglDestroyContext);
   7.115 +    IMPORT_FUNC(eglDestroySurface);
   7.116 +    IMPORT_FUNC(eglGetConfigAttrib);
   7.117 +    IMPORT_FUNC(eglGetConfigs);
   7.118 +    IMPORT_FUNC(eglGetDisplay);
   7.119 +    IMPORT_FUNC(eglGetError);
   7.120 +    IMPORT_FUNC(eglInitialize);
   7.121 +    IMPORT_FUNC(eglMakeCurrent);
   7.122 +    IMPORT_FUNC(eglSwapBuffers);
   7.123 +    IMPORT_FUNC(eglTerminate);
   7.124 +#endif /* !ANDROID_NDK */
   7.125 +
   7.126 +    IMPORT_FUNC(glBlendFunc);
   7.127 +    IMPORT_FUNC(glClear);
   7.128 +    IMPORT_FUNC(glClearColorx);
   7.129 +    IMPORT_FUNC(glColor4x);
   7.130 +    IMPORT_FUNC(glColorPointer);
   7.131 +    IMPORT_FUNC(glDisable);
   7.132 +    IMPORT_FUNC(glDisableClientState);
   7.133 +    IMPORT_FUNC(glDrawArrays);
   7.134 +    IMPORT_FUNC(glEnable);
   7.135 +    IMPORT_FUNC(glEnableClientState);
   7.136 +    IMPORT_FUNC(glFrustumx);
   7.137 +    IMPORT_FUNC(glGetError);
   7.138 +    IMPORT_FUNC(glLightxv);
   7.139 +    IMPORT_FUNC(glLoadIdentity);
   7.140 +    IMPORT_FUNC(glMaterialx);
   7.141 +    IMPORT_FUNC(glMaterialxv);
   7.142 +    IMPORT_FUNC(glMatrixMode);
   7.143 +    IMPORT_FUNC(glMultMatrixx);
   7.144 +    IMPORT_FUNC(glNormalPointer);
   7.145 +    IMPORT_FUNC(glPopMatrix);
   7.146 +    IMPORT_FUNC(glPushMatrix);
   7.147 +    IMPORT_FUNC(glRotatex);
   7.148 +    IMPORT_FUNC(glScalex);
   7.149 +    IMPORT_FUNC(glShadeModel);
   7.150 +    IMPORT_FUNC(glTranslatex);
   7.151 +    IMPORT_FUNC(glVertexPointer);
   7.152 +    IMPORT_FUNC(glViewport);
   7.153 +
   7.154 +#endif /* DISABLE_IMPORTGL */
   7.155 +
   7.156 +    return result;
   7.157 +}
   7.158 +
   7.159 +
   7.160 +void importGLDeinit()
   7.161 +{
   7.162 +#ifndef DISABLE_IMPORTGL
   7.163 +#ifdef WIN32
   7.164 +    FreeLibrary(sGLESDLL);
   7.165 +#endif
   7.166 +
   7.167 +#ifdef LINUX
   7.168 +    dlclose(sGLESSO);
   7.169 +#endif
   7.170 +#endif /* DISABLE_IMPORTGL */
   7.171 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/android/testproject/jni/importgl.h	Thu Jun 17 22:19:27 2010 +1200
     8.3 @@ -0,0 +1,172 @@
     8.4 +/* San Angeles Observation OpenGL ES version example
     8.5 + * Copyright 2004-2005 Jetro Lauha
     8.6 + * All rights reserved.
     8.7 + * Web: http://iki.fi/jetro/
     8.8 + *
     8.9 + * This source is free software; you can redistribute it and/or
    8.10 + * modify it under the terms of EITHER:
    8.11 + *   (1) The GNU Lesser General Public License as published by the Free
    8.12 + *       Software Foundation; either version 2.1 of the License, or (at
    8.13 + *       your option) any later version. The text of the GNU Lesser
    8.14 + *       General Public License is included with this source in the
    8.15 + *       file LICENSE-LGPL.txt.
    8.16 + *   (2) The BSD-style license that is included with this source in
    8.17 + *       the file LICENSE-BSD.txt.
    8.18 + *
    8.19 + * This source is distributed in the hope that it will be useful,
    8.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
    8.22 + * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
    8.23 + *
    8.24 + * $Id: importgl.h,v 1.4 2005/02/24 20:29:33 tonic Exp $
    8.25 + * $Revision: 1.4 $
    8.26 + */
    8.27 +
    8.28 +#ifndef IMPORTGL_H_INCLUDED
    8.29 +#define IMPORTGL_H_INCLUDED
    8.30 +
    8.31 +
    8.32 +#ifdef __cplusplus
    8.33 +extern "C" {
    8.34 +#endif
    8.35 +
    8.36 +
    8.37 +#include <GLES/gl.h>
    8.38 +#ifndef ANDROID_NDK
    8.39 +#include <GLES/egl.h>
    8.40 +#endif /* !ANDROID_NDK */
    8.41 +
    8.42 +/* Use DISABLE_IMPORTGL if you want to link the OpenGL ES at
    8.43 + * compile/link time and not import it dynamically runtime.
    8.44 + */
    8.45 +#ifndef DISABLE_IMPORTGL
    8.46 +
    8.47 +
    8.48 +/* Dynamically fetches pointers to the egl & gl functions.
    8.49 + * Should be called once on application initialization.
    8.50 + * Returns non-zero on success and 0 on failure.
    8.51 + */
    8.52 +extern int importGLInit();
    8.53 +
    8.54 +/* Frees the handle to egl & gl functions library.
    8.55 + */
    8.56 +extern void importGLDeinit();
    8.57 +
    8.58 +
    8.59 +#ifndef IMPORTGL_API
    8.60 +#define IMPORTGL_API extern
    8.61 +#endif
    8.62 +#ifndef IMPORTGL_FNPTRINIT
    8.63 +#define IMPORTGL_FNPTRINIT
    8.64 +#endif
    8.65 +
    8.66 +#define FNDEF(retType, funcName, args) IMPORTGL_API retType (*funcPtr_##funcName) args IMPORTGL_FNPTRINIT
    8.67 +
    8.68 +#ifndef ANDROID_NDK
    8.69 +FNDEF(EGLBoolean, eglChooseConfig, (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config));
    8.70 +FNDEF(EGLContext, eglCreateContext, (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list));
    8.71 +FNDEF(EGLSurface, eglCreateWindowSurface, (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list));
    8.72 +FNDEF(EGLBoolean, eglDestroyContext, (EGLDisplay dpy, EGLContext ctx));
    8.73 +FNDEF(EGLBoolean, eglDestroySurface, (EGLDisplay dpy, EGLSurface surface));
    8.74 +FNDEF(EGLBoolean, eglGetConfigAttrib, (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value));
    8.75 +FNDEF(EGLBoolean, eglGetConfigs, (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config));
    8.76 +FNDEF(EGLDisplay, eglGetDisplay, (NativeDisplayType display));
    8.77 +FNDEF(EGLint, eglGetError, (void));
    8.78 +FNDEF(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint *major, EGLint *minor));
    8.79 +FNDEF(EGLBoolean, eglMakeCurrent, (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx));
    8.80 +FNDEF(EGLBoolean, eglSwapBuffers, (EGLDisplay dpy, EGLSurface draw));
    8.81 +FNDEF(EGLBoolean, eglTerminate, (EGLDisplay dpy));
    8.82 +#endif /* !ANDROID_NDK */
    8.83 +
    8.84 +FNDEF(void, glBlendFunc, (GLenum sfactor, GLenum dfactor));
    8.85 +FNDEF(void, glClear, (GLbitfield mask));
    8.86 +FNDEF(void, glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha));
    8.87 +FNDEF(void, glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha));
    8.88 +FNDEF(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
    8.89 +FNDEF(void, glDisable, (GLenum cap));
    8.90 +FNDEF(void, glDisableClientState, (GLenum array));
    8.91 +FNDEF(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count));
    8.92 +FNDEF(void, glEnable, (GLenum cap));
    8.93 +FNDEF(void, glEnableClientState, (GLenum array));
    8.94 +FNDEF(void, glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar));
    8.95 +FNDEF(GLenum, glGetError, (void));
    8.96 +FNDEF(void, glLightxv, (GLenum light, GLenum pname, const GLfixed *params));
    8.97 +FNDEF(void, glLoadIdentity, (void));
    8.98 +FNDEF(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param));
    8.99 +FNDEF(void, glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params));
   8.100 +FNDEF(void, glMatrixMode, (GLenum mode));
   8.101 +FNDEF(void, glMultMatrixx, (const GLfixed *m));
   8.102 +FNDEF(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer));
   8.103 +FNDEF(void, glPopMatrix, (void));
   8.104 +FNDEF(void, glPushMatrix, (void));
   8.105 +FNDEF(void, glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z));
   8.106 +FNDEF(void, glScalex, (GLfixed x, GLfixed y, GLfixed z));
   8.107 +FNDEF(void, glShadeModel, (GLenum mode));
   8.108 +FNDEF(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z));
   8.109 +FNDEF(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
   8.110 +FNDEF(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
   8.111 +
   8.112 +
   8.113 +#undef FN
   8.114 +#define FNPTR(name) funcPtr_##name
   8.115 +
   8.116 +#ifndef IMPORTGL_NO_FNPTR_DEFS
   8.117 +
   8.118 +// Redirect egl* and gl* function calls to funcPtr_egl* and funcPtr_gl*.
   8.119 +
   8.120 +#ifndef ANDROID_NDK
   8.121 +#define eglChooseConfig         FNPTR(eglChooseConfig)
   8.122 +#define eglCreateContext        FNPTR(eglCreateContext)
   8.123 +#define eglCreateWindowSurface  FNPTR(eglCreateWindowSurface)
   8.124 +#define eglDestroyContext       FNPTR(eglDestroyContext)
   8.125 +#define eglDestroySurface       FNPTR(eglDestroySurface)
   8.126 +#define eglGetConfigAttrib      FNPTR(eglGetConfigAttrib)
   8.127 +#define eglGetConfigs           FNPTR(eglGetConfigs)
   8.128 +#define eglGetDisplay           FNPTR(eglGetDisplay)
   8.129 +#define eglGetError             FNPTR(eglGetError)
   8.130 +#define eglInitialize           FNPTR(eglInitialize)
   8.131 +#define eglMakeCurrent          FNPTR(eglMakeCurrent)
   8.132 +#define eglSwapBuffers          FNPTR(eglSwapBuffers)
   8.133 +#define eglTerminate            FNPTR(eglTerminate)
   8.134 +#endif /* !ANDROID_NDK */
   8.135 +
   8.136 +#define glBlendFunc             FNPTR(glBlendFunc)
   8.137 +#define glClear                 FNPTR(glClear)
   8.138 +#define glClearColorx           FNPTR(glClearColorx)
   8.139 +#define glColor4x               FNPTR(glColor4x)
   8.140 +#define glColorPointer          FNPTR(glColorPointer)
   8.141 +#define glDisable               FNPTR(glDisable)
   8.142 +#define glDisableClientState    FNPTR(glDisableClientState)
   8.143 +#define glDrawArrays            FNPTR(glDrawArrays)
   8.144 +#define glEnable                FNPTR(glEnable)
   8.145 +#define glEnableClientState     FNPTR(glEnableClientState)
   8.146 +#define glFrustumx              FNPTR(glFrustumx)
   8.147 +#define glGetError              FNPTR(glGetError)
   8.148 +#define glLightxv               FNPTR(glLightxv)
   8.149 +#define glLoadIdentity          FNPTR(glLoadIdentity)
   8.150 +#define glMaterialx             FNPTR(glMaterialx)
   8.151 +#define glMaterialxv            FNPTR(glMaterialxv)
   8.152 +#define glMatrixMode            FNPTR(glMatrixMode)
   8.153 +#define glMultMatrixx           FNPTR(glMultMatrixx)
   8.154 +#define glNormalPointer         FNPTR(glNormalPointer)
   8.155 +#define glPopMatrix             FNPTR(glPopMatrix)
   8.156 +#define glPushMatrix            FNPTR(glPushMatrix)
   8.157 +#define glRotatex               FNPTR(glRotatex)
   8.158 +#define glScalex                FNPTR(glScalex)
   8.159 +#define glShadeModel            FNPTR(glShadeModel)
   8.160 +#define glTranslatex            FNPTR(glTranslatex)
   8.161 +#define glVertexPointer         FNPTR(glVertexPointer)
   8.162 +#define glViewport              FNPTR(glViewport)
   8.163 +
   8.164 +#endif // !IMPORTGL_NO_FNPTR_DEFS
   8.165 +
   8.166 +
   8.167 +#endif // !DISABLE_IMPORTGL
   8.168 +
   8.169 +
   8.170 +#ifdef __cplusplus
   8.171 +}
   8.172 +#endif
   8.173 +
   8.174 +
   8.175 +#endif // !IMPORTGL_H_INCLUDED
     9.1 Binary file android/testproject/libs/armeabi/libsanangeles.so has changed
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/android/testproject/local.properties	Thu Jun 17 22:19:27 2010 +1200
    10.3 @@ -0,0 +1,10 @@
    10.4 +# This file is automatically generated by Android Tools.
    10.5 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
    10.6 +# 
    10.7 +# This file must *NOT* be checked in Version Control Systems,
    10.8 +# as it contains information specific to your local configuration.
    10.9 +
   10.10 +# location of the SDK. This is only used by Ant
   10.11 +# For customization when using a Version Control System, please read the
   10.12 +# header note.
   10.13 +sdk.dir=/home/paul/Projects/gsoc/sdk/android-sdk-linux_86
    11.1 Binary file android/testproject/res/drawable-hdpi/icon.png has changed
    12.1 Binary file android/testproject/res/drawable-ldpi/icon.png has changed
    13.1 Binary file android/testproject/res/drawable-mdpi/icon.png has changed
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/android/testproject/res/layout/main.xml	Thu Jun 17 22:19:27 2010 +1200
    14.3 @@ -0,0 +1,13 @@
    14.4 +<?xml version="1.0" encoding="utf-8"?>
    14.5 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    14.6 +    android:orientation="vertical"
    14.7 +    android:layout_width="fill_parent"
    14.8 +    android:layout_height="fill_parent"
    14.9 +    >
   14.10 +<TextView  
   14.11 +    android:layout_width="fill_parent" 
   14.12 +    android:layout_height="wrap_content" 
   14.13 +    android:text="Hello World, TestActivity"
   14.14 +    />
   14.15 +</LinearLayout>
   14.16 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/android/testproject/res/values/strings.xml	Thu Jun 17 22:19:27 2010 +1200
    15.3 @@ -0,0 +1,4 @@
    15.4 +<?xml version="1.0" encoding="utf-8"?>
    15.5 +<resources>
    15.6 +    <string name="app_name">TestActivity</string>
    15.7 +</resources>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/android/testproject/src/org/libsdl/android/TestActivity.java	Thu Jun 17 22:19:27 2010 +1200
    16.3 @@ -0,0 +1,76 @@
    16.4 +package org.libsdl.android;
    16.5 +
    16.6 +import javax.microedition.khronos.egl.EGLConfig;
    16.7 +import javax.microedition.khronos.opengles.GL10;
    16.8 +
    16.9 +import android.app.Activity;
   16.10 +import android.content.Context;
   16.11 +import android.opengl.GLSurfaceView;
   16.12 +import android.os.Bundle;
   16.13 +import android.view.MotionEvent;
   16.14 +
   16.15 +public class TestActivity extends Activity {
   16.16 +    @Override
   16.17 +    protected void onCreate(Bundle savedInstanceState) {
   16.18 +        super.onCreate(savedInstanceState);
   16.19 +        mGLView = new TestGLSurfaceView(this);
   16.20 +        setContentView(mGLView);
   16.21 +    }
   16.22 +
   16.23 +    @Override
   16.24 +    protected void onPause() {
   16.25 +        super.onPause();
   16.26 +        mGLView.onPause();
   16.27 +    }
   16.28 +
   16.29 +    @Override
   16.30 +    protected void onResume() {
   16.31 +        super.onResume();
   16.32 +        mGLView.onResume();
   16.33 +    }
   16.34 +
   16.35 +    private GLSurfaceView mGLView;
   16.36 +
   16.37 +    static {
   16.38 +        System.loadLibrary("sanangeles");
   16.39 +    }
   16.40 +}
   16.41 +
   16.42 +class TestGLSurfaceView extends GLSurfaceView {
   16.43 +    public TestGLSurfaceView(Context context) {
   16.44 +        super(context);
   16.45 +        mRenderer = new TestRenderer();
   16.46 +        setRenderer(mRenderer);
   16.47 +    }
   16.48 +
   16.49 +    public boolean onTouchEvent(final MotionEvent event) {
   16.50 +        if (event.getAction() == MotionEvent.ACTION_DOWN) {
   16.51 +            nativePause();
   16.52 +        }
   16.53 +        return true;
   16.54 +    }
   16.55 +
   16.56 +    TestRenderer mRenderer;
   16.57 +
   16.58 +    private static native void nativePause();
   16.59 +}
   16.60 +
   16.61 +class TestRenderer implements GLSurfaceView.Renderer {
   16.62 +    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   16.63 +        nativeInit();
   16.64 +    }
   16.65 +
   16.66 +    public void onSurfaceChanged(GL10 gl, int w, int h) {
   16.67 +        //gl.glViewport(0, 0, w, h);
   16.68 +        nativeResize(w, h);
   16.69 +    }
   16.70 +
   16.71 +    public void onDrawFrame(GL10 gl) {
   16.72 +        nativeRender();
   16.73 +    }
   16.74 +
   16.75 +    private static native void nativeInit();
   16.76 +    private static native void nativeResize(int w, int h);
   16.77 +    private static native void nativeRender();
   16.78 +    private static native void nativeDone();
   16.79 +}