Library to embed 3D view in a swing app? - java

I'm currently searching for a 3d library that I could embed in a Swing application. This library doesn't necessarily have to be a huge thing as I mainly intend to give a 3D representation of some shapes, and certainly rotate around them.
My main concern is to get something as easy to set up and to deploy as possible.
Do you have any clue ?

Why not just embed Java3D in your application.
http://java3d.j3d.org/tutorials/quick_fix/swing.html
You can also embed Jogl (Java OpenGL) with Swing.
http://cld.blog-city.com/mixing_java_2d_and_3d_jogl_in_a_swing_application.htm
Java3D would be higher level so it may be a better choice.

Related

How to use Opengl/DirectX in Java

My questions are:
How to use Opengl or DirectX in Java.
Does DirectX have any major advantages over Opengl when using it in Java?
Is there a way to do so without using an API?
Should I use a API such as:
JOGL
LWJGL
Would Java FX be useful for making 3D things?
Also, I am using Windows.
Is there a different way to draw 3D objects??
How to use Opengl or DirectX in Java.
There are a number of OpenGL bindings available for Java. Java does not seem to support DirectX by itself, and neither do there seem to be libraries available that provide bindings.
Does DirectX have any major advantages over Opengl when using it in Java?
I'd say DirectX is at a disadvantage compared to OpenGL due to its lack of support on Linux or OSX. If you want to write cross-platform games using Java, I'd recommend taking a look at OpenGL.
Is there a way to do so without using an API?
I assume you mean a library here. Java offers an API for drawing: Java2D. This might be a nice starting point if you want to write games and are starting out with computer graphics in general. Java does not provide bindings for either OpenGL or DirectX as part of the standard library.
Should I use a API such as: JOGL LWJGL
I have VERY good experiences with LWJGL. I can therefore recommend using their bindings if you want to try using OpenGL.
Would Java FX be useful for making 3D things?
JavaFX is still somewhat buggy as far as my experience goes (came across several bugs when trying it). I don't know how well it works for doing 3D graphics.
JOGL is a Java binding for the OpenGL and OpenGL ES API. I have used JOGL since 2006 and I'm very happy with it, it's very easy to install as you can see here. It works both in desktop and embedded environments, it supports Android too, it is used by almost all major middle and high level APIs including JogAmp's Ardor3D Continuation, JMonkeyEngine, Java3D, Xith3D, LibGDX, ... GLG2D allows to benefit OpenGL when coding in plain Java2D without having to know OpenGL.
I agree with Bartvbl about JavaFX 3D API which is noticeably poorer than the APIs I quoted above.
JOGL is the only unified Java binding for the OpenGL and OpenGL ES API. It is suitable both for games and for other applications (CAD, ...) as it supports several displays, several screens, several monitors. You can use it with JInput if you want to support joysticks.

Which OpenGL implementation is best for Java

Im about to start a small project using OpenGL and Java. Looking through this website and google it seems to be unclear what implenetation of OpenGL is best to be used within Java.
I've obtained this list from: Open GL
The JOGL Java/OpenGL bindings
Java 3D (SUN's retained mode library layered on OpenGL)
OpenGL for Java (GL4Java)
YAJOGLB (Yet Another Java OpenGL Binding)
jGL: a 3D graphics library for the Java
What would use recommend in terms of the amount of resources aviabale to learn it and simpleness of implementing a simple either car,helicopter or flight simulator in?
I'm just a beginner with OpenGL but I've been using LWJGL (http://www.lwjgl.org/), which Minecraft uses.
If you want something more high level, try an engine like jMonkeyEngine (http://jmonkeyengine.com/).
I would advise to look into LibGDX if I were you. LWJGL and JOGL are targeted towards PC games. LibGDX on the other hand targets computers with the help of LWJGL, but also Android and iOS; to top it off it supports "HTML 5" with the help of Google Web Toolkit (GWT) - all through a generic API.

Java: create graphics without awt?

Is there any library out there to create graphics without using AWT?
What I need is simple drawing functions (like to draw a line) and text drawing functions to create graphics in memory for a Google app engine application. App engine does not support AWT.
Thanks!
Not unless you want to implement your own image class (say, a bitmap) and rendering algorithms for lines, shapes, images.
If you have experience with computer graphics and rasterization, this may not be very hard, but otherwise it will be more than you want to bite off.
You might also try the appengine-awt project, though it's a bit experimental.
You might try using SenseLan. In the requirements section, it says they don't use awt or ImageIO. Of course, there is the Images api but it seems fairly limited in what it offers.
Edit:
It looks like there are a couple of Python possibilities that could offer you some limited drawing capabilities. You could probably write appropriate image functionality as python web services, and keep the rest of the app in Java:
Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)
http://denislaprise.com/2008/08/21/drawing-images-on-google-app-engine/
Use Batik for GAE which is available as a dependency of FOP on GAE.
You can also track the issue further on the Google app engine bug tracker where others have shared other ideas in the comments.
'The Java 2D API is a set of classes for advanced 2D graphics and imaging, encompassing line art, text, and images'
http://java.sun.com/products/java-media/2D/index.jsp
Here's another possibility: org.eclipse.draw2d It probably relies on eclipse SWT.
TinyLine provides vector graphics support on the Google App Engine server side, and also provides SVG rendering support. See the SVG Thumbnail images demo.
Google Web Toolkit contains a nice graphics library designed for interfacing with the Google app engine.
edit to clarify: Google App Engine is designed for hosting applications on the web. You need to design graphics that can run in the browser. To do this, you need to write code in a web language, Javascript, for example. Google Web Toolkit contains a Java graphics library which compiles down to Javascript, saving you the effort of writing the Javascript yourself.
I hesitate to mention PJA, which appears to work if the AWT classes are present, but the security manager prevents you from using them.
If you can use Python on GAE instead of Java, then there's pybmp.

Qt Jambi vs JOGL for java OpenGL development?

I'm planning on writing a simple application in Java which has a basic UI with a section of OpenGL graphics. In addition to this some kind of network access is required.
Which one of these libraries should I use? What are the drawbacks and benefits of each option? I'd like the OpenGL coding be as genuine as possible, so that I could feel that I'm actually (learning) coding OpenGL. Is the surrounding UI significantly easier to code with one of the solutions? In the case of JOGL I'll propably make the UI with standard java components.
Just give some thoughts for me to thinker on, I'm not searching for the ultimate truth.
Qt Jambi is discontinued, so I would go JOGL just for this reason.
Also if your intent is just to have just a few basic controls on top of your 3d scene, I suggest you learn about IMGUI (Immediate Mode GUI) here and there.
Although it's not Java, NVIDIA made available IMGUI based widgets from which you can get inspiration.
JOGL has JMonkeyEngine .. a pretty nice game engine. I would recommend JOGL since it is pretty cross platform, soon with embedded platform implementations.

What's the best 3D graphics library for Java web apps?

I'm looking for a 3D graphics library for a Java web app. Could use some recommendations - only open source, though.
Edit: I don't really care how the graphics are output - Javascript/applets/canvas/flash but I want to write the graphics logic in Java.
JMonkeyEngine is very good.
Have a look at the The Lightweight Java Game Library. It provided developers access to crossplatform libraries such as openGl. And can run in the browser.
http://lwjgl.org
Here are a few demos:
http://lwjgl.org/applet/
http://fabiensanglard.net/Prototyp/index.php
http://www.cokeandcode.com/info/tut2d-4.html
People are doing awesome projects with this library:
http://lwjgl.org/projects.php
Here's an article that describes how to use jmonkeyengine in an applet.
http://www.streamhead.com/tutorial-jmonkeyengine-applet-hardware-3d-in-the-browser/
(JMonkeyEngine is a rather nice 3d-engine)

Categories