Zengar
04-10-2006, 07:50 AM
Hello
I am now busy getting the GLX and Xlib working together. Somehow I get a strange error. The window is properly created and mapped, the visual is properly selected and the valid rc is also being created (I tested it). Hovewer, I get a "zero division exception" on the line where I bind the context to the window. Basically, I followed glxgears code (and glxgears runs). What am I doing wrong? I use nvidia glx module for Xorg
// choose the visual
a[0] := GLX_RGBA;
a[1] := GLX_RED_SIZE;
a[2] := 8;
a[3] := GLX_GREEN_SIZE;
a[4] := 8;
a[5] := GLX_BLUE_SIZE;
a[6] := 8;
a[7] := GLX_DOUBLEBUFFER;
a[8] := None;
vinfo := glXChooseVisual(dpy, 0, @a[0]);
context := glXCreateContext(dpy, vinfo, nil, true);
// Create the window
swa.background_pixel := 0;
swa.border_pixel := 0;
swa.colormap := XCreateColormap( dpy, RootWindow(dpy, vinfo^.screen), vinfo^.visual, AllocNone);
swa.event_mask := StructureNotifyMask or ExposureMask or KeyPressMask;
mask := CWBackPixel or CWBorderPixel or CWColormap or CWEventMask;
w := XCreateWindow(dpy, RootWindow(dpy, vinfo^.screen), 0, 0, 100, 100, 0, vinfo^.depth,
InputOutput, vinfo^.visual, mask, @swa);
XMapWindow(dpy, w);
// bind the context
glXMakeContextCurrent(dpy, w, w, context); // <- EXCEPTION HERE!
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glXSwapBuffers(dpy, w);
I am now busy getting the GLX and Xlib working together. Somehow I get a strange error. The window is properly created and mapped, the visual is properly selected and the valid rc is also being created (I tested it). Hovewer, I get a "zero division exception" on the line where I bind the context to the window. Basically, I followed glxgears code (and glxgears runs). What am I doing wrong? I use nvidia glx module for Xorg
// choose the visual
a[0] := GLX_RGBA;
a[1] := GLX_RED_SIZE;
a[2] := 8;
a[3] := GLX_GREEN_SIZE;
a[4] := 8;
a[5] := GLX_BLUE_SIZE;
a[6] := 8;
a[7] := GLX_DOUBLEBUFFER;
a[8] := None;
vinfo := glXChooseVisual(dpy, 0, @a[0]);
context := glXCreateContext(dpy, vinfo, nil, true);
// Create the window
swa.background_pixel := 0;
swa.border_pixel := 0;
swa.colormap := XCreateColormap( dpy, RootWindow(dpy, vinfo^.screen), vinfo^.visual, AllocNone);
swa.event_mask := StructureNotifyMask or ExposureMask or KeyPressMask;
mask := CWBackPixel or CWBorderPixel or CWColormap or CWEventMask;
w := XCreateWindow(dpy, RootWindow(dpy, vinfo^.screen), 0, 0, 100, 100, 0, vinfo^.depth,
InputOutput, vinfo^.visual, mask, @swa);
XMapWindow(dpy, w);
// bind the context
glXMakeContextCurrent(dpy, w, w, context); // <- EXCEPTION HERE!
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glXSwapBuffers(dpy, w);