Posted by
odinsbane on
Sep 23, 2021; 4:37pm
URL: https://forum.jogamp.org/Unable-to-create-a-Canvas3D-because-I-cannot-get-a-GL2-context-tp4041316.html
I have a java3d program that was working great, but now I am trying to setup a new linux system and I get an error about GL2.
I have a program to query devices, and it fails with an error:
>com.jogamp.opengl.GLException: Not a GL2 implementation
at jogamp.opengl.es1.GLES1Impl.getGL2(GLES1Impl.java:4929)
I added a line to specifically request gl2 "GLProfile.get( GLProfile.GL2 )" and I get the following error:
>Exception in thread "main" com.jogamp.opengl.GLException: Profile GL2 is not available on X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x2df6226d, isOwner false, <12ed9db6, 4ff4357f>[count 0, qsz 0, owner <NULL>]]], but: [GLProfile[GLES1/GLES1.hw], GLProfile[GLES2/GLES3.hw], GLProfile[GL2ES1/GLES1.hw], GLProfile[GL4ES3/GL4.hw], GLProfile[GL2ES2/GL4.hw], GLProfile[GL4/GL4.hw], GLProfile[GLES3/GLES3.hw], GLProfile[GL4/GL4.hw], GLProfile[GL3/GL4.hw], GLProfile[GL2GL3/GL4.hw]]
at com.jogamp.opengl.GLProfile.get(GLProfile.java:991)
It seems my driver is not compatible with a pure GL2 context. Is there a way I can request a different context or does java3d require GL2?
The full output of the errors are here:
https://gist.github.com/odinsbane/64aebaeb9d8ff49e447967580385c8a9The test program is below.
```
import org.jogamp.java3d.Canvas3D;
import org.jogamp.java3d.GraphicsConfigTemplate3D;
import org.jogamp.java3d.VirtualUniverse;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLContext;
import java.awt.*;
import java.util.Map;
public class QueryDevice {
/**
* Prints out the systems 3D capabilities.
*
* @param args - whatever usually comes in from the cmd line. it isn't used.
*/
public static void main(String[] args) {
VirtualUniverse vu = new VirtualUniverse();
Map vuMap = vu.getProperties();
System.out.println("version = " + vuMap.get("j3d.version"));
System.out.println("vendor = " + vuMap.get("j3d.vendor"));
System.out.println("specification.version = "
+ vuMap.get("j3d.specification.version"));
System.out.println("specification.vendor = "
+ vuMap.get("j3d.specification.vendor"));
System.out.println("renderer = " + vuMap.get("j3d.renderer") + "\n");
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
/*
* We need to set this to force choosing a pixel format that support the
* canvas.
*/
template.setStereo(template.PREFERRED);
template.setSceneAntialiasing(template.PREFERRED);
GraphicsConfiguration config = GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getBestConfiguration(template);
Canvas3D c3d = new Canvas3D(config);
//System.out.println( GLProfile.get( GLProfile.GL2 ) );
Map<?, ?> c3dMap = c3d.queryProperties();
for(Object key: c3dMap.keySet()){
System.out.println(key + " " + c3dMap.get(key));
}
}
}
```