tags:

views:

161

answers:

1

That's what the Dalvik LogCat is saying whenever I uncomment the last line, below. So somewhere along the way, a current context isn't being created at all. Why? Thanks for any help.

final EGL10 egl = (EGL10) EGLContext.getEGL();
final EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
egl.eglInitialize(eglDisplay, version);

int[] configSpec = { 
EGL10.EGL_NONE
}; 

final EGLConfig[] config = new EGLConfig[1]; 
int num_configs[] = new int[1]; 
egl.eglChooseConfig(eglDisplay, configSpec, config, 1, num_configs); 

final EGLContext eglContext = egl.eglCreateContext(eglDisplay, config[0], EGL10.EGL_NO_CONTEXT, null); 
final GL10 gl = (GL10) eglContext.getGL(); 

int b[] = new int[w * (h)];
IntBuffer ib = IntBuffer.wrap(b);
ib.position(0);
gl.glReadPixels(w, 0, w, h, GL10.GL_RGB,GL10.GL_UNSIGNED_BYTE, ib);
+1  A: 

You should use EGL.eglMakeCurrent before calling any OpenGL functions. This will make the context current in the thread.

Matias Valdenegro
Thanks for helping me Matias. I have a question about this: In order to obtain a 'window' arg to use in EGL.eglMakeCurrent, I have to obtain that 'window' value returned by eglCreateWindowSurface(display, config, native_window, attrib_list). My question is: what is native_window, and where do I obtain that from?