libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
145 stars 48 forks source link

Play a video using modelInstance #50

Closed suhaibroomy closed 7 years ago

suhaibroomy commented 7 years ago

I want to manage the texture using model instance as it manages the transforms and all. I figured I can achieve this if i can play it on the GLTexture instance instead of the Android Texture. But I can't figure out a way to replace android Texture with GLTexture of libGDX. Android's Media Player requires a Surface in which we can pass a SurfaceTexture but not GLTexture.

 private int[] textures = new int[1];
 GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);
 player.setSurface(new Surface(new SurfaceTexture(textures[0])));

Any help would be appreciated

RBogie commented 7 years ago

I would say that it isn't feasible. The amount of performance needed to copy the texture over on 30fps would make it painfully slow. Therefore I would recommend against trying something like this.

Instead, just get the transform matrix of the model instance, and use that for the video transform.