I haven't programmed in Java for 3 years and because of that I'm kinda clumsy with it.
The problem is that i have to develop a Android App with OpenGL ES. Now I'm wondering how I should do my 3D maths. In my C++ games i always used glm (glm.g-truc.net) but this is a C library.
I've seen some posts about this topic which said, that glm is also very good to use in OpenGL ES. But here's the point. I may sound nooby, but i have no clue how to use glm in my OpenGL ES application that's implemented with JAVA. Do I have to use JNI to be able to use that library?
Related
I am trying to port this tutorial to Kotlin/Java with LWJGL3 using the "modern" OpenGL versions. I have followed this tutorial in c++, where I managed to create a coloured cube, that was rotated. Because I am not as familiar with c++, I made the decision to swap to Java/Kotlin.
I am unable to find the glewInit() function in LWJGL3 and all the other stuff around GLEW. From what I have read, with glew I can access the modern OpenGL API.
I have looked up some LWJGL3 tutorials, but I was unable to find one with the modern OpenGL syntax.
I have also read this question where, the answer seemed to me like LWJGL3 is basically GLEW for Java.
So is it true that I must access GLEW in order to write a "modern" OpenGL application? And if so, how with LWJL3? Or is LWJGL3 the replacement for GLEW in Java?
GLEW is an OpenGL function loading library. It's purpose is to allow you to access OpenGL, as provided by your implementation. This is important for programs written in C and C++, and GLEW is very much a C library.
LWJGL performs essentially the same function for Java. It also does other things that GLEW doesn't (like managing the OpenGL window, etc).
So in Java, you don't need GLEW, and can't really use it even if you did.
You should follow the hello world on the website.
Since you are using Kotlin, I have a small wrapper that improves the experience with lwjgl and glfw and might be interesting for you.
You can go up and running with a simple:
glfw.init("3.3")
val window = GlfwWindow(1280, 720, "ImGui Lwjgl OpenGL3 example").apply { init() }
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.
I'm stuck developing on an old computer with OpenGL 1.1 only. As such i'm grateful I can use ImmediateMode10 etc, but I don't see a way for me to create display lists in Libgdx. I've searched for glGenList but I don't see it anywhere in the code. Am I missing something simple?
LibGDX uses the OpenGL "ES" subset that was developed for mobile devices. It maps that to standard OpenGL on the desktop, but in general complete OpenGL isn't available through libGDX. Display lists are one of the things that were removed from OpenGL to create OpenGL ES 1.0.
If you are only interested in the OpenGL Java bindings on the desktop, and want more complete OpenGL support, the LWJGL library supports display lists.
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.
I recently agreed to help a friend make a game he has been working on and I decided that I would prefer to write it in Java. I am unsure what the best route is to take for 3D in Java. I have found that most everyone talks about Java 3d for 3d graphics in Java, which seems to basically be a wrapper for Directx and openGL but I have also found that Java 3d hasn't been in active development since 2008. Is it still the best thing to use or is there something with more active development that would be better. I have seen some discussion about some other APIs but Java 3d seems to have better documentation and there are some fairly decent books on 3d programming in Java that all seem to be based on Java 3d.
There are a number of options you have when writing 3D apps in Java.
JOGL is a very thin wrapper for OpenGL written in Java. Using it involves learning to program in OpenGL, which is no small undertaking. It does allow you to maximize your performance at the cost of a big increase in development time. If you happen to be familiar with OpenGL already , or need very low level functionality, this is your best choice.
Java3D is an object oriented extensions to Java that is easier to use then JOGL and has the advantage of being supported by the Java community. It's less used than some of the other solutions.
LWJGL (Lightweight Java Game Library) is a is a library for making games in Java with 2D and 3D graphics, and it also supports sound (OpenAL), and provides many useful features for games development. It's less suitable for other 3D development.
There are a number of other game engines built on LWJGL and the other libraries that provide a greater range of features than any of the others. JMonkeyEngine is probably the frontrunner of these. They will provide more functionality for you in terms of view control, animation etc.
Which book you read entirely depends on which choice you make above.
JOGL is a modern replacement under active development. It's basically just bindings to the OpenGL library.
Have a look at jMonkeyEngine and LWJGL.
jMonkeyEngine is being actively developed and it includes a complete toolkit and IDE for creating 3D graphics applications in Java.
LWJGL (Lightweight Java Game Library) is a library for making games in Java with 2D and 3D graphics, and it also supports sound (OpenAL).
A friend used Processing a while ago and found it reasonable.
I haven't checked it out in a while, but JMonkeyEngine was the best Java 3D engine around.