android - Record opengl fbo made with c++ with java MediaCodec -
i'm trying record contents of fbo create , fill in c++ mediacodec java object.
i understand need surface mediacodec , draw on frag shader, i'm trying feed c++ fbo uniform shader.
at moment can write video , if draw pixels red shader got red clip, ok on shader=>surface=>mediacodec side.
to use fbo i'm passing glunit of texture of fbo java side jni function, , seems ok, got noise, not initializated texture.
so question is: in way possible use texture done c++ input uniform gles2 java shader?
and if yes, correct flow so?
to clarify, i'm doing in glsurfaceview.renderer class:
@override public void onsurfacecreated(gl10 gl, eglconfig config) { log.i("of","onsurfacecreated"); ofandroid.onsurfacecreated(); try{ ((ofactivity)ofandroid.getcontext()).onglsurfacecreated(); }catch(exception e){ log.e("of","couldn call onglsurfacecreated",e); } return; } @override public void onsurfacechanged(gl10 gl, int w, int h) { this.w = w; this.h = h; if(!setup && ofandroid.unpackingdone){ try { setup(); } catch (ioexception e) { e.printstacktrace(); } } ofgesturelistener.swipe_min_distance = (int)(math.max(w, h)*.04); ofgesturelistener.swipe_max_distance = (int)(math.max(w, h)*.6); ofandroid.resize(w, h); mrenderfbo = new renderfbo( 800, 800, msrftexid); mfbotexid = mrenderfbo.getfbotexid(); glutil.checkglerror("onsurfacecreated_e"); } @override public void ondrawframe(gl10 gl) { if(setup && ofandroid.unpackingdone){ ofandroid.render(); if (mrendersrftex != null) { mrendersrftex.draw(); } glutil.checkglerror("ondrawframe_e render srf tex"); }else if(!setup && ofandroid.unpackingdone){ try { setup(); } catch (ioexception e) { e.printstacktrace(); } }else{ gl.glclear(gl10.gl_color_buffer_bit); gl.glclearcolor(.5f, .5f, .5f, 1.f); } } public void setrecorder(myrecorder recorder, int mytexid) { texid = mytexid; synchronized(this) { if (recorder != null) { mrendersrftex = new rendersrftex( 800, 804, mytexid, recorder); } else { mrendersrftex = null; } } }
where mytexid gluint pass c++ java jni, containing gluint of fbo texture.
for reference classes myrecorder , rendersrftex see classes @ https://github.com/morihirosoft/android_mediacodectest/tree/master/mediacodectest18/src/jp/morihirosoft/mediacodectest18
and here sources of relevant part of framework, https://github.com/openframeworks/openframeworks/blob/master/addons/ofxandroid/ofandroidlib/src/cc/openframeworks/ofandroidwindow.java
the answer absolutely yes, it's possible pass via gluint textureid c++ java, , here there solution record openframeworks offbo mediacodec https://github.com/rcavazza/openframework-android-recording. fadden useful answers.
Comments
Post a Comment