简体   繁体   中英

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM