GLES2.0: use GL_TEXTURE_EXTERNAL_OES via glEGLImageTargetTexture2DOES

I would like to make an image buffer in Java (in this case, the NDK is not an option) and pass it to the shaders via GL_TEXTURE_EXTERNAL_OES .

glTexImage2D does not work as specified in spec . But the glEGLImageTargetTexture2DOES function is only available through the GLES11Ext class, which seems incorrect to use.

Anyway, I tried, and this gives me GL_INVALID_OPERATION what should happen if:

If GL cannot specify a texture object using the supplied eglImageOES (if, for example, it refers to multisampling eglImageOES), an INVALID_OPERATION error is generated.

Unfortunately, I cannot make heads or tails from this description, especially since the Java Java API does not seem to give me access to eglImageOES functions. I also did not find a Java example to use this function.

Attached a small example:

 // Bind the texture unit 0 GLES20.glActiveTexture( GLES20.GL_TEXTURE0 ); throwOnError( "glActiveTexture" ); GLES20.glBindTexture( GL_TEXTURE_EXTERNAL_OES, _samplerLocation ); throwOnError( "glBindTexture" ); // _output is ByteBuffer.allocateDirect(pixels * Integer.SIZE / Byte.SIZE).order(ByteOrder.nativeOrder()).asIntBuffer() _output.rewind(); _output.limit( pixels ); GLES11Ext.glEGLImageTargetTexture2DOES( GL_TEXTURE_EXTERNAL_OES, _output ); throwOnError( "glEGLImageTargetTexture2DOES" ); // <-- throws GLES20.glDrawArrays( GLES20.GL_TRIANGLE_STRIP, 0, 4 ); throwOnError( "glDrawArrays" ); 

Has anyone done this before or knew if this was possible or not?

EDIT:

I looked at the implementation of glEGLImageTargetTexture2DOES , and it seems to me that I should configure the buffer correctly. This error has been added, but still the same.

+6
source share
1 answer

There are some comments on this page that may help: http://developer.android.com/reference/android/graphics/SurfaceTexture.html

0
source

All Articles