Use 'setExternalID' to show videofile on polygon?

Started by Eugine, January 05, 2018, 09:50:24 PM

Previous topic - Next topic

Eugine

Hi everyone, I have a project that need to achieve the following requirements :
     1. 3D object above Video
     2. Video must be texture (Like texture on rectangle...)

I would like to display my video on polygon (as texture) and put 3d models on top of it.
I displayed a 3D object on the screen.

And then, I made another texture,


            GLES20.glGenTextures(1, textures, 0);
            mTextureID = textures[0];
            Log.d("textureNum",mTextureID+""); // just for debug
            GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID);
            GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES,GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
            GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES,GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);

            mSurface = new SurfaceTexture(mTextureID);
            mSurface.setOnFrameAvailableListener(this);


            Surface surface = new Surface(mSurface);

            mMediaPlayer = new MediaPlayer();

            if (file != null) {
                try {
                    mMediaPlayer.setDataSource(file.getAbsolutePath());
                } catch (IllegalArgumentException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (SecurityException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } else if (filePath != null) {
                try {
                    mMediaPlayer.setDataSource(filePath);
                } catch (IllegalArgumentException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (SecurityException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            mMediaPlayer.setSurface(surface);
            //surface.release();

            video1.setExternalId(mTextureID,GL_TEXTURE_EXTERNAL_OES);
            TextureManager.getInstance().addTexture("video_Play",video1)


in onSurfaceCreated function.
And, I made an function to createPolygon

    public void createPolygon(){
        myPolygon = Primitives.getPlane(1,1);
        myPolygon.setCenter(SimpleVector.ORIGIN);
        myPolygon.rotateX((float)(.5f*Math.PI));

        myPolygon.setTexture("video_Play");
        myPolygon.strip();
        myPolygon.build();

    }


But, if i run app, then Polygon's texture is just same with texture using just before....
I can hear the sound of video file, but I can't see video file on polygon... :'(

This Link is the image when i run app.
https://drive.google.com/file/d/1FD2fc9QFXSkMJgsWudnZAK0O8XgNTzZc/view
Behind the 3Dobject, there is a Polygon with red texture(last texture used to draw 3D object), Not Video.

Is this a workable problem? Please give me some advice, thank you!

EgonOlsen

Can you verify that the texture actually has the external ID properly set and that it is a valid ID!?

Are you getting any log output of what's going on? You might as well set Config.glDebugLevel to 1 and post the (important) output here.

Eugine

#2
Quote from: EgonOlsen on January 08, 2018, 10:15:09 AM
Can you verify that the texture actually has the external ID properly set and that it is a valid ID!?

I added code like following,

Log.d("ExternalID","kFace.png = "+texture0.getExternalId()+", kFoot.png = "+texture1.getExternalId()+", video_Play = "+video1.getExternalId());

(kFace.png and kFoot.png are texture of 3D object, they don't have external ID)
and the result is,

01-08 18:58:57.634 16550-16592/? D/ExternalID: kFace.png = -1, kFoot.png = -1, video_Play = 1


so, I think the texture named "video_Play" has external ID... is it Right?

Quote from: EgonOlsen on January 08, 2018, 10:15:09 AM
Are you getting any log output of what's going on? You might as well set Config.glDebugLevel to 1 and post the (important) output here.

And, I added also this code,

Config.setParameterValue("glDebugLevel",1);


But, when i added this code, there are too many lines on Logcat.
It's almost like following,


...
1-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDrawElements(4, 6, 5123, 0) took 159114ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 0) took 5781ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 4011ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPopMatrix() took 5417ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2884) took 9531ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2896) took 3281ns
01-08 19:05:01.764 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2977) took 2917ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClearColor(0.19607845, 0.19607845, 0.3921569, 1.0) took 21718ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClear(16640) took 5789636ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5889) took 15989ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 7187ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glFrustumf(-0.625, 0.625, -0.9947917, 0.9947917, 1.0, 1000.0) took 11927ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2977) took 10365ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2896) took 4375ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2884) took 9532ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glActiveTexture(33984) took 7396ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindTexture(3553, 2) took 12917ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 4323ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPushMatrix() took 4271ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 4323ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightModelfv(2899, [F@2e0caf70, 0) took 6146ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialfv(1032, 5632, [F@197b02e9, 0) took 6146ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(16384) took 6511ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4611, [F@3d796b6e, 0) took 7604ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4609, [F@3d796b6e, 0) took 4531ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4608, [F@3082720f, 0) took 6771ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightf(16384, 4616, 0.0) took 6510ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialf(1032, 5633, 1.0) took 4687ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4610, [F@3082720f, 0) took 4271ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadMatrixf([F@2ce5529c, 0) took 9062ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32885) took 14687ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 1) took 12292ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glNormalPointer(5132, 12, 0) took 19896ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32884) took 6979ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 2) took 6563ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glVertexPointer(3, 5132, 12, 0) took 13542ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisableClientState(32886) took 15834ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClientActiveTexture(33984) took 6042ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32888) took 5312ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 3) took 5989ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glTexCoordPointer(2, 5132, 8, 0) took 11875ns
01-08 19:05:01.774 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 0) took 4635ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 4) took 5625ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDrawElements(4, 1056, 5123, 0) took 247240ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 0) took 16302ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 5469ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPopMatrix() took 5261ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glActiveTexture(33984) took 7448ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindTexture(3553, 3) took 11198ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 4947ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPushMatrix() took 3646ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 3958ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightModelfv(2899, [F@2e0caf70, 0) took 6510ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialfv(1032, 5632, [F@197b02e9, 0) took 6511ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadMatrixf([F@2ce5529c, 0) took 7708ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32885) took 13073ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 5) took 11354ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glNormalPointer(5132, 12, 0) took 12917ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32884) took 4323ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 6) took 5261ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glVertexPointer(3, 5132, 12, 0) took 9010ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisableClientState(32886) took 13542ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClientActiveTexture(33984) took 6042ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32888) took 5156ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 7) took 5781ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glTexCoordPointer(2, 5132, 8, 0) took 8698ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 0) took 4271ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 8) took 5260ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDrawElements(4, 492, 5123, 0) took 157813ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 0) took 5417ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 3854ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPopMatrix() took 5209ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glActiveTexture(33984) took 6250ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindTexture(36197, 1) took 8334ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 3646ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPushMatrix() took 3959ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 4166ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightModelfv(2899, [F@2e0caf70, 0) took 5938ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialfv(1032, 5632, [F@197b02e9, 0) took 5365ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(16384) took 6979ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4611, [F@3d796b6e, 0) took 5208ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4609, [F@3d796b6e, 0) took 4219ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4608, [F@3082720f, 0) took 3645ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightf(16384, 4616, 0.0) took 6406ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialf(1032, 5633, 1.0) took 4323ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4610, [F@3082720f, 0) took 5000ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadMatrixf([F@d42fc88, 0) took 7344ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32885) took 10052ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 9) took 10000ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glNormalPointer(5132, 12, 0) took 12291ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32884) took 4479ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 10) took 4844ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glVertexPointer(3, 5132, 12, 0) took 6927ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisableClientState(32886) took 11458ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClientActiveTexture(33984) took 6250ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32888) took 5156ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 11) took 6146ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glTexCoordPointer(2, 5132, 8, 0) took 9375ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 0) took 5156ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 12) took 7083ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDrawElements(4, 6, 5123, 0) took 176823ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34963, 0) took 8802ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 5261ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPopMatrix() took 5000ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2884) took 10521ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2896) took 3073ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glDisable(2977) took 3021ns
01-08 19:05:01.784 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClearColor(0.19607845, 0.19607845, 0.3921569, 1.0) took 20885ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glClear(16640) took 9418281ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5889) took 13854ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 5885ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glFrustumf(-0.625, 0.625, -0.9947917, 0.9947917, 1.0, 1000.0) took 10469ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2977) took 12709ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2896) took 3489ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(2884) took 9583ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glActiveTexture(33984) took 7656ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindTexture(3553, 2) took 14740ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMatrixMode(5888) took 4010ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glPushMatrix() took 3750ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadIdentity() took 4896ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightModelfv(2899, [F@2e0caf70, 0) took 5834ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialfv(1032, 5632, [F@197b02e9, 0) took 5312ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnable(16384) took 7396ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4611, [F@3d796b6e, 0) took 5000ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4609, [F@3d796b6e, 0) took 4062ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4608, [F@3082720f, 0) took 3750ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightf(16384, 4616, 0.0) took 6667ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glMaterialf(1032, 5633, 1.0) took 4427ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLightfv(16384, 4610, [F@3082720f, 0) took 4270ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glLoadMatrixf([F@2ce5529c, 0) took 9948ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32885) took 17031ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glBindBuffer(34962, 1) took 11458ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glNormalPointer(5132, 12, 0) took 13437ns
01-08 19:05:01.794 20103-20124/com.example.ekgkrha.videoastexture I/jPCT-AE: glEnableClientState(32884) took 6406ns
...


I couldn't find Error, Warn or Assert...

Eugine

#3
Opps, I just find Warn, Error Logcat when I started to run the app.
It is too fast so I coudn't find them..

They are like this

01-08 19:11:42.634 22963-22963/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
01-08 19:11:42.814 22963-22984/? E/MediaPlayer: Should have subtitle controller already set
01-08 19:11:42.814 22963-22963/? E/MediaPlayer: Should have subtitle controller already set
01-08 19:11:42.894 22963-22982/? W/MediaPlayer[Native]: info/warning (3, 0)
01-08 19:11:42.934 22963-22984/? W/jPCT-AE: [ 1515406302939 ] - WARNING: OpenGL vendor:     Qualcomm
01-08 19:11:42.934 22963-22984/? W/jPCT-AE: [ 1515406302939 ] - WARNING: OpenGL renderer:   Adreno (TM) 418
01-08 19:11:42.934 22963-22984/? W/jPCT-AE: [ 1515406302939 ] - WARNING: OpenGL version:    OpenGL ES 3.1 V@103.0 (GIT@I3c94fdbbc3)
01-08 19:11:42.934 22963-22984/? W/jPCT-AE: [ 1515406302939 ] - WARNING: OpenGL renderer initialized (using 2/16 texture stages)


Is this have any correlation with problem that texture do not displayed?
Still, I can hear the sound of videofile.

Eugine

#4
I tried new way, it doesn't work well but it results in different.
At first, I used onSurfaceChanged Like below,

public void onSurfaceChanged(GL10 glUnused, int width, int height) {
            if(fb!=null) fb.dispose();
            fb = new FrameBuffer(width, height);

            if(master==null) {
                world = new World();
                world.setAmbientLight(20, 20, 20);
                sun = new Light(world);
                sun.setIntensity(250, 250, 250);

                try {
                    //objKirby = loadModel(getAssets().open("kirby.3ds"), null, 1, LOAD_TYPE_3DS);
                    objKirby = loadModel(getAssets().open("kirby.obj"),getAssets().open("kirby.mtl"), 1f, LOAD_TYPE_OBJ);
                    Log.d("dd",video1.getExternalId()+",");
                    createPolygon(); // it's an function i wrote in first post

                } catch (IOException e) {
                    Log.d("main", "fnfe");
                }
                world.addObject(objKirby);
                world.addObject(myPolygon);

                Camera cam = world.getCamera();
                cam.setPosition(0, -2, 0);
                cam.lookAt(SimpleVector.ORIGIN);
                //cam.lookAt(objKirby.getTransformedCenter());

                sun.setPosition(cam.getPosition());
                MemoryHelper.compact();

                if(master == null) {
                    Logger.log("Saving master Activity!");
                    master = MainActivity.this;
                }
            }
        }

this result in red polygon(it is code used when I wrote first post, texture of polygon is same with last texture when used to draw 3d Object).

And, when I tried to just draw polygon, without 3D object,

public void onSurfaceChanged(GL10 glUnused, int width, int height) {
            if(fb!=null) fb.dispose();
            fb = new FrameBuffer(width, height);

            if(master==null) {
                world = new World();
                world.setAmbientLight(20, 20, 20);
                sun = new Light(world);
                sun.setIntensity(250, 250, 250);

                try {
                    //objKirby = loadModel(getAssets().open("kirby.3ds"), null, 1, LOAD_TYPE_3DS);
                    objKirby = loadModel(getAssets().open("kirby.obj"),getAssets().open("kirby.mtl"), 1f, LOAD_TYPE_OBJ);
                    Log.d("dd",video1.getExternalId()+",");
                    createPolygon();

                } catch (IOException e) {
                    Log.d("main", "fnfe");
                }
                //world.addObject(objKirby); Don't draw 3D object
                world.addObject(myPolygon);

                Camera cam = world.getCamera();
                cam.setPosition(0, -2, 0);
                cam.lookAt(SimpleVector.ORIGIN);
                //cam.lookAt(objKirby.getTransformedCenter());

                sun.setPosition(cam.getPosition());
                MemoryHelper.compact();

                if(master == null) {
                    Logger.log("Saving master Activity!");
                    master = MainActivity.this;
                }
            }
        }


Then, I can saw polygon with black color.
It is not same with last texture when used to draw 3d Object and also it is not the video.
Can this the clue of solve this problem??

EgonOlsen

Not sure...first  of all, the warning output of the driver and such doesn't mean anything. It's a warning so that it shows even if people configure the Logger class to be almost silent.

I've send a PM to raft, who did render some video onto a polygon. Maybe he can help. At first glance, your first approach looked fine to me but then again, I never really did this myself.

raft

yea, I did something similar in the past. this is the relevant thread

dont remember much about the details, though :)

and this demo project should contain some working code. by default it displays a panoramic video but rendering video to a texture should also be somewhere there.
http://aptalkarga.com/download/Cardboard.zip

Eugine

Thanks to EgonOlsen and raft. I solved problem now :)

Especially, the thread that raft talked to me and project of raft were really helpful to me!

And,
Quote from: raft on January 08, 2018, 05:55:18 PM
...by default it displays a panoramic video but rendering video to a texture should also be somewhere there.
this sentence gave hint to me.

I really appreciate you, EgonOlsen, raft.
I wish you have a good day!