procedure TGLLinuxContext.DoCreateContext(outputDevice : Cardinal);
var
winattr: XWindowAttributes;
vitemp: xlib.XVisualInfo;
nret: Integer;
glwin: Cardinal;
vi: xlib.PXvisualInfo;
begin
// Just in case it didn't happen already.
if not InitOpenGL
then RaiseLastOSError;
{ Create OpenGL context }
FOutputDevice := QWidgetH(outputDevice);
glwin := QWidget_winId(FOutputDevice);
xlib.XGetWindowAttributes(Application.Display, glwin, @winattr);
vitemp.visual := winattr.visual;
vitemp.visualid := XVisualIDFromVisual(vitemp.visual);
vi := XGetVisualInfo(Application.Display, VisualIDMask, @vitemp, @nret);
FRenderingContext := glXCreateContext(Application.Display, vi,
nil, True);
if RenderingContext =
nil then
raise Exception.Create('
Failed to create rendering context');
if RenderingContext = GLX_BAD_CONTEXT
then
raise Exception.Create('
bad context');
end;