This quick EGL10#eglGetCurrentDisplay test seems to work fine in my
renderer's onSurfaceCreated:
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay currentDisplay = egl.eglGetCurrentDisplay();
int[] attribValue = new int[1];
egl.eglGetConfigAttrib(currentDisplay, config, EGL10.EGL_BUFFER_SIZE,
attribValue);
if ( LOG ) Log.i(LOG_TAG, String.format("EGL_BUFFER_SIZE = %d",
attribValue[0]));
I haven't tried it, but getting the current context would be similar:
EGLContext currentContext = egl.eglGetCurrentContext();
I can see GLSurfaceView#createSurface making this call before the
renderer's onSurfaceCreated is called:
>mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
> mEglContext);
So I assume it is set.
On Dec 21, 10:42 pm, Robert Green <[email protected]> wrote:
> Maybe someone can explain this to me:
>
> I've been trying to figure out how to get to the current EGLContext
> from the GLSurfaceView. I looked at the APIs and looked at the code
> but it doesn't seem like there is any path to it. I could have just
> missed it - please correct me if I have, but it wasn't obvious. Now,
> I can totally understand the designer thinking that we should protect
> people from the context because they can cause bad things to happen
> but actually it would be nice to have access to swapbuffers so that we
> can do some effects. Fair enough, though.
>
> The one thing I wanted was to see the current EGLConfig so that I
> could find out what config attributes I'm getting on weirdly-behaving
> devices like the Galaxy. It seemed easy enough - it's passed in to
> Renderer in the onSurfaceCreated method:
>
> public void onSurfaceCreated(GL10 gl, EGLConfig config);
>
> Great! Except wait, you can't query an EGLConfig without an
> EGLDisplay and that's locked up in the GLSurfaceView. So why is it
> passed in to the surface created method? Isn't it useless? Accord to
> GLES spec, an instance of EGLConfig is only good if you have the
> display/context instances that it was created from.
>
> I didn't try querying it with the default context because it's
> supposedly invalid but perhaps someone could shed some light on this?
> I'd love if it were something dumb and obvious that I don't know
> about.
>
> Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en