开发者

"call to OpenGL ES API with no current context"

开发者 https://www.devze.com 2023-01-09 14:27 出处:网络
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.

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(eglDisp开发者_StackOverflow中文版lay, 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);


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号