OpenGL portability from C++ to Java

Hi guys,

I am following along with a free online course in computer graphics on edX which uses OpenGL/C++ but I am finding the C++ factor more inconvenient than I would like. My issue is not with the language itself, but more so with the compilation process and the bulk of data that is constantly created by Visual Studio.

I was curious about how much of a hassle it might be to use LWJGL and port the boiler plate OpenGL code provided by edX to Java? My understanding is that OpenGL should be a universal API regardless of the platform/language? Perhaps I am being ignorant…

Alternatively, does anyone happen to know of an in-depth modern OpenGL course which does use Java?

Thanks in advanced guys!

Short answer: as long as you know openGL it’s super easy.

Long answer: While the functionality under the hood is similar certain libraries have different bindings (not sure if that’s the right term), which means different parameters are sent. So there is some conversion to be done that can be tricky for a newbie, but it wouldn’t be that bad.

Most people here are using LWJGL (as far as I’m aware), and it seems to resemble the openGL bindings you would be familiar with from C++ so again it wouldn’t be that big of a deal. JOGL is another wrapper that is pretty good. I’ve been using that since my switch from C++ to Java and I like it. However, JOGL’s quite a bit different.

Can you be more precise about the boilerplate OpenGL code? Which features does it contain?

JOGL contains numerous helpers but most of them aren’t mandatory, it’s almost the same for JOCL. You can use its low level API to do exactly what you do in plain C++ or C. I ported a lot of OpenGL code from C and C++ to Java with JOGL, there are only minor differences, you just have to know those high level mandatory classes except if you want to waste your time in reinventing the wheel in worse.

There are some modern OpenGL courses mentioned in the JGO Wiki and ported to both sets of bindings.