Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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??

like image 575
Stefnotch Avatar asked Dec 12 '22 05:12

Stefnotch


1 Answers

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.

like image 148
Bartvbl Avatar answered Dec 20 '22 10:12

Bartvbl