I'm not very good at explaining so I'll do the best I can:
(By the way, the project I've uploaded above, has been totally rewritten, it's no longer valid)
I guess you could say that I have the Wallpaper Service (in a class different than the renderer) wrapped in a surfaceView.
I guess it's all about adding the ES 2.0 depth bits. Then I spawn the engine with the renderer from your example, and with a previously set ContextFactory, and ConfigChooser, in which you customize the rbga, depth and stencil. There is a config checker too in there somewhere too, which identifies if what you have chosen is valid.
These lines would interest you the most:
private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098; //This is where it all starts.
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; //These are from an EGL attribute list I've found. Pretty standard, just called with custom strings so it would make it easier.
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
return context;
}
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
egl.eglDestroyContext(display, context);
}
}
protected class WallpaperEngine extends GLEngine {
public WallpaperEngine(Context context, MyRenderer renderer) {
super();
setEGLContextFactory(new ContextFactory());
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 16, 0));
renderer.setEngine(this);
setRenderer(renderer);
setRenderMode(RENDERMODE_CONTINUOUSLY);
}
}
public class MyWallpaper extends Wallpaper { //This is a class which extends the GLWallpaperService which I've got from Robert Green, and modified it a bit. It only overrides the engine.
private MyRenderer mRenderer; //It's mostly setters and overrides.
@Override
public Engine onCreateEngine() {
mRenderer = new MyRenderer(this);
return new WallpaperEngine(getBaseContext(), mRenderer);
}
}
This is from the config chooser class, which implements GLSurfaceView.EGLConfigChooser, and actually specifies the ES2.0:
private static int EGL_OPENGL_ES2_BIT = 4;
private static int[] s_configAttribs2 =
{
EGL10.EGL_RED_SIZE, 4,
EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE
};
I've added comments to simplify. The device is Samsung Galaxy Mini with 2.2 (FROYO) by the way... All debugging and testing were done on it, I don't trust the Emulator when working with GL stuff.
Getters and Setters for the engine and surfaceView should be made in the Renderer class accordingly, if you'd like to use preferences for Activity.
I'm not sure if I've been very clear, but as I said, I'm not very good at explaining. Take a look at:
http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapersAnyways, here's the video:
http://www.youtube.com/watch?v=BBx8yftg_bkSorry about the blank side on the Primitive, this is only a test.
And yes, one of my accounts is Nitrus015, I've been asking you about the Parallax mapping on your video, while I was still doing research on GL for android