2

My opengl program creates a glwindow, draw images, capture the pixels and save as image file. It works well with my laptop, but it occurs freeglut error (failed to open display.) when I run the program in non-display linux ssh server. I believe 'glCreateWindow' occurs that error, but I can't generate Renderbuffer or Framebuffer without creating window.

glutInit(&myargc, myargv); glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); glutInitWindowPosition( 50, 50 ); glutInitWindowSize( WIDTH, HEIGHT ); main_window = glutCreateWindow("__Window__"); // CreateWindow glewInit(); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(GL_TEXTURE_2D, 0); LOG(INFO) << "0"; glGenRenderbuffers(1, &depth); LOG(INFO) << "1"; glBindRenderbuffer(GL_RENDERBUFFER, depth); 

If I run this code in non-display linux ssh server, the error message says "freeglut : failed to open display."

And If I skip creating window,

// main_window = glutCreateWindow("__Window__"); // skip this code 

The LOG output is only 0 then segmentation fault occurs, which means It cannot generate render buffer without window.

2
  • Thx. I'll try this. Commented Sep 4, 2019 at 8:11
  • I've tried exactly the same code from that link, but It still has same problem. XOpenDisplay() fails. Commented Sep 6, 2019 at 5:09

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.