opengl programming from Windows to Unix

Need to write a program in Unix, I already wrote the program using Visual C++ in the Windows environment and it run perfectly, but when I try to run the program in a Unix environment, I keep getting “GLUT: Fatal Error: cannot open display”. Is there something that I am missing something, an extension or something? If you know please help.


ok, you’re having problems getting a handle on X. (er, your code, i mean, getting a handle).

your program needs to be able to open a graphics context under X. It might not be able to do this if

  1. X isn’t running on the system
  2. you don’t have permission to connect to the machine with X
  3. your DISPLAY isn’t setup properly


firstly, you need to make sure you have X windows running on the machine you want to use as the display. (note! this isn’t necessarily the saem amchine you’re running the program on. see note (3)). you start x by running ‘startx’ if it’s installed.

secondly; you need to make sure you have permisisons to connect to the machine. if you’re running it on the local machine then you obviously have permission to run stuff if you’re getting the glut error. (but you might NOT have permission if you want the display to appear on a second machine)

thirdly; you need to make sure your DISPLAY variable is set up properly. There is a convention to grab the display from the command line (with -display <machine> ) and then from the env variable DISPLAY. the simplist way to set that is to do ‘setenv DISPLAY :0.0’. this says to connect to the first monitor on the first graphics device of the local machine; EVERYONE should have a :0.0. (and, yes, if you have multiple monitors then the second display is :0.1, and if you ahve anotoher graphcis card then its :1.0, and so on). if you want to run the display on another machine then you need its full address like so: ‘setenv DISPLAY’.

hope this helps


See my reply in the Linux forum.

PS: Cross-posting is generally frowned upon.

Why not posting it here? it is called the beginners forum! Not the beginners PC based only forum only…

Originally posted by rts:
[b]See my reply in the Linux forum.

PS: Cross-posting is generally frowned upon.[/b]