hi…my name oki and i came from indonesia…
i'm a really newbie in jmonkey…
i've tried to learn about this topic…but i still have problem…
the main problem is…
the JMF/FOBS/jME video renderer is using jme 1…right…?
and how to convert it to jme 2.0…?
i've tried to make some changes according this site http://www.jmonkeyengine.com/jmeforum/index.php?topic=8705.0
but i still got some error…
can anyone give me the complete code of jfjr in jme2.0 version…??
thank you so much…
I never ported this over to jME 2, cause I haven't used jME 2 for any project yet. It shouldn't be too hard I think. What is your specific problem?
tengkyu so much for your response, llama…
in jme 1 it's run smoothly…
i had follow the instruction to convert jme 1 to jme through this tutorial too ( http://www.jmonkeyengine.com/wiki/doku.php?id=jme_to_jme2_changes ), but it still didn't work…
from TestJMFVideoImage.java i've got error message from this line:
tex.setImage(image)
and also in JMFVideoImage.java i've got error message too…
data = ByteBuffer.allocateDirect(sizessizes4).order(ByteOrder.nativeOrder());
with error
incompartible types
found java.nio.ByteBuffer
required: java.util.ArrayList<>"
but if i add "import java.util.ArrayList". it become unused import… :?
also, when i tried to run this program, they got error meassage…
run:
Mar 7, 2009 9:16:44 AM com.jme.app.BaseGame start
INFO: Application started.
Mar 7, 2009 9:16:44 AM com.jme.system.PropertiesGameSettings <init>
INFO: PropertiesGameSettings created
Mar 7, 2009 9:16:44 AM com.jme.system.PropertiesGameSettings load
INFO: Read properties
Mar 7, 2009 9:17:16 AM com.jme.system.PropertiesGameSettings save
INFO: Saved properties
Mar 7, 2009 9:17:16 AM com.jme.app.BaseSimpleGame initSystem
INFO: jME version 2.0 Stable (r4093)
Mar 7, 2009 9:17:16 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Mar 7, 2009 9:17:16 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W: 640H: 480 Version: 2.0.1
Mar 7, 2009 9:17:17 AM com.jme.app.BaseSimpleGame initSystem
INFO: Running on: igxprd32
Driver version: 6.14.10.4906
Intel - Intel 945GM - 1.4.0 - Build 7.14.10.4906
Mar 7, 2009 9:17:17 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Mar 7, 2009 9:17:17 AM com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
Mar 7, 2009 9:17:17 AM com.jme.scene.Node <init>
INFO: Node created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Node <init>
INFO: Node created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Node <init>
INFO: Node created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Node attachChild
INFO: Child (Graph node) attached to this node (Stats node)
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLTextureRenderer <init>
WARNING: FBO not supported.
Mar 7, 2009 9:17:17 AM com.jme.system.lwjgl.LWJGLDisplaySystem createTextureRenderer
INFO: FBO not supported, attempting Pbuffer.
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer setMultipleTargets
INFO: Copy Texture Pbuffer supported!
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer <init>
INFO: Creating Pbuffer sized: 1024 x 512
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer initCamera
INFO: Init RTT camera
Mar 7, 2009 9:17:17 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Node <init>
INFO: Node created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Line <init>
INFO: Line created.
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer setupTexture
INFO: setup tex2: 1024,512
Mar 7, 2009 9:17:17 AM com.jme.scene.Node attachChild
INFO: Child (lineGraph) attached to this node (Graph node)
Mar 7, 2009 9:17:17 AM com.jme.scene.Node attachChild
INFO: Child (f4) attached to this node (Graph node)
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLTextureRenderer <init>
WARNING: FBO not supported.
Mar 7, 2009 9:17:17 AM com.jme.system.lwjgl.LWJGLDisplaySystem createTextureRenderer
INFO: FBO not supported, attempting Pbuffer.
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer setMultipleTargets
INFO: Copy Texture Pbuffer supported!
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer <init>
INFO: Creating Pbuffer sized: 1024 x 128
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer initCamera
INFO: Init RTT camera
Mar 7, 2009 9:17:17 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Mar 7, 2009 9:17:17 AM com.jme.scene.Node <init>
INFO: Node created.
Mar 7, 2009 9:17:17 AM com.jme.renderer.lwjgl.LWJGLPbufferTextureRenderer setupTexture
INFO: setup tex3: 1024,128
Mar 7, 2009 9:17:17 AM com.jme.scene.Node attachChild
INFO: Child (labelGraph) attached to this node (Graph node)
Fobs4JMF - Native shared library found
5.07173First Position: 466, 34 Duration: 5071
Frame Rate: 29.97
Opening Thread[JMF thread: com.sun.media.PlaybackEngine@9ced8e[ com.sun.media.PlaybackEngine@9ced8e ] ( configureThread),9,system]
ByteBufferRenderer: setInputFormat
Format (RGB masks, pixelstride, linestride, bbp, flipped
ff0000
ff
ff00
1
352
32
false
set Size: 352 240
texture format: GL_UNSIGNED_INT_8_8_8_8_REV
FOBS found
Frame buffer size (bytes): 337920
ByteBufferRenderer: setInputFormat
Format (RGB masks, pixelstride, linestride, bbp, flipped
ff0000
ff
ff00
1
352
32
false
set Size: 352 240
FOBS found
Frame buffer size (bytes): 337920
Created player for: file:F:/kacau/ChiasaAonuma.MPG
Mar 7, 2009 9:17:18 AM com.jme.scene.Node attachChild
INFO: Child (quad) attached to this node (rootNode)
using flipped quad
Mar 7, 2009 9:17:18 AM class TestJMFVideoImage.TestJMFVideoImage start()
SEVERE: Exception in game loop
java.lang.NullPointerException
at com.jme.scene.state.lwjgl.LWJGLTextureState.load(LWJGLTextureState.java:486)
at com.jme.scene.state.lwjgl.LWJGLTextureState.apply(LWJGLTextureState.java:881)
at com.jme.renderer.lwjgl.LWJGLRenderer.applyStates(LWJGLRenderer.java:1725)
at com.jme.renderer.lwjgl.LWJGLRenderer.draw(LWJGLRenderer.java:961)
at com.jme.scene.TriMesh.draw(TriMesh.java:240)
at com.jme.scene.Spatial.onDraw(Spatial.java:428)
at com.jme.scene.Node.draw(Node.java:520)
at com.jme.scene.Spatial.onDraw(Spatial.java:428)
at com.jme.renderer.lwjgl.LWJGLRenderer.draw(LWJGLRenderer.java:1202)
at com.jme.app.SimpleGame.render(SimpleGame.java:81)
at com.jme.app.BaseGame.start(BaseGame.java:87)
at TestJMFVideoImage.TestJMFVideoImage.main(TestJMFVideoImage.java:142)
Mar 7, 2009 9:17:18 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Mar 7, 2009 9:17:18 AM com.jme.app.BaseGame start
INFO: Application ending.
BUILD SUCCESSFUL (total time: 34 seconds)
maybe if you wanna see my complete code (that frustated me :'( ) upload in here
http://www.mediafire.com/file/iumoymbvnje/src.rar
tengkyu so much..
Looks like these are basic Java errors, not a problem with jME.
Are you set now Quaddro?
I would love to see this in JME2.0!
much love for the 1.0 version
Hi llama,
thank you for your JFjr. I looked into your code and there you are using lwjgl to update the texture with new buffer data. Then I read your thought here
llama said:
I guess jME should support updateable textures anyway, rather than hackin' it in with LWJGL everytime. So I guess I got myself a task there.
and I would like to know whether meanwhile there are improvements for doing that (as meanwhile jME can use different renderers)?
One renderer-independent approach, I found here, is
buffer -> BufferToImage -> java.awt.Image -> ImageGraphics.drawImage(...);
ImageGraphics.update(texture)
which is said to be slow.
Before I decided to use jME I implemented a simple JOGL-Renderer and updated the texture by textureData.setBuffer(...). Something similar seems to be possible in connection with com.jme.image.Image
image = new Image(..., null);
texture.setImage(image);
...
// then updating with the real buffer
image.setData(0, buffer);
// necessary?
//texture.setImage(image);
But with this approach I get only a black screen (though I haven't tested it thoroughly :D). Do you think it would work in that way with com.jme.image.Image?
ImageGraphics uses the same "hack", updating the texture directly with LWJGL calls (and I guess there is a JOGL version too now in 2.0?). setData doesn't update the texture, it just sets the data used to create the texture.
The code for doing this is already in JFjr. Just needs to be updated to 2.0.
Like I said, ideally jME should support updating textures, but using the same construction as ImageGraphics (allowing for both LWJGL and JOGL and other implementations) would be good too.
Yes, ImageGraphics is conditionally JOGLImageGraphics or LWJGLImageGraphics (whereas these classes are not documented yet).
llama said:
Like I said, ideally jME should support updating textures, but using the same construction as ImageGraphics (allowing for both LWJGL and JOGL and other implementations) would be good too.
OK. Yes, it would be more convenient I if one could set the buffer directly without BufferToImage and creating new awt images all the time.
I looked at ImageGraphicsBaseImpl.update() and there the buffer data is being read out from the awt images that are passed to/displayed by ImageGraphics.drawImage(...).
It is a sort of detour. Do we need here ImageGraphics only for this purpose (read data from currently drawn awt image) or is the image really drawn/displayed somewhere (by drawImage(...))?
I tried this to bypass the draw-stuff:
public void simpleSetup() {
...
imageGraphics = ImageGraphics.createInstance(width, height, 0);
imageGraphics.setClip(0, 0, width, height);
texture = new Texture2D();
// get the graphics image
image = imageGraphics.getImage();
texture.setImage(image);
...
}
private void simpleUpdate() {
...
image.setData(0, byteBuffer);
imageGraphics.update(texture, true);
...
}
but I get errors, because I draw no awt images, but ImageGraphicsBaseImpl.update() is called inside ImageGraphics.html.update(Texture, boolean).
It also mess up buffer lengths, because awtImage in ImageGraphicsBaseImpl is defined as BufferedImage.TYPE_4BYTE_ABGR and the byteBuffer may vary.
Well, all in all I will work with the ImageGraphics approach.
ImageGraphics is for AWT images, I would suggest avoiding it for video, and just reimplementing what JFjr does in jME 1. Possibly using the same "implementation" pattern so that it will work for both JOGL and LWJGL, but I'd start by just making it work again.
Hey llama,
I analysed JOGLImageGraphics.update(Texture, boolean) and this approach works fine (it is similar to the approach I had with JOGL, like mentioned above):
public void simpleSetup() {
...
// Arbitrary buffer with the same size. Can be the same buffer.
buffer = BufferUtils.createByteBuffer(bufferSize);
// Mind the proper image format
image = new Image(..., buffer);
...
}
private void simpleUpdate() {
...
if (texture.getTextureId() == 0) {
// Texture that has not yet been sent to the OpenGL drivers, so I will get errors with this.
return;
}
image.setData(0, buffer);
// Renderer-generic, though I tested it only with JOGLRenderer
//renderer = DisplaySystem.getDisplaySystem().getRenderer();
renderer.updateTextureSubImage(texture, 0, 0, image, 0, 0, width, height);
...
}
Didn't know there was a renderer.updateTextureSubImage in JME2
Me either.
Hm, I let it run and from time to time I get this weird error. Must be something with my graphics card driver.
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x694b00cf, pid=6208, tid=6448
#
# Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode, sharing windows-x86)
# Problematic frame:
# C [atioglxx.dll+0x4b00cf]
#
# An error report file with more information is saved as:
# hs_err_pid6208.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Did you look in the full logs? Maybe we can narrow it down to a single opengl method.
It says:
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [atioglxx.dll+0x4b00cf]
[error occurred during error reporting (printing native stack), id 0xc0000005]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J com.sun.opengl.impl.GLImpl.glTexSubImage2D0(IIIIIIIILjava/lang/Object;I)V
J com.sun.opengl.impl.GLImpl.glTexSubImage2D(IIIIIIIILjava/nio/Buffer;)V
J javax.media.opengl.DebugGL.glTexSubImage2D(IIIIIIIILjava/nio/Buffer;)V
J com.jme.renderer.jogl.JOGLRenderer.updateTextureSubImage(Lcom/jme/image/Texture;IILcom/jme/image/Image;IIII)V
...
But as a test I had it running for 1h 30min (aborted manually) without errors, hm :?
EDIT: I did some research and it seems to be an ATI issue.
(I had jogl as a library on my project build path, now I linked to the jogl.jar that comes with jME. Btw: Why are there no native libs for jogl (jogl.dll etc) included?)
Maybe Im confused, but there are JOGL natives in jME under lib/jogl/native/<OS>
@basixs: In the svn repository I see these files, but they are missing in the downloadable jME_2.0_Complete_(r4093).zip (in libnatives) :?
Hmm, I see that now; I can't just include them because there are 5 versions and they all have the same names (no _64 in lib name). Give me a little while and I will see what I can do…
In the meantime please just get the needed natives from the SVN.
OK, thank you!
A question: Will this be ported to JME2.0?
I was not able to port it.