Setting up jogl on headless linux server with EGL driver

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

Setting up jogl on headless linux server with EGL driver

gouessej
Administrator
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Setting up jogl on headless linux server with EDL driver

ehlavaty
I have the code below in my java application. I am trying to run this application on a headless ubuntu 18.04 server with nvidia tesla v100 GPUs. Currently the only way I can get this to run successfully is if I have Xvfb running a virtual display. But the code isn't actually using the nvidia GPU's. when I print out vendor and renderer info I get "VMware, Inc." and
"llvmpipe (LLVM 9.0, 256 bits)"... I've done some reading and I should not even have to have Xvfb running if EGL driver is being used but I can't get my code to run without Xvfb. How can I use/properly setup JOGL with EGL driver?

GLProfile glp = GLProfile.getDefault();

GLCapabilities caps = new GLCapabilities(glp);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setBlueBits(8);
caps.setGreenBits(8);
caps.setOnscreen(false);
GLDrawableFactory factory = EGLDrawableFactory.getEGLFactory();
       
GLAutoDrawable drawable = factory.createOffscreenAutoDrawable(factory.getDefaultDevice(), caps, new DefaultGLCapabilitiesChooser(), 943, 468);
drawable.display();
drawable.getContext().makeCurrent();

GL3bc gl = drawable.getGL().getGL3bc();
gl.glEnable(GL_PROGRAM_POINT_SIZE);
gl.glEnable(GL2ES1.GL_POINT_SPRITE);

System.out.println(gl.glGetString(GL.GL_VENDOR));
System.out.println(gl.glGetString(GL.GL_RENDERER));
       
program = new Program(gl, Constant.EMPTY, "hello-triangle", "hello-triangle");
       
int positionAttributeLocation = gl.glGetAttribLocation(program.getName(), "a_position");
int resolutionUniformLocation = gl.glGetUniformLocation(program.getName(), "u_resolution");
       
FloatBuffer locationsBuffer = GLBuffers.newDirectFloatBuffer(locations);
       
gl.glGenBuffers(Buffer.MAX, bufferName);
       
gl.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
gl.glBufferData(GL_ARRAY_BUFFER, locationsBuffer.capacity() * Float.BYTES, locationsBuffer, GL_STATIC_DRAW);
gl.glViewport(0, 0, 943, 468);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL_COLOR_BUFFER_BIT);
gl.glUseProgram(program.getName());
gl.glEnableVertexAttribArray(positionAttributeLocation);
gl.glVertexAttribPointer(positionAttributeLocation, 2, GL_FLOAT, false, 0, 0);
gl.glUniform2f(resolutionUniformLocation, 943, 468);
       
gl.glDrawArrays(GL_POINTS, 0, (locations.length / 2));

Reply | Threaded
Open this post in threaded view
|

Re: Setting up jogl on headless linux server with EDL driver

gouessej
Administrator
Hello

At first, your source code isn't a SSCCE, it can't help, especially if the culprit is elsewhere.

Secondly, you use VMWare, the problem might come from VMWare, we can't support all hypervisors and it's a proprietary solution, I won't investigate any further. As far as I know, VirtualBox should work. VMWare and Citrix don't always support hardware acceleration, it depends on the offer you chose and on the settings.

Finally, I know that you can create a GLWindow using an offscreen surface (FBO), maybe it's what you need.
Julien Gouesse | Personal blog | Website