Unable to determine Graphics Configuration. Am I setting up something wrong?

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
This post was updated on .
I've recently started trying to set up JOGL in order to learn OpenGL with Java. I'm using Eclipse 2021-06, and have set up my project in the following way:
JOGL >
    src >
        gltest >
            GLTest.java
        module-info.java
    gluegen-rt.jar
    gluegen-rt-natives-windows-amd64.jar
    gluegen-rt-natives-windows-i586.jar
    jogl-all.jar
    jogl-all-natives-windows-amd64.jar
    jogl-all-natives-windows-i586.jar

My build path contains:
JavaSE-11 (jdk11.0.13)
gluegen-rt.jar
jogl-all.jar
I have tried adding the natives jars to the build path as well, with the same results.

My module-info.java contains:
module jogl {
    requires jogl.all;
    requires java.desktop;
}

My GLTest.java contains:
package gltest;

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;

public class GLTest {
    public static void main ( final String[] args ) {
        final GLProfile glp = GLProfile.getDefault();
        final GLCapabilities caps = new GLCapabilities( glp );
        final GLCanvas canvas = new GLCanvas( caps );

        final Frame frame = new Frame();
        frame.setSize( 500, 500 );
        frame.add( canvas );

        frame.setVisible( true );
        frame.addWindowListener( new WindowAdapter() {
            @Override
            public void windowClosing ( final WindowEvent e ) {
                System.exit( 0 );
            }
        } );
    }
}

I'm using a standard run configuration for GLTest.java.
When I look at "manage run configurations" and click "Show Command Line", it shows:
C:\Program Files\Java\jdk-11.0.13\bin\javaw.exe
-Dfile.encoding=Cp1252
-p "C:\Users\user\eclipse-workspace\JOGL\bin;C:\Users\user\eclipse-workspace\JOGL\gluegen-rt.jar;C:\Users\user\eclipse-workspace\JOGL\jogl-all.jar"
-m jogl/gltest.GLTest

After running this, I get an error stating that it is unable to determine Graphics Configuration.
Exception in thread "main" com.jogamp.opengl.GLException: Unable to determine GraphicsConfiguration: WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0xcb58c11]], idx 0], pfdID 9, ARB-Choosen true,
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
	chosen    GLCaps[wgl vid 9 arb: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]
	at jogl.all/jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:182)
	at jogl.all/com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424)
	at jogl.all/com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1513)
	at jogl.all/com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:609)
	at java.desktop/java.awt.Container.addNotify(Container.java:2800)
	at java.desktop/java.awt.Window.addNotify(Window.java:786)
	at java.desktop/java.awt.Frame.addNotify(Frame.java:490)
	at java.desktop/java.awt.Window.show(Window.java:1048)
	at java.desktop/java.awt.Component.show(Component.java:1716)
	at java.desktop/java.awt.Component.setVisible(Component.java:1663)
	at java.desktop/java.awt.Window.setVisible(Window.java:1031)
	at jogl/gltest.GLTest.main(GLTest.java:21)

I've looked up this issue, and keep finding the same things talking about various Java version inconsistencies:
https://github.com/jzy3d/jogl/issues/4
https://forum.jogamp.org/JogAmp-Build-v2-4-0-rc-20210111-td4040955i20.html
https://stackoverflow.com/questions/66722833/executable-jar-with-dependencies-and-dll-dependency-using-maven

Most of these seem to be reporting issues specifically with Java 15-17, though.
Initially, I was trying things on Java & JDK 13, and tried both of the command-line fixes suggested (illegal-access, and add-exports ALL UNNAMED). Nether seemed to work. Now, I've swapped over to Java & JDK 11, as it seemed like this was the version that people said worked. However, the error has not changed at all.

Thus, this kind of leads me to believe the issue isn't due to these errors others are mentioning, but to something more mundane. Can it actually not find the Graphics Configuration for some reason? Or am I setting up my project wrong?

For reference, I am on a Windows 10 ThinkPad P1 laptop. My friend was successfully able to set things up on a school Mac, so I'm not sure where our differences lie. Does this issue only happen on Windows? on laptops? on my particular setup?

I tried testing this with the OneTriangle example posted on the wiki somewhere, and got the same issue. If there was a test case I could very easily run without using Eclipse, that might be helpful in diagnosing the problem. I don't want to deal with this if it's going to require installing and running complicated Maven projects or anything, that would just add more hassle to this issue, ideally a simple command line & jar file / java file would do.

If anyone has ideas on what's going wrong or how I should try to diagnose this issue, please let me know. I've provided all the relevant info I can really think of, but if more detailed information would be necessary I can provide it. Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

gouessej
Administrator
Hello

I use Eclipse too and I don't reproduce your problem. I advise to make it work without Eclipse as a first step in order to remove the IDE from the equation (at least temporarily).

By the way, please use JOGL 2.4 latest release candidate.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
In reply to this post by Electra
Could you clarify which is your GPU?

The weird thing about this exception is that it is triggered only if the chosen graphic configuration is null, whereas the error message indicates an existing graphic configuration (which differs a bit from the requested graphic configuration but this is not a problem).

I would bet for an error in this method flow.

Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
I'm on a laptop, so I have both an integrated and dedicated graphics card. This may be related to the problem, I'm not really sure? I do not have a desktop computer I can test this on myself, though maybe I could ask a friend to try and set it up.
The integrated graphics card is an Intel(R) UHD Graphics 360 with support for OpenGL 4.6.
This is a screenshot of my Intel Graphics Control Panel specs sheet https://snipboard.io/cmJikS.jpg
The dedicated graphics card is an Nvidia Quadro P1000.
This is a screenshot of my Nvidia Control Panel specs sheet https://snipboard.io/C0ycag.jpg
I think my friend was also getting the same issue, I'll post their specs here as well once they reply to me.
Thank you for your response, and let me know if there's any other info I should report.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
In reply to this post by gouessej
I'm making sure to use JOGL 2.4, as when I tried using JOGL 2.3.2 I got issues with an index out of bounds error.
Are there any pre-built tests I can use to easily test things outside of Eclipse? Ideally I would just want to stick a test JAR file in with the JOGL JAR files and compile them together with a command. I'm not too experienced with compiling large Java projects and I would be even less confident setting up these dependencies outside of an IDE, so I'd want this kind of thing to be as simple as possible. When looking up this bug, I noticed a few things mentioning there were unit/integration tests used to verify the project is working and to reproduce some of the errors people were getting, but I don't know where to find or how to run those.
Thank you for your response!
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
Thanks! I ask your GPU configuration mainly for the purpose of having a consistent list of failing Windows configuration.

The "index out of bounds error" on JOGL 2.3.2 is referenced here. There is a workaround (the same than the one fixing the case I mentioned earlier). Please tell us if this helps on your configuration. This workaround worked for me with the configuration {Win10, Intel Xe Graphics, JDK 17} (the exact configurations I verified for JOGL 2.4 are here).

The interesting thing to note is that different version of JOGL fail in the same chooseGraphicsConfigurationImpl method with different errors for your computer (either null GC either out of bounds).

Running the unit test of JOGL is not easy. There is a howto here if you want to try. You will have to build gluegen, build JOGL then run unit tests. I have been able to run them with an apparent success on Windows but visible crashes on macOS.  

If you want to understand what's wrong with your configuration, the easiest is maybe to run in debug mode and go step by step in the method chooseGraphicsConfigurationImpl to better understand what's happening.

 


 

 
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
Are you suggesting that I revert to JOGL 2.3.2 and try to fix the issue on that version?
I feel like I don't want to be setting VM parameters in order to fix something that's literally just a typo in the code. I'm guessing once I get past this part and into the actual graphics configuration choice, it will run into the same issues.

Edit: I tried to run on JOGL 2.3.2, and got the same OOB issue.
Putting the workaround into the VM arguments did not seem to fix.
This is the case on both Java/JDK 11 and 13.
I'm setting the VM arguments inside the Run Configurations tab in Eclipse, I'm pretty sure that's right?

In terms of debugging, for JOGL 2.4 I could not find a .zip source file in order to link source to the jar file. Is this available somewhere?
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
Resolving the problem won't be fast, that's why I propose quickwins. I was indeed proposing to test 2.3.2 with VM args.

Can you run on another JDKs? I had a successful experience with JDK 17 (but did not try 11 or 13).

The VM args of the run configuration panel are indeed the good place for setting the VM args.

To get the source of JOGL 2.4, I cloned the complete git repo. You may also try downloading it from there.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
One remark about the OOB exception.

What is surprising is that the 2.4 rc are supposed to contain a fix commited on June 2020 which exactly address this problem.

Indeed, this bug is exactly the same that the one that led to the fix. This may mean (?) that the 2.4 build contains outdated jars.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
I only get the OOB issue on release 2.3.2, and not on release candidate 2.4

Thank you for providing a link to the source .zip. I've looked through using a debugger, and basically what seems to happen is
1) The "First Choice" of a desired PFD fails. This happens because Win32SunJDKReflection's "initialized" field is set to false, and so the default case where it returns null is triggered. I am assuming this is expected behavior and why the "Second Choice" exists, but I'm not sure.

2) The "Second Choice" obtains a list of AWT PFDs. There is only one element in this list.

3) When asking the system which PFD to pick, it does not return one that matches. Thus, the index is -1, and no configuration is selected.

I think I better understand what the previous error on 2.3.2 was, then. The index out of bounds error happens only when the graphics configuration would otherwise *not* be selected. So, it's still giving an error in both cases, just, in one case it fails early due to OOB and the other case it correctly realizes the index is wrong, but then fails due to no graphics config?
I guess this is why the "workaround" for both of these errors is hypothetically the same, to work around the OOB error you just avoid getting the null GC case and it won't happen?
Now if that *only* fires when its a null index, I could see that being an issue as getting a real index would *not* set the GC. Does this mean that the only way to work around this was to set the GC using the "First Choice"? Possibly this indicates that this fixed it by changing things around so that Win32SunJdkReflection was initialized?
I hope I am understanding this correctly.

I can try to look into the actual PFD selection thing later and see if I can figure out why that isn't returning a matching ID, but it looks very complicated so i'm not sure if I'll be able to figure out what's going on there.

Do you have an idea of what the flow here is expected to look like?
1) Is it expected that the PFD should generally / ideally be chosen in the "first case", or is this just an ideal case that rarely works? Is it expected that Win32SunJdkReflection is uninitialized?
2) Is the PFD selection supposed to be able to return an invalid PFD / PFD not in the list? Is this the intended behavior when the available PFD isn't sufficient or something?

Thank you for all your help.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

gouessej
Administrator
In reply to this post by Martin
You can look at the bytecode to check your supposition about the wrong JAR in the release candidate.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
Uncompiling 2.4-rc4 shows that the bytecode is conform to source code and that my assumption was wrong.

 
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
This post was updated on .
In reply to this post by Electra
Hi,

I reproduce the same flow than you when removing the workaround flag that I suggested above.

I also found that the code is hard to understand and to debug. So repeat my primary proposal : try JDK 14 or 17 which will work if you enable the flags (or JDK 8 which wasn't causing trouble as well to my memory).

This graphic configuration chooser is however a threat for future JDK : there is a reflection mecanism to load the Win32GraphicsConfig, but I fear this may not be allowed in future JDK version.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
Running JDK 17, JRE 16 gave me the same error, even with the workaround in place.
I was unable to run using JDK 8 due to an UnsupportedClassVersionError.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
Are you sure you properly configured the VM arguments? These flags works for a lot of developers on Windows 10.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
Here's screenshots of my run configuration. I don't know where else I could put the VM arguments.
https://snipboard.io/PF9AnO.jpg
https://snipboard.io/YR5Z08.jpg
https://snipboard.io/6TcmkX.jpg
https://snipboard.io/0IflCs.jpg

This is what it outputs when i press "show command line" on the arguments page
C:\Program Files\Java\jdk-17.0.2\bin\javaw.exe
--add-exports java.base/java.lang=ALL-UNNAMED
--add-exports java.desktop/sun.awt=ALL-UNNAMED
--add-exports java.desktop/sun.java2d=ALL-UNNAMED
-Dfile.encoding=Cp1252
-p "C:\Users\user\eclipse-workspace\JOGL\bin;C:\Users\user\eclipse-workspace\JOGL\gluegen-rt.jar;C:\Users\user\eclipse-workspace\JOGL\jogl-all.jar;C:\Users\user\eclipse-workspace\JOGL\gluegen-rt-natives-windows-amd64.jar;C:\Users\user\eclipse-workspace\JOGL\gluegen-rt-natives-windows-i586.jar;C:\Users\user\eclipse-workspace\JOGL\jogl-all-natives-windows-amd64.jar;C:\Users\user\eclipse-workspace\JOGL\jogl-all-natives-windows-i586.jar"
-XX:+ShowCodeDetailsInExceptionMessages
-m jogl/gltest.GLTest
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Martin
In eclipse the three lines must either be on a single line OR you add backslashes after the two first lines
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

Electra
Adding backslashes between the lines seems to be automatically detected as the backslashes being their own parameters, giving the error "Could not find or load main class \". When looking at the command line, this seems to be because they're automatically escaped in quotations as "\\".
Just putting all of the commands on the same line produces the same error as if they were all on separate lines.
https://snipboard.io/ME0oIe.jpg
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

michael
In reply to this post by Electra
Hi,

I was getting a similar issue with Java 21 and JoGL with JoML. What I did was to port the code from Swing to JavaFX and then the code from Computer Graphics Programming in OpenGL with Java worked.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine Graphics Configuration. Am I setting up something wrong?

gouessej
Administrator
Using JavaFX isn't necessary to solve this problem.
Julien Gouesse | Personal blog | Website