Reputation: 311
Just a quick question: I'm using a shader that admits a video as a GL_TEXTURE_EXTERNAL_OES from a SurfaceTexture, but now I want to modify it to accept two videos as 2 GL_TEXTURE_EXTERNAL_OES from two different SurfaceTextures.
Is there a way to do this? I'm following this code as an example: https://github.com/mstorsjo/android-decodeencodetest/tree/master/src/com/example/decodeencodetest and I'm trying to do:
int[] textures = new int[2];
GLES20.glGenTextures(2, textures, 0);
mTexture1ID = textures[0];
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTexture1ID);
checkGlError("glBindTexture mTexture1ID");
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_NEAREST);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
GLES20.GL_LINEAR);
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);
checkGlError("glTexParameter");
mTexture2ID = textures[1];
GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 2);
checkGlError("glBindTexture mTexture2ID");
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER,
GLES20.GL_NEAREST);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER,
GLES20.GL_LINEAR);
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);
checkGlError("glTexParameter");
But I haven't been able to make it work, I didn't have too much hope in this code though xD. Anyway, I'd thank any kind of help.
Upvotes: 1
Views: 637
Reputation: 311
Allright, for anyone who arrives to this question, refer to this:
https://software.intel.com/sites/landingpage/mmsf/documentation/mmsf_android_example3.html
It is possible to use more than one external texture in a shader.
Upvotes: 1