12

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.

vmrfreitas
  • 183
  • 1
  • 2
  • 11
  • What command did you use to compile? – Eli Sadoff Nov 17 '16 at 00:03
  • @EliSadoff g++ main.cpp -o lookAtThis -lglut – vmrfreitas Nov 17 '16 at 01: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 '16 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 '16 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 '16 at 13:02
  • @datenwolf interesting, thanks for the reply! – vmrfreitas Nov 17 '16 at 13:10
  • related: https://askubuntu.com/questions/893922/ubuntu-16-04-x-error-of-failed-request-badvalue-integer-parameter-out-of-range – Ciro Santilli OurBigBook.com Nov 28 '17 at 10:02

3 Answers3

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!

Mircea
  • 954
  • 1
  • 13
  • 17
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.

9

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

jstm
  • 420
  • 4
  • 14