Hi,

I use the following code to initialize OpenGL:

Code :
static int attrib_list1[] = {GLX_RGBA, GLX_RED_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_ACCUM_RED_SIZE, 16, GLX_ACCUM_GREEN_SIZE, 16, 
GLX_ACCUM_BLUE_SIZE, 16, GLX_ACCUM_ALPHA_SIZE, 16, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None};
static int attrib_list2[] = {GLX_RGBA, GLX_RED_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_ACCUM_RED_SIZE, 16, GLX_ACCUM_GREEN_SIZE, 16,
GLX_ACCUM_BLUE_SIZE, 16, GLX_ACCUM_ALPHA_SIZE, 16, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None};
 
// get a connection
dpy  =XOpenDisplay(NULL);
if (!dpy) cout << "Error: Can't open display\n" << flush;
 
// get an appropriate visual
XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib_list1);
if (!vi)  
  vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib_list2);
if (!vi) 
  cout << "Error: No suitable visual\n" << flush;
 
// create a GLX context
cx = glXCreateContext(dpy, vi, NULL, true);
 
// create a window
XSetWindowAttributes swa;
swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, sWidth, sHeight, 0, vi->depth, InputOutput, vi->visual, CWColormap, &amp;swa);
 
// connect the context to the window
glXMakeCurrent(dpy, win, cx);
On some computers this works, on others it crashes (ie. takes me back to the login) when the first gl-Command (eg. glEnable(GL_DEPTH_TEST) is executed.

Any ideas what's wrong?

Thanks
Shagrath

[This message has been edited by Shagrath (edited 02-06-2001).]