PlayN java desktop version slower than web version? - java

so i've been playing with google PlayN, and i built a small sprite sheet loader for explosions.
what is weird thought is that the desktop java version (that uses the same core code) runs way slower than my web version.
for instance my web version: sapropwns.appspot.com (click with left mouse button and drag the pointer), as you can see its pretty smooth. on the other hand the java desktop version lags every like 2 secs and doesnt draw as much as this web version (the trail doesnt have as much drawing even though both use the same mouse callback for drawing at the same speed).
is there a limitation on the PlayN library that im missing?
thanks in advance.

It's been a while since I looked at PlayN (I was poking at it for a little while for fun). But performance for desktop apps may not be great for certain applications since they are using straight-up Java2D for their rendering. I'm also guessing it's not all that optimized at this point.
There is some discussion on the PlayN group about improving performance by switching from Java2D to LWJGL (Lightweight Java Game Library). This would improve performance greatly for desktop apps (Minecraft uses LWJGL).

Related

Trouble with an old java applet

We're using this website to teach modern physics at our university. I've noticed that modules 10.1.1 and 10.1.2 work on some computers but not others (on some the animations wont appear, but you still get a grid and timer). These computers have the same hardware and set up as far as I can tell. Also on certain computers 10.1.1 will run, but 10.1.2 will not. I am at a loss. The trouble occurs only with these applets and not with other java modules on the website. Have any idea what it could be and if there could be a fix?

JavaFX 2.x in desktop development?

I have to find technology for new desktop application on Java only.
I don't want use swing, but I can't find good and perspective alternatives.
I know about JavaFX, but I have strong requirements: It must look good, not roughly on linux, windows and macOx. Does JavaFX work fine on each of this platforms? And which a big troubles can I find in using JavaFX?
I'm using FX in desktop development. It's great, but far away from being perfect. Also there's no Linux version at this moment, as for Mac, it's only beta 2.1 (which i'm using right now). The biggest thing that annoys me is freezes. U can download visual editor right here
BTW Gosling belives that FX would become more usefull in desktop dev than in RIA development
Eclipse's SWT should definitely be considered. It supports all three platforms mentioned and IMO is nicer to use than Swing.

Is it possible to run Java3D applications on Nvidia 3D Vision hardware in windowed mode?

Thanks to JohnnyO it was already answered if it is possible to run Java3D application in conjunction with nVidia 3D vision:
Is it possible to run Java3D applications on Nvidia 3D Vision hardware?
His approach also worked fine for me. But it is restricted to full screen mode.
His thread is already a few months old, and now during the last few weeks nVidia improved its drivers for 3D Vision: Now it is possible to run many applications also in windowed mode. If you are using professional hardware like the nVidia Quadro cards or ATI Fire GL, you know and appreciate the windowed mode already for a very long time.
Now, with the latest updates of the nVidia drivers (I have currently installed 295.73) it is also possible to run many applications like the nVidia Picture Viewer, the Stereoscopic Player etc. in windowed mode.
http://nvidia.custhelp.com/app/answers/detail/a_id/2311
Normally DirectX 9 applications should run in windowed mode, as you can read on the previously mentioned nVidia page. And I think Java 3D is a DirectX 9 application. If I use:
-Dj3d.debug=true
Then the console says:
[j3d] Using DirectX D3D 9.0 or higher.
(And of course no one seems to be working on the improvement of the DirectX implementation of Java 3D these says.)
Did somebody meanwhile find out the trick how to run Java3D in Stereo windowed mode? I tried it, but I failed so long. I think this will be a very important argument pro Java 3D, if we solve this issue!
One thing I noticed when I played around with this was that the 3D vision drivers weren't kicking in, even when I thought I had everything set up correctly.
One hack we found was that the nVidia drivers were actually only configured to support specific video games on their whitelist, but the whitelist matching was just based on exe names.
After lots of problems and frustration, we renamed our Java wrapper from myprogram.exe to something from the whitelist, things worked much better. I think for a while, or exe was named BatmanAC.exe in testing or something like that. This seemed to make the nVidia drivers much more permissive to what we wanted to do.

Is it possible to run Java3D applications on Nvidia 3D Vision hardware?

Is is possible to run a Java3D application on Nvidia 3D Vision hardware?
I've got an existing Java3D application that can run in stereoscopic 3D. In the past, I've always run the application on Quadro cards using the OpenGL renderer and quad buffered stereo.
I now have access to a laptop with the nVidia 3D Vision system (with a GeForce GTX 460M). From the documentation, it seems like it should be possible to run my application in stereo if I use the DirectX bindings and let the nVidia drivers take care of the stereo, however, this does not seem to be the case.
If I run a Java3D application with j3d.rend=d3d, the nVidia 3D Vision API doesn't seem to recognize it as a DirectX application.
How can I get the nVidia 3D Vision drivers to detect a Java3D application and render in stereoscopic 3D?
I'm disappointed that so far everyone has dismissed this as impossible right out of the gate. I've been working on this for the past several days, and made some headway. So far, I've found that it is possible, but with a few caveats:
You need the latest drivers from nVidia (280.29 as of this writing)
You need to use the Direct3D renderer, not the OpenGL renderer (-Dj3d.rend=d3d)
You need to force Direct3D to run in fullscreen mode. (-Dj3d.fullscreen=REQUIRED)
You need to run using a ConfiguredUniverse in fullscreen mode (I'm using the provided j3d-1x1.cfg that is available in the Java3D documentation)
In order to get it working on a 64-bit machine, I had to use the 64-bit dlls for Java3D, which someone has helpfully provided on the Java3D forums (http://home.java.net/node/705510) This may or may not be required on a 32-bit system.
Future releases of the nVidia drivers promise improved support for windowed-mode stereo, so its possible that this will become easier in the future (possibly eliminating the need for option 3 and/or 4 above)
I'll also investigate if rebuilding the Java3D source with some additional nVidia bindings can eliminate the fullscreen requirement, and repost with the results.
Java3D uses something called "Quadbuffer Stereo", i.e. two distinct doublebuffered framebuffers, one for the left and one for the right eye. NVidia considers this thing "professional grade", although it is impossible to to proper stereoscopy without accurate control of the content of both eyes.
3D Vision however inserts some shaders to create an in-situ stereo separation. This however only works with programs giving it some hints through the 3D Vision API. Java3D doesn't.
Let's just hope that Microsoft will indeed push Quadbuffered Stereo as a core requirement of DirectX 12 Graphics, so that NVidia has no longer lame excuses to keep this from "consumer grade" OpenGL.
java3D does not support the 3d vision api but it may work with any direct x program
This is may outdated, but I have the binary DirectX libs for Java3D 64. It is the j3dcore-d3d.dll .
If someone needs it, send a message to me.
From readme.txt file :
======
README
Java3D DirectX 9.0 Renderer for 64bits
January, 2010
Hi
The companion j3dcore-d3d.dll is a Java3D renderer
for Microsoft DirectX D3D in 64bit. This uses exactly
same source code from 32bits, but compiled with Visual
studio 2005 for Windows 64bits.
It was tested with Windows XP Pro. 64bit Edition,
Vista 64 and Windows-7 64. In both nVidia and ATI drivers.
Usage
Drop the j3dcore-d3d.dll in the same folder you have j3dcore-ogl.dll.
Dependency
Use it with a 64bit JRE.
It requires Java3D for Windows AMD 64, available at
https://java3d.dev.java.net/binary-builds.html
It also needs a DirectX driver update
You can get it http:\www.microsoft.com\directx
Current full link for DirectX Web Setup :
http://www.microsoft.com/downloads/details.aspx?familyid=2DA43D38-DB71-4...
This last link points to a very small web updater for DirectX runtime.
Disclaimer
This is for testing purposes only. Use it at your own risk.
This IS NOT endorsed or supported by Sun, Oracle or any other company.

How to do 3d in a Java applet?

I'd like to render a very simple 3D scene in a java applet. I could do all the math myself and render that to a bitmap, but as I'm sure I'm not the first person in history to have to draw a few cubes to the screen, I was wondering how this is usually done.
Every place I've read has said either Java3D or LWJGL, but as I understand it these rely on platform-dependent code and need to be installed separately from Java, making them both unsuitable for graphics.
So how is this usually done?
This old page lists the demos/apps/libraries of 3D Java applets with no hardware dependencies. Unfortunately very few are open-source, others are not even downloadable.
Personally I recommend you to experiment with Java 1.1 3D renderer by Ken Perlin, which has source code available and free to use for academic purposes.
EDIT: jGL is another Java 3D library with no hardware dependencies. It mimics OpenGL 1.* API. It is licensed under GNU Lesser General Public License (LGPL).
In a plug-in 2 JRE (1.6.0_10+), you can use JWS extensions for embedded applets. This is important because JWS makes it much easier to ensure the correct binaries are on the run-time class path. AFAIU JOGL and Java 3D both offer JWS extensions for their APIs.
Should you choose to go that way, please make the applet has the draggable parameter added, so the end user might choose if they want a (mostly useless) browser window wrapped around a 3D animation.
I ran into similar problems when I needed to do some 3d rendering in an applet. My solution was to simply implement from scratch a 3d rendering library in Java. The fear was that it would be a poor performer but on an I5 processor, this proved to not be the case. The added advantage is that I was able to write the library in the way I always wanted graphics to be done. The real advantage,, though, is that it will run regardless of any need to have some graphics library installed on the client and without regard to any graphics card dependencies.
I will gladly share a subset of this code to anyone who wants to look at it.
Could you use JOGL?
http://download.java.net/media/jogl/demos/www/applettest-jnlp.html
I'm not a Java guy, but 2/3 years ago when I was at univeristy I had the same problem :)
I've tried jogl... and for noob in Java like myself I found it too complicated to configure and write something using it.
I used Java3d and it worked like a charm, the only problem I had back then, was that Java3d did not worked with all graphic cards. But fortunatelly it worked with computers at my univeristy :)

Categories

Resources