[SDL] Are there any working SDL Android examples?

Manuel Massing m.massing at warped-space.de
Mon Jul 25 08:46:35 PDT 2011


Hi William,

The alien project is probably using either the OpenGL ES 1.1
or OpenGL ES 2.0 accelerated SDL renderer (for blitting etc.).

Make sure _that only one of the renderers is registered or the correct one
selected_, and take note if it is the gles or gles 2.0 renderer (e.g. 
by looking into the SDL source code, in particular renderer/SDL_render.c and
the SDL_config.h used for your build!).

Anyway, I would suggest you start from scratch with a minimal SDL project 
instead (lots of sample code), and move up from there. 

1) Create your minimal project based on $SDLDIR/android-project.
Put your source in android-project/jni/src/YourSource.cpp and edit the
Android.mk accordingly.

2) invoke "ndk-build" then "ant debug" to build it.

In your program, first try creating a simple window and GL context. If
you require GLES 2.0, use the modifications suggested by Forest Hale, or use
the patch I sent you previously (use my patch in conjunction with

        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
or
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);

depending on whether you want to create an OpenGL ES 1.1 or OpenGL ES 2.0
context)

If video init succeeds, test simple OpenGL functionality (e.g. a framebuffer 
clear: glClearColor(1,0,0,1); glClear(GL_COLOR_BUFFER_BIT); ).

If you need further suggestions, provide the "logcat *:V" output of
your application startup.

bye,

	Manuel



More information about the SDL mailing list