android - Overlaying a bitmap on the frame using Mediacodec and OpenGL-es -
i have successfuly decoded video , encoded again based on https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/decodeeditencodetest.java uses texturerenderer based on https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/texturerender.java
now change de drawframe
function overlay bitmap. tried both using glutils.textsubimage2d
, glutils.textimage2d
, both returns glerror=1280. newbie opengl-es, , i'd appreciate if advice me or tell me how overlay bitmap. have seen article: http://www.jayway.com/2010/12/30/opengl-es-tutorial-for-android-part-vi-textures/ guess have use created texture glutils.textsubimage2d
. should change renderer framebuffer in https://github.com/google/grafika/blob/master/src/com/android/grafika/recordfboactivity.java uses gles20.gl_texture_2d
instead of gles11ext.gl_texture_external_oes
? me please? thanks
public void drawframe(surfacetexture st) { checkglerror("ondrawframe start"); st.gettransformmatrix(mstmatrix); gles20.glclearcolor(0.0f, 1.0f, 0.0f, 1.0f); gles20.glclear(gles20.gldepthbufferbit | gles20.glcolorbufferbit); // select program. gles20.gluseprogram(mprogram); checkglerror("gluseprogram"); // set texture. gles20.glactivetexture(gles20.gltexture0); gles20.glbindtexture(gles11ext.gltextureexternaloes, mtextureid); mtrianglevertices.position(triangle_vertices_data_pos_offset); gles20.glvertexattribpointer(mapositionhandle, 3, gles20.glfloat, false, triangle_vertices_data_stride_bytes, mtrianglevertices); checkglerror("glvertexattribpointer maposition"); gles20.glenablevertexattribarray(mapositionhandle); checkglerror("glenablevertexattribarray mapositionhandle"); mtrianglevertices.position(triangle_vertices_data_uv_offset); gles20.glvertexattribpointer(matexturehandle, 2, gles20.glfloat, false, triangle_vertices_data_stride_bytes, mtrianglevertices); checkglerror("glvertexattribpointer matexturehandle"); // enable "aposition" vertex attribute. gles20.glenablevertexattribarray(matexturehandle); checkglerror("glenablevertexattribarray matexturehandle"); android.opengl.matrix.setidentitym(mmvpmatrix, 0); // copy model / view / projection matrix over. gles20.gluniformmatrix4fv(mumvpmatrixhandle, 1, false, mmvpmatrix, 0); gles20.gluniformmatrix4fv(mustmatrixhandle, 1, false, mstmatrix, 0); // draw rect. gles20.gldrawarrays(gles20.gltrianglestrip, 0, 4); checkglerror("gldrawarrays"); glutils.texsubimage2d(gles11ext.gltextureexternaloes, 0, 0, 0, bitmap, gles20.glrgb, gles20.glunsignedbyte); //glutils.teximage2d(gles11ext.gltextureexternaloes, 0, bitmap, 0); checkglerror("texsubimage2d"); gles20.glfinish(); }
Comments
Post a Comment