I am running scripts on WSL that requires graphical output from mayavi but I am getting the following error:
GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2.
My current OpenGL version is OpenGL version string: 1.4 (2.1 Mesa 19.2.0-devel (git-cdf42f5eaa))
I tried updating the OpenGL drivers via various solutions including:
export DISPLAY=:0
export DISPLAY=localhost:0
export LIBGL_ALWAYS_INDIRECT=1
Added ubuntu-x-swat into repository then upgrading via (ie. sudo apt-get upgrade)
export MESA_GL_VERSION_OVERRIDE=4.5; export MESA_GLSL_VERSION_OVERRIDE=150;
... but none of these solutions work!
Any kind souls got an idea how I can fix this issue?
export LIBGL_ALWAYS_INDIRECT=0
^this worked for me. Im using wsl2 ubuntu-20.04 and running X-server with multiple windows, uncheck native opengl and check disable access control
This maybe because your have use the indirect rendering mode.
What's the output when you execute the command glxinfo -B, if the 'direct rendering' is no, you can set it to yes by execute the command 'LIBGL_ALWAYS_INDIRECT=0'.
Then execute the command 'glxinfo -B' again and observe the version of opengl.
Related
I'm using PyOpenGL+glfw for rendering.
When trying to do the same on a headless machine (e.g a server) glfw.init() fails:
glfw.GLFWError: (65544) b'X11: The DISPLAY environment variable is missing'
Fatal Python error: Couldn't create autoTLSkey mapping
Aborted (core dumped)
I found some information about headless rendering, but only when using OpenGL directly and not through python
EDIT: I understand that maybe glfw isn't able to support it. A solution without glfw, but with something else might also work...
The solution is to use xvfb for a virtual framebuffer.
The problem is that the glfw that is installed in Ubuntu using apt-get install libglfw3 libglfw3-dev is old and unfit, so we need to compile it from source.
Here is a full working docker example:
docker run --name headless_test -ti ubuntu /bin/bash
# Inside the ubuntu shell:
apt update && apt install -y python3 python3-pip git python-opengl xvfb xorg-dev cmake
pip3 install pyopengl glfw
mkdir /projects
git clone https://github.com/glfw/glfw.git /projects/glfw
cd /projects/glfw
cmake -DBUILD_SHARED_LIBS=ON .
make
export PYGLFW_LIBRARY=/projects/glfw/src/libglfw.so
xvfb-run python3 some_script_using_pyopengl_and_glfw.py
And here is the base of PyOpenGL code to use it:
from OpenGL.GL import *
from OpenGL.GLU import *
import glfw
glfw.init()
# Set window hint NOT visible
glfw.window_hint(glfw.VISIBLE, False)
# Create a windowed mode window and its OpenGL context
window = glfw.create_window(DISPLAY_WIDTH, DISPLAY_HEIGHT, "hidden window", None, None)
# Make the window's context current
glfw.make_context_current(window)
GLFW does not support headless OpenGL at all.
https://www.glfw.org/docs/latest/context.html#context_offscreen
GLFW doesn't support creating contexts without an associated window.
This isn’t an unusual limitation, the problem is that the normal way to create an OpenGL context is by using the X server. There are now alternatives using EGL, which is relatively new. You will need to use an EGL wrapper for Python.
See: OpenGL without X.org in linux
If you want to use OpenGL without a display environment on linux(eg. x server) the best approach is to use EGL. what EGL does is it separate OpenGL context management from windowing system, so it let you create context without a displaying window.
If you are using Nvidia graphics card, you have to install proprietary driver in order to use it. along with the driver there is a library called GLVND this is a library which include EGL your app need to linked against.
Please refer to following links to learn how to use EGL:
Pro Tip: Linking OpenGL for Server-Side Rendering
EGL Eye: OpenGL Visualization without an X Serve
PS. If your EGL api cannot find any devices, you probably linked wrong EGL library, the EGL library must match the driver.
I have a unix binary file built with QT and OpenGL which I'm trying to execute on linux-64. It is a simple visual program that shows 2d and 3d graphics.
I have installed all necessary dependencies such as QT and openGL libraries.
However, I have stuck with the following error trying to execute the binary
QXcbIntegration: Cannot create platform OpenGL context, neither GLX
nor EGL are enabled
However, the binary eventually runs but with some missing features such as 3D graphics.
my setup includes: virtual linux-64 using virtualBox, Vagrant, x-11 forwarding, and a Mac machine.
Eventually I realised that OpenGL 3.3 wouldn't work easily on virtual machines .. yet. I had to boot from ubuntu usb and work from there by installing latest mesa 3d package.
This shows a similar issue and the developer in the comment said our 3D support is not very clean in Linux guests, hence the warnings. You can give a try to VMware.
After some time trying to get some opengl working on a particular locked down linux box, I ended up going back to Qt Creator 2.5.2 .
http://download.qt.io/archive/qtcreator/2.5/
http://download.qt.io/archive/qtcreator/2.5/qt-creator-linux-x86_64-opensource-2.5.2.bin
After getting it on the linux box...
chmod u+x *.bin
./qt-creator-linux-x86_64-opensource-2.5.2.bin
And after a short installer, Qt Creator is working!
Basically QtQuick is a requirement in any Qt Creator built after 2.5 (aka Qt 5.x) and QtQuick NEEDS opengl libraries and support.
Hope that helps.
I see this problem when executing Qt App, I was executing in dash prompt. (Ubuntu 16.04 has dash by default). I changed to bash prompt and rebuilt my QT App. This error is gone.
To configure bash I used below command.
sudo dpkg-reconfigure dash
I currently am using VMWARE 11 guest Linux Mint, on a host win 8.1
So i am basically trying to update OpenGL so that i can program with higher versions of GLSL and OpenGL such as 3.3 , as it currently stands when i check with glxinfo | grep OpenGL , i get
$ glxinfo | grep OpenGL
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE;
OpenGL version string: 2.1 Mesa 10.1.3
OpenGL shading language version string: 1.20
OpenGL extensions:
Now i went to Mesa3d website and downloaded the 10.5.6(as you can see above the one i have installed is 10.1.3)in which the OPenGL version has been updated to version 3.3 which is what i would prefer to have over the current version which is 1.2(shading language GLSL) i downloaded the tar , extracted it , ran ./configure as instructed, and it did its thing, ran make as ./configure finished by saying run make now , and finally ran sudo install make which was the last autoconf instruction , and all completed successfully, i even ran them a second time when i found out that glxinfo | grep OpenGL was still giving me the same return as before i "installed" the mesa 3d drivers
so i am trying to find out what is missing here and why this is not installing?
is it because of the fact that i am running a guest OS linux on a host vmware?or is it something less complicated and actually fixable?
Did you uninstall the system Mesa installation? Because if not you've got two Mesa installations side-by-side and that will not end well. Also when configuring you should select the parts of Mesa you want. Which in your case would be none of the GPU drivers and just the softpipe implementation.
My SO is OpenSuse version 12.2 (x86_64) Mantis, with KDE desktop.
I have currently the NVidia driver (319) installed from the repository. 3D acceleration work and the driver seem to support OpenGL 4.3.
I am trying to programme a simple OpenGL sample (just a triangle in a glut windows), but I am unable because GL/gl.h is outdated: the current header is the mesa with openGL 1.3, which does nos support glCreateShader, glAttachShader...
I have tryed $ sudo find / -name gl3.h (openGL 3.1 and further should include this header) but it does not return any result, so I suppose Nvidia driver does not include library/headers.
My question is: Where can I get the GL/gl.h for the installed NVidia driver? Onyone has got this same problem and solve it?
P.S.
To install the NVidia driver, I just installed the driver from the NVidia repository for opensuse 12.2 (http://download.nvidia.com/opensuse/12.2/) (with Yast)
I have installed:
nvidia-computeG03 (NVIDIA driver for computing with GPGPU)
nvidia-gfxG03-kmp-desktop (NVIDIA graphics driver kernel module for GForce 8xxx and newer GPUs)
x11-video-nvidiaG03 (NVIDIA graphics driver for GeForce 8xxx and newer GPUx)
The correct way to access the newer features is via the GL extension mechanism. You are fine with mesa's GL.h. What you need is a current version of glext.h (which does come with the nivida drivers, iirc, but can also be found on the official opengl site). YOu then would have to query a function pointer for any function you plan to call, on your platform probably via glXGetProcAddress().
A more convenient way is to use an OpenGL loader library like glew, which will do all this for you.
Note that you could, in theory, #define GL_GLEXT_PROTOTYPES before including glext.h and directly call the functions. This is likely to work with the nvidia driver (and some others on your platform), but not guaranteed to work by any spec. And it is never going to work on other platforms, like Windows.
My core problem is that I need to run multiple OpenGL executables concurrently on an EC2 GPU instance; I'm observing non-deterministic segfaults when trying to do this. The same program runs fine (with concurrency) on my Macbook Pro.
The application works as follows:
python script launches multiple worker executables (i.e. concurrent subprocess.call() calls from a multiprocessing.pool.ThreadPool threadpool). The python script provides a JSON file as worker input and the worker writes JSON to a file.
Each worker is a C++ program that does some headless image rendering in OpenGL using fragment shaders and a render-to-texture pipeline. I've tried using both Glut and GLX rendering contexts.
I'm confident that neither the python script nor the C++ workers have major bugs because the whole application runs fine when:
running a single worker on the EC2 GPU instance
running one or more workers on my Macbook (OSX 10.7.4)
The specific error I observe is that one or more of the workers will segfault inside an OpenGL call (e.g. glTexSubImage2D, glDrawElements, etc) after a few minutes of execution. Sometimes I've seen failures in the GLX context setup stage (e.g. glXCreateNewContext or glXChooseFBConfig). If I start more workers (i.e. higher concurrency), I see errors sooner. If I start fewer workers, it can take 15-30 minutes before a crash.
I believe that I'm having some sort of OpenGL context or driver issue. I've tried setting up my context using both GLUT and GLX and neither seems to help.
My procedure for creating the EC2 instance is very close to the instructions given here: http://hpc.nomad-labs.com/archives/139 . The specific packages I install are:
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libegl1-mesa libglu1-mesa-dev mesa-utils mesa-utils-extra llvm-dev imagemagick libboost-all-dev python2.6 python-imaging python-matplotlib python-numpy python-scipy firefox clang python-setuptools python-scipy libatlas-dev ccache libpng12-dev libmagick++-dev glew-utils xvfb x11-utils qiv xinit
On both OSX and Linux, the C++ worker links: GL GLU glut pthread m X11.
I generated my xorg.conf using:
$ nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
Before running my program, I run:
$ startx &; export DISPLAY=:0
I've tried some non-nvidia drivers, but they don't seem to help either.
I've also consulted the FAQ on parallel processing with OpenGL: http://www.equalizergraphics.com/documentation/parallelOpenGLFAQ.html
The guide suggests that multithreaded GLX on Ubuntu doesn't work (and I've confirmed that personally.. :) but it seems that multiprocess GLX should be feasible and stable.
Does anybody have any ideas as to
why the OpenGL/GLX calls might be failing? Am I indeed seeing a driver issue? It seems like Mac GPU drivers have some sort of 'magic feature' aiding concurrent OpenGL usage. Are there any Ubuntu/Linux drivers with that same feature?
are there best practices for running multiple OpenGL executables concurrently on an EC2 GPU instance (or any headless Ubuntu/Linux machine for that matter)? Can anybody point me towards Open Source software that does this?
.. 1 year later..
I've found that a lot of times the gpu won't be enable on headless machines.
try to vnc in first and see if that helps.