How to access to LWJGL GLContext.getCapabilities()

Hi all,



I’m using JME3 in a plug-in of a software I’m developing.

I wanted to check for driver support before I do anything 3D related.



This is my code:

[java]

ContextCapabilities capabilities = GLContext.getCapabilities();

if (!capabilities.OpenGL15 || !capabilities.OpenGL14 || !capabilities.OpenGL13 || !capabilities.OpenGL12

|| !capabilities.OpenGL11) {

// alert not recent enough

}[/java]



I get:

java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path


What I understood was that this is because I need to have the binaries in my build path.

In Eclipse, in Build Path > Libraries the library needs to have something defined in Native Library Location.

I guess the internally JME3 needs similar stuff so how could I use that?
I am not talking about app.getRenderer().getCaps() because for that JME3 needs to be running

I already tried uncompressing JME3-lwjgl-natives and linking it there but the error remains.
Adding
-Djava.library.path=/home/meg/workspace/Neptus/lib/jme3/jME3-lwjgl-natives/native/linux
to the VM arguments works but JME3 doesn't need to do this. Why is that?

You are not supposed to use lwjgl directly, it will be gone in a few weeks anyway. Theres jme specific calls to get the caps, use those, they are mentioned in the manual and AQ.

1 Like
@normen said:
You are not supposed to use lwjgl directly, it will be gone in a few weeks anyway. Theres jme specific calls to get the caps, use those, they are mentioned in the manual and AQ.


They need to be expanded, though... and I only just thought about it. I also go through the lwjgl back door to get some display adapter info, etc. for Mythruna's debug dumps. It would be nice if this were exposed through an API. I may have to think about that a bit before the jogl switch breaks my stuff. :)
@pspeed said:
They need to be expanded, though... and I only just thought about it. I also go through the lwjgl back door to get some display adapter info, etc. for Mythruna's debug dumps. It would be nice if this were exposed through an API. I may have to think about that a bit before the jogl switch breaks my stuff. :)

Yeah, but for the check in this example you can use GLSL versions, each OpenGL version is tied to a specific GLSL version. That we have to go though AWT or lwjgl or other things to get actual display information (like supported resolutions etc.) should be remedied at some point with a generic api though yeah.

I was trying to avoid setting up jME but I guess i can’t.



Just out of curiosity what stuff needs to be setup to be able to get that information?

You need a initialized renderer, so eg a headless simpleapplication in the launcher would do it. (IO assume you try to get that infor for a options dialog before launching?)

You need a initialized renderer, so eg a headless simpleapplication in the launcher would do it. (IO assume you try to get that infor for a options dialog before launching?)

Just create the display as normal and implement Application.handleError(), you will receive the “unsupported” message there. Also have you considered using LWJGL_OPENGL_ANY as your renderer? This way you can support any GPU, even the really old Intel GMA.

1 Like