14

I'm trying to compile and run this c++ code

#include <GL/glut.h>

void displayMe(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(0.5, 0.0, 0.0);
        glVertex3f(0.5, 0.5, 0.0);
        glVertex3f(0.0, 0.5, 0.0);
    glEnd();
    glFlush();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE);
    glutInitWindowSize(300, 300);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Hello world :D");
    glutDisplayFunc(displayMe);
    glutMainLoop();
    return 0;
}

which is a "opengl's hello world" I found online. I'm doing this to test my university's NVIDIA Tegra X1, the TX1 development kit is always on and connected to the university's network. I'm connecting to the TX1 via ssh (using the -X flag). Compiling went fine, but when I try to run the program, this error appears:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  29
  Current serial number in output stream:  30

I haven't found anything online and I have no idea what is going on.

PS: I'm connecting first to my university's network via ssh (using -X) and then I do another ssh to connect to the TX1.

7
  • What command did you use to compile?
    – Eli Sadoff
    Nov 17, 2016 at 0:03
  • @EliSadoff g++ main.cpp -o lookAtThis -lglut
    – vmrfreitas
    Nov 17, 2016 at 1:18
  • 3
    When you do X-over-SSH then OpenGL commands are serialized into the X11 transport to be processed by the display server and hardware on the machine you're logging in from. So you're not even using the Tegra for OpenGL.
    – datenwolf
    Nov 17, 2016 at 11:11
  • @datenwolf really? I didn't realize that. So I can't test the graphic output of the TX1 via ssh?
    – vmrfreitas
    Nov 17, 2016 at 12:39
  • @ViniciusMilaniR.Freitas: Not via X11 tunneling. X11 is effectively just transmitting the drawing commands (as remote procedure calls) to the X11 server on the machine with the display, and the commands are executed there. What you have to do is start an X11 server on the remote machine (does that even work with Tegra?) and use some remote framebuffer (VNC or such) to transmit the result.
    – datenwolf
    Nov 17, 2016 at 13:02

3 Answers 3

13

I was getting this same error when running glxgears (to check that OpenGL was running properly). I then realized that my nvidia-drivers were borked:

$ nvidia-smi
Failed to initialize NVML: Driver/library version mismatch

I just needed to restart my computer. nvidia-smi and glxgears worked after reboot.

In summary: try restarting your computer

2
  • 2
    I think this is the problem. I copy my file to another machine and the problem dissapeared Dec 7, 2022 at 15:22
  • Incredible how the most simple solution provides a fix for any problems. Thanks Nov 6 at 23:22
11

I was getting errors like this:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  35
  Current serial number in output stream:  36
name of display: :99

On a remote machine, with nvidia graphics card. Solved the problem by installing the NVIDIA driver from .run file, with the option --no-opengl-files (Inspired from here: https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

Hope this helps!

5
  • 18
    btw, this specific error (GLX:24 X_GLXCreateNewContext) error will happens when your video driver is updated for a running X server, restart X to resolve it Sep 21, 2020 at 20:05
  • 2
    @ThorSummoner I had this same issue, and I did just update my Nvidia drivers. Restarting X did fix it as you suggested. So, thank you. Oct 26, 2020 at 17:40
  • @ThorSummoner Thank you so much, just ran into this and your solution worked perfectly!
    – kodywilson
    Apr 26, 2021 at 17:22
  • 2
    For future readers, I fixed my problem by just running sudo apt --fix-broken install followed by sudo reboot.
    – mhdadk
    Aug 5, 2022 at 22:29
  • 1
    Mircea, did you find anything posted useful? It is useful if you provide feedback. Nov 9, 2022 at 18:42
9

Adding my user to the video group and rebooting solved the problem for me (source). glxgears now also works. Still have to check if there are other related issues not resolved.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.