I’m using Riven’s (from JGO) video player for java, and I am getting each frame of video on a BufferedImage. The only thing is the image is of the type: BufferedImage.TYPE_3BYTE_BGR
I then do
AWTLoader loader = new AWTLoader();
Image img = loader.load(buf, true);
Texture2D tex = new Texture2D(img);
To get it in the form of a texture2d. The result is a somewhat purple looking image. I noticed Texture2D can be set to a type in the constructor, but not if you use the constructor I am. What can I do to get it looking right without it being slow?
Here’s a lil pic of the video’s colors, left in jme and right as they should be
Do it on shader’s code, it would be much more efficient than any conversion in java code. Set an custom material for the object you are using to show the video on screen, just copy and rework the default one: Common/MatDefs/Gui/Gui.j3md
In your version of .frag file do:
gl_FragColor = texVal.bgra * color;
This will swap the colors.
By the way - converting each frame into an texture is a bad idea. Do you get an buffer with data in some event? If so, just copy it into an existing Texture buffer. You just need to have an texture with the same width/height and bpp as your player.