so I wrote a little Libgdx Showcase for this.
one thing I have learned: we never set the projection matrix, so I added
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, Gdx.graphics.getWidth(), 0, Gdx.graphics.getHeight());
glTranslatef(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2, 0.0f);
glScalef(1.0f, -1.0f, 1.0f);
glTranslatef(-Gdx.graphics.getWidth()/2, -Gdx.graphics.getHeight()/2, 0.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
otherwise we have this identity mode with -1f -> 1f instead of pixels
again, not an opengl expert.
which brings me to my next point: using the spritebatch before of after rendering the video doesnt seem to work and you end up seeing nothing
obviously they conflict and it could have various reasons and depends on how the spritebatch works exactly…
people may wanna have a video in the background and draw something on top, so we gotta fix that somehow
So it only works like this:
if (videoplayer != null)
{
if(!videoplayer.isDone())
{
videoplayer.updateAndRender(false);
}
else
{
videoplayer.destroy();
videoplayer = null;
}
}
else
{
spriteBatch.begin();
font.setColor(Color.WHITE);
font.draw(spriteBatch, "FPS: "+Gdx.graphics.getFramesPerSecond(), 12, 20);
spriteBatch.end();
}
We are rendering a quad for the video and then want to being a spritebatch… so it could have something to do that we have to flush to GPU first before rendering something else
might only need a minor fix, imo