Skip to content

Commit f2000ad

Browse files
committed
properly create frame buffers
Signed-off-by: Umair Khan <[email protected]>
1 parent 4107ec6 commit f2000ad

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/in/omerjerk/processing/video/android/Capture.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.hardware.Camera.Size;
1111
import android.opengl.GLES11Ext;
1212
import android.opengl.GLES20;
13+
import android.opengl.GLES30;
1314
import android.opengl.GLSurfaceView;
1415
import android.os.Handler;
1516
import android.os.Message;
@@ -294,6 +295,7 @@ public void prepareFrameBuffers() {
294295
GLES20.GL_RENDERBUFFER, renderBuffers.get(0));
295296
GlUtil.checkGlError("glFramebufferRenderbuffer");
296297

298+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, appletTexture.glName);
297299
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 1080, 1920, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
298300
GlUtil.checkGlError("glTexImage2D");
299301

@@ -302,16 +304,17 @@ public void prepareFrameBuffers() {
302304
GLES20.GL_TEXTURE_2D, appletTexture.glName, 0);
303305
GlUtil.checkGlError("glFramebufferTexture2D");
304306

307+
/*
308+
//No sure if this is required in opengl 2. Ignoring as of now.
309+
IntBuffer drawBuffers = IntBuffer.allocate(1);
310+
drawBuffers.put(0, GLES20.GL_COLOR_ATTACHMENT0);
311+
GLES30.glDrawBuffers(1, drawBuffers);
312+
*/
313+
305314
// See if GLES is happy with all this.
306315
int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
307316
if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
308317
throw new RuntimeException("Framebuffer not complete, status=" + status);
309318
}
310-
311-
GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
312-
GlUtil.checkGlError("glActiveTexture GLES20.GL_TEXTURE1");
313-
314-
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureId);
315-
GlUtil.checkGlError("glBindTexture GLES11Ext.GL_TEXTURE_EXTERNAL_OES");
316319
}
317320
}

0 commit comments

Comments
 (0)