Getting Java and OpenGL Playing Nicely Together

Please can you help me with an OpenGL version configuration issue, when running a Java API that uses JavaFX / OpenGL. I’m a complete OpenGL newbie and have very little understanding of the underlying architecture.

I would otherwise post this in “programming”, but seeing as its an API I have no control over that’s rendering the graphics, its a configuration issue, not a coding issue, so I’m posting it here.

I’m trying to run the ArcGIS SDK For Java on Ubuntu. ArcGIS is an API that uses OpenGL to render 3D views of the earth (not dissimilar to Google Earth). I seem to be having OpenGL / GLSL issues getting the 2 to play nicely together.

When I try and execute my program, I get the error:

Java version : 1.8.0_151 (Oracle Corporation) amd64
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Error code: 18
Error message: Internal error exception
Additional error message: star_draw,GL_VERTEX_SHADER:0:3(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES
at com.esri.arcgisruntime.internal.mapping.view.RenderingContext.nativeDrawMap(Native Method)

Very simple main program:

    @Override
    public void start(Stage stage) throws Exception {

        stage.setTitle("SkylaCTL");
        stage.setWidth(800);
        stage.setHeight(400);

        StackPane stackPane = new StackPane();
        Scene scene = new Scene(stackPane);

        ArcGISScene arcGISScene = new ArcGISScene();
        arcGISScene.setBasemap(Basemap.createImagery());

        sceneView = new SceneView();
        sceneView.setArcGISScene(arcGISScene);
        stackPane.getChildren().addAll(sceneView);

        stage.setScene(scene);
        stage.show();
    }

I have no idea where to start with this. I’m hoping that the versions of supported OpenGL are not fixed, depending on the support my graphics card offers. Running glxinfo results in:

mark@marks-computer:~$ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.4.0-devel
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 17.4.0-devel
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 17.4.0-devel
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

Running lspci | grep VGA, I get:

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)

Hoping to find a way around this.

The error message you’re getting:

is consistent with this subset of the system info you’ve provided:

$ glxinfo | grep version…
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.4.0-devel
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 17.4.0-devel
OpenGL shading language version string: 1.30 <=== GLSL version (compatibility profile)

So the program you want to run needs GLSL version 1.50, but your OpenGL driver (Mesa3D) only supports GLSL version 1.30 (in the compatibility profile), which is the GLSL version provided by OpenGL version 3.0.

Running lspci | grep VGA, I get:

This is not a reliable way to find all the possible GPUs (display adapters) in your system. Also look through this list for anything which has 3D, Display, NVIDIA, AMD, or ATI in it for instance. I’d check to verify that you don’t have another GPU in your system.

“lshw” is another command you can use to list hardware installed in your system, including GPUs.

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)

So you at least have this GPU buried in your Intel CPU. My guess is if you listed the renderer string in the glxinfo output, it’d say something like:

OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)

which would indicate that your Mesa3D drivers are trying to use the Intel GPU for rendering. OpenGL 3.0 / GLSL 1.30 (compatibility profile) is just the best they can do.

Let’s see what other GPUs you unearth from running “lspci” and “lshw”. You may already have an NVIDIA or AMD GPU installed in your system. If not, buy an inexpensive one, pop it in your system, and install the NVIDIA or AMD graphics drivers.

But before doing that, you could check to see if there’s an update for Mesa3D in your package manager. If so, updating to the latest version available might possibly get you better OpenGL support with Mesa3D and your existing on-chip Intel GPU.

I just happened to trip over a mention on the net that indicates that Mesa3D GL drivers never report an OpenGL Compatibility version > 3.0 (similarly for the GLSL compatibility version 1.30). I don’t know the back-story on this.

Your software wants GLSL 1.50 which is OpenGL 3.20. So no guarantees (this may very well crash or cause problems), but you might try telling Mesa3D to override the version it’s reporting with:


export MESA_GL_VERSION_OVERRIDE=3.2COMPAT

(or similar setenv syntax if you’re using csh/tcsh). Note also that there’s a MESA_GLSL_VERSION_OVERRIDE envvar if you need it (see the bottom link below).

I figure this is worth a shot before you go buying a new GPU.

A few links to more info on these and other Mesa3D env vars:

[ul]
[li]Dying Light reports OpenGL version 3.0 with mesa-git [/li][li][Mesa-users] version string for OpenGL not correct? [/li][li]Environment Variables (Mesa3D) [/li][/ul]

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.