Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Eugine

#1
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!