user225626
user225626

Reputation: 1099

"call to OpenGL ES API with no current context"

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);

Upvotes: 2

Views: 12905

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56387

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

Upvotes: 4

Related Questions