Reputation: 143
I have a texture, bound to GL_TEXTURE_EXTERNAL_OES target
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
How can rebind it to GL_TEXTURE_2D target?
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
provides error
Upvotes: 2
Views: 3551
Reputation: 473174
You can't. The texture target is a fundamental part of the texture object. If you have an external texture, you cannot treat it like a GL_TEXTURE_2D
. At all.
This means if you want to bind it, you must bind it as a GL_TEXTURE_EXTERNAL_OES
texture. If you want to use it in a sampler, that sampler must be of type samplerExternalOES
rather than sampler2D
(and your shader must enable the appropriate extension). And so forth.
Upvotes: 3