Unable to determine GraphicsConfiguration

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

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
I re-wrote the self-contained example to use only normal javax.swing JFrame window components.
Now it runs on windows_amd64 without any arguments and also directly from runnable jar double click.

Here is the code for reference:
---------------------------------

import java.awt.Dimension;

import javax.swing.JFrame;

import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GL2ES1;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.awt.GLJPanel;
import com.jogamp.opengl.fixedfunc.GLLightingFunc;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.util.Animator;
 
/**
 * Self-contained example (within a single class only to keep it simple)
 * displaying a rotating quad
 */
public class JOGLRenderEngine implements GLEventListener {
        private float rotateT = 0.0f;
 
        @Override public void display(GLAutoDrawable gLDrawable) {
                final GL2 gl = gLDrawable.getGL().getGL2();
                gl.glClear(GL.GL_COLOR_BUFFER_BIT);
                gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
                gl.glLoadIdentity();
                gl.glTranslatef(0.0f, 0.0f, -5.0f);
 
                // rotate about the three axes
                gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
                gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
                gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
 
                // Draw A Quad
                gl.glBegin(GL2.GL_QUADS);      
                gl.glColor3f(0.0f, 1.0f, 1.0f);   // set the color of the quad
                gl.glVertex3f(-1.0f, 1.0f, 0.0f);   // Top Left
                gl.glVertex3f( 1.0f, 1.0f, 0.0f);   // Top Right
                gl.glVertex3f( 1.0f,-1.0f, 0.0f);   // Bottom Right
                gl.glVertex3f(-1.0f,-1.0f, 0.0f);   // Bottom Left
                // Done Drawing The Quad
                gl.glEnd();                                                    
 
                // increasing rotation for the next iteration                  
                rotateT += 0.2f;
        }
 
        @Override public void init(GLAutoDrawable glDrawable) {
                GL2 gl = glDrawable.getGL().getGL2();
                gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
                gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
                gl.glClearDepth(1.0f);
                gl.glEnable(GL.GL_DEPTH_TEST);
                gl.glDepthFunc(GL.GL_LEQUAL);
                gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
        }
 
        @Override public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {
                GL2 gl = gLDrawable.getGL().getGL2();
                final float aspect = (float) width / (float) height;
                gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
                gl.glLoadIdentity();
                final float fh = 0.5f;
                final float fw = fh * aspect;
                gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
                gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
                gl.glLoadIdentity();
        }
 
        @Override public void dispose(GLAutoDrawable gLDrawable) {}
 
        public static void main(String[] args) {
                GLCapabilities caps = new GLCapabilities(null);
                JOGLRenderEngine app = new JOGLRenderEngine();
                JFrame frame = new JFrame("JOGL Render Engine v0.0.5");
                GLJPanel panel = new GLJPanel(caps);
                panel.addGLEventListener(app);
                panel.setSize(1920, 1080);
                panel.setPreferredSize(new Dimension(1920, 1080));
                Animator animator = new Animator(panel);
                frame.setContentPane(panel);
                frame.setResizable(false);
                frame.pack();
                frame.setVisible(true);
                animator.start();
                panel.requestFocus();
        }
       
}
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
In reply to this post by Mathieu Féry
um the code reply was dropped for some reason.

anyways, now that the swing components only code works without any arguments and also from runnable jar.
I tested that also on linux, it throws the core dump, and the error is NoSuchMethodError (at libgluegen_rt.so), instead of classdefnotfound.

the error is same (or does not show) for both command line java -jar myjar.jar and double clicking runnable jar in linux.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
Which JAR with which command caused a core dump under Linux? I have no crash with jogamp-fat.jar.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
both types, with or without arguments, awt or swing. ie I dont have running version on linux so far.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
Please can you confirm that my example works as is on your machine?
https://jogamp.org/wiki/index.php/Rudimentary_standalone_example_using_the_fixed_pipeline_by_Julien_Gouesse

Keep in mind that the separators are different.

Moreover, your problem is probably not caused by a bug in JOGL, I have used JOGL since 2006 mostly under several GNU Linux distribution, it works.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
I tried both your original rudimentary example and my swing-only modified rudimentary example.
Works perfectly in windows, does not work in linux, (ubuntu 23.10 LTS with openjdk-21).
the JDK setup works perfectly, I assume, because it runs all my other java projects without issues.
Those are plain-java runnable jar and lwjgl runnable jar. javafx runnable jar might have issues.

edit: I actually had openjdk-22ea installed also in linux, but I removed and left only openjdk-21.
This did not make any difference. I also removed and re-installed all the openjdk packages.

when I run the current binary .jar file with the extra launch arguments in linux, I get this warning:
"WARNING: package sun.awt.windows not in java.desktop." no such warning when running without them.
both give out the same core dump abort error. if the install would be mission native normal java libraries,
then the other java runnable jars would not work either. but they work.

well, whatever the issue/bug is, its not working right out of the box in linux. in this case.
all what I see is that the cause of the crash is libgluegen_rt.so. for some unknown reason.

do you mean directory separator, the "/"? that's why I most of the time use "/" and not "\".
If you mean the TAB separator on the code lines then I edited and fixed them here on the post.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
In reply to this post by gouessej
the full core dump error log of recent run with openjdk-21 on linux.

hs_err_pid4471.log

the full runnable jar can be found downloaded from this link, to try (its the swing rudimentary example):

https://github.com/goofyseeker311/joglrenderengine/releases/download/v0.0.5/joglrenderengine_0.0.5.jar

it's possible that the openjdk-21 binary is different than in other system because of different package repo.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
In reply to this post by Goofyseeker3
My rudimentary example works on all GNU Linux distributions.

You got the warning because you used the wrong command line, "sun.awt.windows" isn't loaded under GNU Linux because it's for Microsoft Windows. I meant that the separator inside the classpath is ";" under Windows but it's ":" under other operating systems. Please use the command line "under other operating systems except Windows":
https://jogamp.org/wiki/index.php/Rudimentary_standalone_example_using_the_fixed_pipeline_by_Julien_Gouesse

I suggest to make the rudimentary example work first, and then to make your more elaborated example work.

P.S: The problem doesn't come from JOGL:
https://issues.apache.org/jira/browse/GROOVY-9018
Use the right command line for GNU Linux, it doesn't contain "sun.awt.windows" which is Microsoft Windows specific.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
does the swing rudimentary example work for you, no command line arguments.

also the command line without requiring separators:
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -jar joglrenderengine.jar

or when awt libraries are not used, only swing:
java -jar joglrenderengine.jar
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
I always used the command line arguments at home under Debian Linux 12. I'm almost sure that it doesn't work without the command line arguments but I can retry in a few hours to confirm. For sure, I didn't have any core dump.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
In reply to this post by Goofyseeker3
Please can you ensure that the rudimentary example work before fixing your example? Your stuff uses a JAR in JAR loader; if we don't make the rudimentary example work on your machine, we will be unable to determine whether the problem comes from JOGL or if it's specific to the JAR in JAR loader.

This should work:
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar:joglrenderengine.jar fi.jkauppa.joglrenderengine.JOGLRenderEngine
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
it might be about the jar-in-jar loader in linux with jogamp.

I extracted the swing rudimentary example jar into a directory and run this command and it works:
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar:. fi.jkauppa.joglrenderengine.JOGLRenderEngine

this command works too for the swing rudimentary example (no additional launch arguments required):
java -cp jogamp-fat.jar:. fi.jkauppa.joglrenderengine.JOGLRenderEngine

what it if works from .jar without using the jar-in-jar loader.
I tried to make a normal jar without the separate loader, but I cant seem to get the jogamp-fat.jar to load from the jar class-path.
jar files in jar files requires a separate class loader by java specification.

command used to run the basic jar without jar-in-jar loader (does not work):
java -jar joglrenderengine.jar

I'll report eclipse jar-in-jar loader seg fault in linux in eclipse forums.

edit: I setup eclipse for Java IDE in linux and jogamp-fat runs without any arguments from the IDE for the swing-one rudimentary example.
now only the runnable .jar does not work. only if you extract the .jar and run it without "java -jar myapp.jar".

edit: even the rudimentary example using awt runs in linux Eclipse IDE for Java without any arguments using jogamp-fat.jar.

working command line from linux eclipse IDE for Java (using default awt code):
/usr/lib/jvm/java-21-openjdk-amd64/bin/java
-Dfile.encoding=UTF-8
-Dstdout.encoding=UTF-8
-Dstderr.encoding=UTF-8
-classpath /home/tpalomaki/workspace/joglrenderengine/bin:/home/tpalomaki/workspace/pkg/jogl/jogamp-fat.jar
-XX:+ShowCodeDetailsInExceptionMessages fi.jkauppa.joglrenderengine.RudimentaryTest

on my current work IDE environments only windows awt requires additional launch arguments, not swing, not linux.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

gouessej
Administrator
Thank you for the feedback.

According to the wiki, the JAR in JAR stuff worked in the past:
https://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling#Eclipse

The only thing I can do as soon as possible consists in testing the Add-Opens manifest attribute and if I succeed in making it work, you'll be able to create an executable JAR as a fat JAR instead of using JAR in JAR somehow.

P.S: You'll always get some warnings when using Microsoft Windows specific flags under GNU Linux, the only way to get rid of them consists in creating separate bundles instead of one for all supported operating systems.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Unable to determine GraphicsConfiguration

Goofyseeker3
This post was updated on .
I do plan using the eclipse jdt jar-in-jar loader for all projects btw.
Yes even if the module support with arguments is added.
I wonder if the bug is in the jar-in-jar loader or somewhere else.
I dont plan to use any arguments in distributable packages.
Distribution packages as full jars without any package external arguments is a must.

Fixing the jar-in-jar support is first priority for me.

There is another possibility but its a bit sketch, which involves extracting jar contents into a mega fat jar,
but in my tests, it did not work for some/most native libraries. having libraries as separate jars in jar
is much better than trying to mix some jar folders into a file structure inside one jar.

As stated the jar's inside jar require separate loader by java spec.

The needed packages (swing-only) are able to load without any parameters, so the inside-jar loading (for linux) is the most critical feature.
1234