I am using JME3.7.0-stable.zip
windows jdk 21, it works fine. no problem.
However in RHEL 8.10, JDK21
Failed to initialize OpenGL context
LWJGLException: Could not find GLX 1.3 config from peer info
How to resolve this problem…?
I am using JME3.7.0-stable.zip
windows jdk 21, it works fine. no problem.
However in RHEL 8.10, JDK21
Failed to initialize OpenGL context
LWJGLException: Could not find GLX 1.3 config from peer info
How to resolve this problem…?
Check that you have latest and greatest display drivers. Also you might want to test LWJGL 2 or 3, depending which one you are using now.
Also what does Swing do here?
I tried on JME3.6.0-stable.zip
My Application has two java file
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
/** Sample 1 - how to get started with the most simple JME 3 application.
Display a blue 3D cube and view from all sides by
moving the mouse and pressing the WASD keys. */
public class HelloJME3 extends SimpleApplication {
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1); // create cube shape
Geometry geom = new Geometry(“Box”, b); // create cube geometry from the shape
Material mat = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material
mat.setColor(“Color”, ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube’s material
rootNode.attachChild(geom); // make the cube appear in the scene
}
}
import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
import java.awt.Canvas;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
/*
/**
*
@author ADMIN
*/
public class mySwing {
public static void main(String args){
HelloJME3 app = new HelloJME3();
//app.start(); // start the game
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
AppSettings settings = new AppSettings(true);
settings.setWidth(640);
settings.setHeight(480);
app.setSettings(settings);
app.setPauseOnLostFocus(false);
app.createCanvas();
app.startCanvas(true);
JmeCanvasContext context = (JmeCanvasContext) app.getContext();
Canvas canvas = context.getCanvas();
canvas.setSize(settings.getWidth(), settings.getHeight());
// In this case the JME Canvas is not centered in the JFrame
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(canvas);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
}
When i run this application in Windows enviroment (Windows 10 / JDK21), it works fine.
However when i run this application in Linux (RHEL 8.10 and JDK21)
it shows following error
run:
Feb 24, 2025 9:49:42 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-stable
Feb 24, 2025 9:49:45 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread “jME3 Main”
Kindly let me how to resolve this.
As to your actual problem…
The older lwjgl2 works with Swing. The newer lwjgl3 does not like Swing.
I think at some version, JME changed which one it defaults to.
Are you running the latest graphics drivers?
You are running on LWJGL 2 it seems, which is the default. You can try with LWJGL 3. But there is a catch, LWJGL 3 works with Swing only on jME 3.7 and onwards. With 3.6 you’ll have no luck getting it to work.
i checked on jME 3.7
Still not working… Pls check following output
run:
Feb 26, 2025 1:40:34 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-stable
Feb 26, 2025 1:40:34 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread “jME3 Main”
Also i checked GLX details. It shows as below
GLX_SGI_swap_control, GLX_SGI_video_sync
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
GL_EXT_shader_framebuffer_fetch_non_coherent, GL_EXT_shader_group_vote,
GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
GL_EXT_shader_io_blocks, GL_EXT_tessellation_point_size,
[admin@localhost ~]$
Kindly guide.
Phew, well, my questions and suggestions are still the same. I’m not going to offer them for the 3rd time. I assume you tried them despite seeing any evidence you did.
Hi @mahesh_jme
First I would like to ask a couple of things.
It’s a bit difficult to read the output you shared (I suggest you follow the standard shared by @pspeed), from what I see it can’t load or find GLX which is the GL library for X11, so you may need to check the window manager you are using (since lwjg2 has no Wayland support).
You can also try lwjgl3 as @tonihele mentioned.
From my experience, you have to use lwjgl3 if running jme with swing on linux. This combination will not work with lwjgl2.
I had the same issue when I switched my PC from windows to linux. I ended up having to upgrade to lwjgl3 to get my application working on linux.
Also you have to use the latest stable version of jme (3.7). Older versions did not work with swing + lwjgl3
Kindly let me now, how to include lwjgl3 in the existing project. I am using Apache-netbeans-2-4 with Ant.
Just swap out LWJGL jar with LWJGL3 jar, that should be it.
-rw-r–r-- 1 root root 265030 Apr 3 07:14 gson.jar
-rw-r–r-- 1 root root 536430 Apr 3 07:14 jbullet.jar
-rw-r–r-- 1 root root 207250 Apr 3 07:14 jinput.jar
-rw-r–r-- 1 root root 240835 Apr 3 07:14 jinput-natives-all.jar
-rw-r–r-- 1 root root 20827 Apr 3 07:14 jme3-android-native-sources.jar
-rw-r–r-- 1 root root 115697 Apr 3 07:14 jme3-android-sources.jar
-rw-r–r-- 1 root root 21566 Apr 3 07:14 jme3-awt-dialogs.jar
-rw-r–r-- 1 root root 11758 Apr 3 07:14 jme3-awt-dialogs-sources.jar
-rw-r–r-- 1 root root 2096695 Apr 3 07:14 jme3-core.jar
-rw-r–r-- 1 root root 3870391 Apr 3 07:14 jme3-core-sources.jar
-rw-r–r-- 1 root root 237114 Apr 3 07:14 jme3-desktop.jar
-rw-r–r-- 1 root root 200988 Apr 3 07:14 jme3-desktop-sources.jar
-rw-r–r-- 1 root root 580356 Apr 3 07:14 jme3-effects.jar
-rw-r–r-- 1 root root 589651 Apr 3 07:14 jme3-effects-sources.jar
-rw-r–r-- 1 root root 32556 Apr 3 07:14 jme3-ios-sources.jar
-rw-r–r-- 1 root root 233971 Apr 3 07:14 jme3-jbullet.jar
-rw-r–r-- 1 root root 469195 Apr 3 07:14 jme3-jbullet-sources.jar
-rw-r–r-- 1 root root 10530 Apr 3 07:14 jme3-jogg.jar
-rw-r–r-- 1 root root 8437 Apr 3 07:14 jme3-jogg-sources.jar
-rw-r–r-- 1 root root 101425 Apr 3 07:14 jme3-lwjgl3-sources.jar
-rw-r–r-- 1 root root 102521 Apr 3 07:14 jme3-lwjgl.jar
-rw-r–r-- 1 root root 69672 Apr 3 07:14 jme3-lwjgl-sources.jar
-rw-r–r-- 1 root root 193477 Apr 3 07:14 jme3-networking.jar
-rw-r–r-- 1 root root 223677 Apr 3 07:14 jme3-networking-sources.jar
-rw-r–r-- 1 root root 42123 Apr 3 07:14 jme3-niftygui.jar
-rw-r–r-- 1 root root 34139 Apr 3 07:14 jme3-niftygui-sources.jar
-rw-r–r-- 1 root root 338217 Apr 3 07:14 jme3-plugins.jar
-rw-r–r-- 1 root root 7783 Apr 3 07:14 jme3-plugins-json-gson.jar
-rw-r–r-- 1 root root 16373 Apr 3 07:14 jme3-plugins-json-gson-sources.jar
-rw-r–r-- 1 root root 4465 Apr 3 07:14 jme3-plugins-json.jar
-rw-r–r-- 1 root root 18919 Apr 3 07:14 jme3-plugins-json-sources.jar
-rw-r–r-- 1 root root 292945 Apr 3 07:14 jme3-plugins-sources.jar
-rw-r–r-- 1 root root 192519 Apr 3 07:14 jme3-terrain.jar
-rw-r–r-- 1 root root 204295 Apr 3 07:14 jme3-terrain-sources.jar
-rw-r–r-- 1 root root 187889602 Apr 3 07:14 jme3-testdata-sources.jar
-rw-r–r-- 1 root root 23871226 Apr 3 07:14 jme3-vr-sources.jar
-rw-r–r-- 1 root root 73123 Apr 3 07:14 j-ogg-vorbis.jar
-rw-r–r-- 1 root root 31866 Apr 3 07:14 jsr305.jar
-rw-r–r-- 1 root root 1076471 Apr 3 07:14 lwjgl.jar
-rw-r–r-- 1 root root 572075 Apr 3 07:14 lwjgl-platform-natives-linux.jar
-rw-r–r-- 1 root root 426809 Apr 3 07:14 lwjgl-platform-natives-osx.jar
-rw-r–r-- 1 root root 613736 Apr 3 07:14 lwjgl-platform-natives-windows.jar
-rw-r–r-- 1 root root 263472 Apr 3 07:14 nifty-default-controls.jar
-rw-r–r-- 1 root root 785564 Apr 3 07:14 nifty.jar
-rw-r–r-- 1 root root 169541 Apr 3 07:14 vecmath.jar
-rw-r–r-- 1 root root 120069 Apr 3 07:14 xpp3.jar
Above all *.jar of DOWNLOADED FROM
https://github.com/jMonkeyEngine/jmonkeyengine/releases/download/v3.7.0-stable/jME3.7.0-stable.zip
Kindly let me know which file has to be renamed to what, to get lwgl3 activated in the program.
Don’t rename anything. Just use alternate JARs. You can’t find these JARs from the ZIP distribution, seems that only LWJGL 2 is included in that.
You can however get the from i.e. Maven Central (https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-lwjgl3/3.7.0-stable). But also you should really consider using Gradle or Maven. Managing dependencies with Ant requires some skill that modern humans don’t have anymore…
When i created fresh maven repository based JME 3-7 with lwgl3.
It shows following error
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project mavenproject1: Command execution failed.: Process exited with an error: 1 (Exit value: 1) → [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation
Refer Screenshot
Well, even I don’t see it. So probably not Maven either. Probably best to try to Google or use your favourite AI to solve any Maven problems you should have.
I would at least limit my aid to be quite jME specific. Besides jME kinda assumes you know Java and build systems. If you struggle with the latter and don’t particularly want to get invested into those, you should either use jME SDK or the quick start on the web page to create a project structure for you so you can simply focus on the coding part.
Can you have graphics card in your linux system?
Hi @mahesh_jme
I’m not sure what you’re doing, but from the image you shared and the maven output, it looks like on line 1 you don’t have the package defined.
package com.example.mypackage;
Since i am posting my query very long period. I just rewind all the issue as follows
SEVERE: Failed to initialize OpenGL context
org.lwjgl.LWJGLException: Could not find GLX 1.3 config from peer info
at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method)
at org.lwjgl.opengl.LinuxPbufferPeerInfo.(LinuxPbufferPeerInfo.java:52)
at org.lwjgl.opengl.LinuxDisplay.createPbuffer(LinuxDisplay.java:1348)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:235)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:220)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:191)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:167)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:353)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:492)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:120)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:224)
at java.base/java.lang.Thread.run(Thread.java:1570)
However when i run this program on high-end workstation having dedicated NVIDIA card
it runs smoothly.
However on simple desktop computer having integrated graphics card, it shows above error. (Point No 5.)
i was asked by JME experts on this discussion to use Maven repository instead of Simple inclusion of jars directly from JME -3-7-0-stable.zip
Based on the advice i created a same program having maven repository base.
This time following error shown
-----------------< com.mycompany:TRY_SWING_JME_MAVEN >------------------
Building TRY_SWING_JME_MAVEN 1.0-SNAPSHOT
from pom.xml
--------------------------------[ jar ]---------------------------------
— resources:3.3.1:resources (default-resources) @ TRY_SWING_JME_MAVEN —
skip non existing resourceDirectory /home/admin/NetBeansProjects/TRY_SWING_JME_MAVEN/src/main/resources
— compiler:3.11.0:compile (default-compile) @ TRY_SWING_JME_MAVEN —
Nothing to compile - all classes are up to date
— exec:3.1.0:exec (default-cli) @ TRY_SWING_JME_MAVEN —
LWJGL-OpenGL3
Apr 06, 2025 3:19:13 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-stable
If any body guide, how to resolve this issue.
Regards
I usually create a GL context (JME3) with AWT as follows (works on Windows and Linux as long as LWJGL3 is used).
To start a GL context with LWJGL3, you can follow these steps:
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
public class Jme3Application extends SimpleApplication {
private Geometry geom;
@Override
public void simpleInitApp() {
getFlyByCamera().setEnabled(false);
getFlyByCamera().unregisterInput();
Box b = new Box(1, 1, 1);
geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Orange);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
@Override
public void simpleUpdate(float tpf) {
float speed = FastMath.PI/2;
geom.rotate(0, tpf * speed, 0);
}
}
import com.jme3.system.JmeCanvasContext;
import javax.swing.*;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class AWTApplication extends JFrame {
private Jme3Application app3D;
private Canvas canvas;
private JPanel myContextPanel;
public AWTApplication() {
simpleInitApp();
}
private void simpleInitApp() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("AWT - LWJGL3");
myContextPanel = new JPanel();
myContextPanel.setLayout(new BorderLayout());
getContentPane().add(myContextPanel);
/* start JME3 */
setupJMEContext();
pack();
setLocationRelativeTo(null);
}
private void setupJMEContext() {
app3D = new Jme3Application();
app3D.createCanvas();
app3D.startCanvas();
canvas = ((JmeCanvasContext) app3D.getContext()).getCanvas();
if (canvas == null) {
JOptionPane.showMessageDialog(null, "Error starting GL context");
return;
}
canvas.setPreferredSize(new Dimension(1024, 576));
myContextPanel.add(canvas, BorderLayout.CENTER);
}
public static void main(String[] args) {
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException |
IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
Logger.getLogger(AWTApplication.class.getName()).log(Level.SEVERE, null, ex);
}
/* start AWT/Swing and JME3 */
EventQueue.invokeLater(() -> {
new AWTApplication().setVisible(true);
});
}
}
I’m not a big fan of Maven (I like Gradle more than Maven), but for this test I have the following dependencies in Maven (pom.xml file).
<dependencies>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-core</artifactId>
<version>3.7.0-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-plugins</artifactId>
<version>3.7.0-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-desktop</artifactId>
<version>3.7.0-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-lwjgl3</artifactId> <!-- USE LWJGL3 -->
<version>3.7.0-stable</version>
</dependency>
</dependencies>
[ EDIT ]
You can see some examples here