PDA

View Full Version : Create GL Window



alexsy
01-18-2006, 11:21 PM
There is much line appendix!!
In it there is a shared library for work with X Window, this library creates a window in which are created a heap of affiliated windows on which different structures, and moving images with help Xvlibs are deduced, and is used XShm expansion
At attempt of creation of creation of a window for work with GL library by a call glXMakeCurrent (dpy, glwin, ctx);
There is an exclusive situation in internal function glXChannelRectSyncSGIX () SIGSEGV

Used: nVidia 8174 driver

//---------------------------------------------------------------------------
BASERESULTTYPE BASECALLTYPE X11DC:: CreateGL (I_Widget* Object)
{

TInt scrnum;
TUint mask;
XSetWindowAttributes attr;
Window root;
Window glwin;
GLXContext ctx;
TInt attrib [] = {GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE,
1, None};
XVisualInfo* visinfo = NULL;
GLint max [2] = {0, 0};
visinfo = glXChooseVisual (dpy, NumberWorkScreen, attrib);

// visinfo = glXChooseVisual (dpy, scrnum, attrib);

attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = // WorkScreenColormap;
XCreateColormap (dpy, Win_DC, visinfo-> visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;

int l = 0;
int t = 0;
int w = 200;
int h = 200;

glwin = 0;
glwin = XCreateWindow (dpy, Win_DC,
l,
t,
w,
h,
0, visinfo-> depth,
InputOutput, visinfo-> visual,
mask, *attr);

// GLXContext ctx
ctx = glXCreateContext (dpy, visinfo, NULL, True);
if (! ctx)
{
return I_ERROR;
}
XFree (visinfo);
// dcv-> ctx = ctx;
XMapWindow (dpy, glwin);

glXMakeCurrent (dpy, glwin, ctx);
// glXMakeContextCurrent (dpy, glwin, glwin, ctx);
glGetIntegerv (GL_MAX_VIEWPORT_DIMS, max);
/ **/
return I_OK;
}