开发者

Android Live Wallpapers with OpenGL ES 2.0?

Has anyone managed to get OpenGL ES 2.0 working in a live wallpaper? I have a class that 开发者_JS百科uses OpenGL ES 2.0 and runs fine as a Renderer for a GLSurfaceView. However, I want it to function as a live wallpaper. I found Robert Green's GLWallpaperService, but that is based on an older version of GLSurfaceView and does not support setEGLContextClientVersion, which is needed to run OpenGL ES 2.0.


I've managed to get an opengl-based LWP working by extending GLSurfaceView and then wrapping that in a wallpaper service. I haven't specifically tested if opengl es 2.0 works with this method, but I see no reason it wouldn't.

You can find the LWP specific files at https://github.com/JesusFreke/Penroser/tree/master/src/org/jf/GLWallpaper. They should be generic and usable as-is in other projects. For an example of how to use these classes, see https://github.com/JesusFreke/Penroser/blob/master/src/org/jf/Penroser/PenroserLiveWallpaper.java


The code at this blog post adapts Robert Green's GLWallpaperService to work with OpenGL ES 2.0. You may have some success using it, however it would probably be simpler for you to use JesusFreke's implementation.

If you are successful in improving GLWallpaperService please submit your changes back to the project so that we can all benefit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜