# Calling opengl32.DLL from java?

I don't like LWJGL in some cases, so I prefer to use Swing. The thing is that Swing doesn't have OpenGL. I have tried JOGL and it's a mess to install, needs external jars, and I have yet to get it working. So I was wondering if I could just make an OpenGL class that uses opengl32.DLL and put the graphics into a window made with Swing? Also, is opengl32.DLL able to be called with a 64 bit Java program?

If you use a build system like MAVEN it is actually fairly easy to use JOGL. (But it is indeed stupidly hard to configure without it).

 <dependencies>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.0-rc11</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.0-rc11</version>
</dependency>
</dependencies>


JOGL does just that, but makes it easier for you. If you have trouble installing JOGL, you will have a lot more trouble trying to do it yourself. If you still insinst on doing it yourself, search for JNI and/or JNA.

• This is not really a helpful answer, it just says "try harder because it's the easiest think to do". Well... it's not the easiest thing to do. On the other hand, Roy actually gives some input. Apr 22 '13 at 10:18
• @Liosan If he has problems with JOGL, I would be happy to help. However in the question he said he doesn't want to use it and I tried to convince him that he should anyway, because I believe JOGL is the correct solution. If you think there is an easier solution for Swing-OpenGL interoperability, I would like to hear about it, as I agree JOGL is quite hard to setup for the first time. Apr 22 '13 at 10:46
• Fair enough, but still - Roy's answer actually adds something. Maybe the -1 was unnecessary, but I can't remove it now, it's "locked" :( As for alternatives, the OP stated that he doesn't like LWJGL, so there's not much more I can offer :) Apr 22 '13 at 11:01
• "This is not really a helpful answer" - but it's correct nonetheless. Apr 22 '13 at 12:27