Author Topic: gles2.0 in GLWallpaperService  (Read 1890 times)

Offline ruspa

  • byte
  • *
  • Posts: 6
    • View Profile
gles2.0 in GLWallpaperService
« on: October 04, 2013, 06:03:32 pm »
Hi there, I successfully merged jpct-ae samples with GLWallpaperService and have my imported .3ds model rotating happily in my homescreen.
Now I want initialize and switch to opengl es2 and found this documentation http://www.jpct.net/wiki/index.php/OpenGL_ES_2.0_support

so I have to do something like this, somewhere:

Code: [Select]

mGLView = new GLSurfaceView(getApplication());   // don't know were to find mGLView..
mGLView.setEGLContextClientVersion(2);

[...]

frameBuffer = new FrameBuffer(/*gl,*/ w, h);    //existing line, commenting only the first parameter obviously blows up everything


the point is that using GLWallpaperService I cannot find any reference to "mGLView" in order to modify it. I think I looked everywhere stepping in debug and I din't see anything similar, so perhaps this might be a bad approach, or I'm just blindfolded...
Where can I get a hook to the mGLView using live wallpapers? Is this approach correct?

Sounds like GLWallpaperService is not based on GLSurfaceView.

Thanks :D
« Last Edit: October 04, 2013, 06:34:23 pm by ruspa »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: gles2.0 in GLWallpaperService
« Reply #1 on: October 04, 2013, 08:54:33 pm »
Maybe this part will do the trick:

Code: [Select]
public void setRenderer(GLSurfaceView.Renderer renderer) {
checkRenderThreadState();
if (mEGLConfigChooser == null) {
mEGLConfigChooser = new SimpleEGLConfigChooser(true, mEGLContextClientVersion);
}
if (mEGLContextFactory == null) {
mEGLContextFactory = new DefaultContextFactory(mEGLContextClientVersion);
}
if (mEGLWindowSurfaceFactory == null) {
mEGLWindowSurfaceFactory = new DefaultWindowSurfaceFactory();
}
mGLThread = new GLThread(renderer, mEGLConfigChooser, mEGLContextFactory, mEGLWindowSurfaceFactory, mGLWrapper);
mGLThread.start();
}

It seems to set the mEGLContextClientVersion in the constructor of the DefaultContextFactory. Looks like the place to modify for GL 2.0 to me.