I'm getting troubles trying to create an animated texture from a camera source. I'm getting a byte buffer from the camera and i wanna put it as the texture of a Quad.
I haven't got it.
I've tried next things:
Create a BufferedImage from java.awt.image and update its Raster's DataBuffer in the simpleUpdate() and loadTexture(Image…) from TextureManager, but it doesn't work.
Create a jme Image using the data buffer got from the camera and creating a java.nio.ByteBuffer for that image. that ByteBuffer is also updated in the simpleUpdate() method.
I tried with LWJGLImageGraphics, but it paint the image once and the screen get totally black and the framerate goes down.
I tried with the link you gave me, but i couldn't understand it, i don't know so much opengl. The most I worked before was Java3D and I'm migrating to jME.
Look, I need either put the camera stream in a backgroud Quad or directly in the screen background.
I saw how to do it with JOGL but I don't know if a can access in that way with jME
The source in that thread shows how to acces the texture directly through OpenGL (LWJGL instead of JOGL in this case)… just look inside the JMFVideoImage class in that thread.
bit. You'll have to read up a bit on OpenGL to understand what it does of course.
That said, if you're properly painting on the ImageGraphics class, that should also work. I think there's something wrong missing in your code there, because many others have used this class, and in jME it's also used to draw entire Swing windows on it. In fact, if you really can't get it to work you can always try building a regular Swing panel that does your cam stuff and use that with JMEDesktop
I cann't use JMF for getting video stream. I'm using a C library and I cannot change to JMF.
The C library has a java binding call FrameGrabber, it return a int[] each grabFrame() call.
I havn't undestood FOB code really much, is there any simple way to paint the pixels in the int[] array to the screen background ???
I'm really sorry for being so bother with you. But you don't know the difficult that is for me either undestand and write English because I talk Spanish.
I wasn't suggesting you change to JMF, I was just pointing out that it shows how to access a texture.
I don't get your example though… you create an ImageGraphics, but you don't use it anywhere!? You have to create a texture that uses the ImageGraphics. Maybe you should start with some of the jME tutorials to get the basics of what a scenegraph is, and how jME works.