相关文章推荐
好帅的苦咖啡  ·  uncaught (in promise) ...·  1 年前    · 
健身的莴苣  ·  az staticwebapp ...·  1 年前    · 

GLES2.0。通过glEGLImageTargetTexture2DOES使用GL_TEXTURE_EXTERNAL_OES

7 人关注

我想在 爪哇 ( NDK 在这种情况下没有选项)并通过 GL_TEXTURE_EXTERNAL_OES 将其传递给着色器。

替换代码1】不起作用,正如在《中国的世界》中提到的。 spec .但是函数 glEGLImageTargetTexture2DOES 只能通过 GLES11Ext 类来使用,这似乎有点错误。

总之,我试了一下,它给我的是 GL_INVALID_OPERATION ,这应该发生在:。

如果GL无法使用提供的 eglImageOES(例如,如果是指一个多采样的 eglImageOES),就会产生INVALID_OPERATION错误。

Sadly I cannot make heads or tails from this description, especially since the Android 爪哇 API doesn't seem to give me access to eglImageOES functions. Neither have I found a 爪哇 该函数的使用方法请参见示例。

附上一个小例子。

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

有没有人以前做过,或者知道这是否可行?

EDIT: