Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started on macOS and Maven #56

Closed
jzy3d opened this issue May 29, 2022 · 6 comments
Closed

Getting started on macOS and Maven #56

jzy3d opened this issue May 29, 2022 · 6 comments

Comments

@jzy3d
Copy link

jzy3d commented May 29, 2022

I am giving a try to lwjgl-awt as an alternative OpenGL binding to JOGL in Jzy3D.

I am simply trying to run the AWTTest sample but am getting the message

[LWJGL] Version: 3.3.1 build 7
[LWJGL] 	 OS: Mac OS X v10.15.7
[LWJGL] 	JRE: macOS x86_64 1.8.0_91
[LWJGL] 	JVM: Java HotSpot(TM) 64-Bit Server VM v25.91-b14 by Oracle Corporation
[LWJGL] Loading JNI library: lwjgl
[LWJGL] 	Module: org.lwjgl
[LWJGL] 	macos/x64/org/lwjgl/liblwjgl.dylib not found in java.library.path=./lib
[LWJGL] 	liblwjgl.dylib not found in java.library.path
[LWJGL] Failed to load a library. Possible solutions:
	a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
	b) Add the JAR that contains the shared library to the classpath.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib

I wrote my pom file by looking at the project main pom and forced the import on macOS to start.

I print my classpath and get

/Users/Martin/.m2/repository/org/lwjglx/lwjgl3-awt/0.1.8/lwjgl3-awt-0.1.8.jar
/Users/Martin/.m2/repository/org/lwjgl/lwjgl/3.3.1/lwjgl-3.3.1.jar
/Users/Martin/.m2/repository/org/lwjgl/lwjgl-jawt/3.3.1/lwjgl-jawt-3.3.1.jar
/Users/Martin/.m2/repository/org/lwjgl/lwjgl-opengl/3.3.1/lwjgl-opengl-3.3.1.jar
/Users/Martin/.m2/repository/org/lwjgl/lwjgl-opengl/3.3.1/lwjgl-opengl-3.3.1-natives-macos.jar

with lwjgl-opengl-3.3.1-natives-macos.jar containing liblwjgl_opengl.dylib, but not the expected liblwjgl.dylib.

Is there anything missing in my maven dependencies to LWJGL?

I would prefer not to extract the natives in a local temporary dir and avoid defining the path through java.library.path.

@SWinxy
Copy link
Collaborator

SWinxy commented Jul 28, 2022

@jzy3d Hey! I'm guessing you deleted the test that includes the POM. If you haven't, you should begin by going to https://lwjgl.org/customize to get the POM for your project. Copy it in, and make sure you select all platforms you support.

The error you're getting is informing you that a LWJGL module can't find the LWJGL core. It is a headache to solve, but making sure the POM is right is the first step.

LWJGL extracts the native libraries itself and cleans up after itself—you don't need to manually do anything.

Let me know if you have further issues (sorry I'm two months late).

@jzy3d
Copy link
Author

jzy3d commented Jul 28, 2022

Hi @SWinxy, thank you a lot for the suggestions! Generating pom file parts with LWJGL Customize solved my path issue, what a great tool!

@jzy3d jzy3d closed this as completed Jul 28, 2022
@jzy3d
Copy link
Author

jzy3d commented Jul 28, 2022

I was able to locate most of GL11, helped a lot for my experiments, thanks @SWinxy .

Could you help me to locate packages GLU and GLUT in LWJGL?

I am interested if you have links to share about making GL context current to non AWT thread (which was necessary with JOGL when invoking GL out of the display loop).

Hints about text rendering similar to JOGL would be appreciated as well!

@SWinxy
Copy link
Collaborator

SWinxy commented Jul 29, 2022

GLU and GLUT are not supported by LWJGL (i.e., it does not provide Java bindings to those native libraries). I don't know any OpenGL, but here are what my buddies have informed me: GLU is deprecated, and GLUT is for making windows.

AWT is a windowing and UI library, so in a way it can serve as a replacement to GLUT. But to implement such a conversion, you'd either migrate all the code over to AWT, or maintain both AWT and GLUT in parallel. It's sorta like, why force yourself to use GLUT, when AWT is right here for the picking.

Working with OpenGL and its past libraries is a complicated dance. But, if you must use GLU and/or GLUT, there is a way. LWJGL can work with most native C libraries, but you will have to both provide the native library yourself as well as write code to interface with the native library. You can read up on how LWJGL generates the bindings here. If you decide that you must use GLU and/or GLUT, open an issue at LWJGL/lwjgl3, and Spasi might help you.

I am happy to answer more questions that you have.

@jzy3d
Copy link
Author

jzy3d commented Jul 29, 2022

GLUT was indeed written first for Windows but was then made available for linux under the name Freeglut. It does not only provide tools for the UI but also has useful methods for rendering, e.g. glutBitmapString is handy for drawing text, glutSolidSphere, glutSolidCube for drawing shapes. JOGL's GLUT seams to be written in pure java rather than binded, so this could be picked there.

GLU as a lot of crucial methods for computing 3D to 2D or vice-versa, e.g. gluProject, gluUnproject, gluOrtho2d, gluLookAt and gluPickMatrix. (It also has useful methods for rendering : gluSphere, gluDisk, gluSphere, gluCylinder but these are less important to me).

I found that GLU existed in previous version of LWJGL in pure Java (see GLU relying on Project). I probably can copy this. However JOML seams to be the place where to find GLU for LWJGL 3 nowadays.

Another useful set of links.

@jzy3d
Copy link
Author

jzy3d commented Aug 3, 2022

I can get a basic chart working, thanks again for your help!

image

I started by simply copying previous LWJGL GLU source code in my project and simply add to rename glMultMatrix to glMultMatrixf.

I'll make my progress visible here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants