LINUX.ORG.RU

OpenGl Немогу создать окно ?!?!?!


1

0

Есть Код:
Display* dpy;
Window r_win;
Window win;
Window win_c;
Screen* Screen;
XVisualInfo *visinfo;
GLXContext ctx;
XSetWindowAttributes attr;
unsigned int mask;
int scrnum;
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
None };

XInitThreads();
dpy = XOpenDisplay( NULL );
Screen = XDefaultScreenOfDisplay( dpy );
r_win = XDefaultRootWindow( dpy );
win = XCreateSimpleWindow( dpy, r_win, 10, 10, 500, 500, 0, 0, 0x808080);

scrnum = XScreenNumberOfScreen( Screen );
visinfo = glXChooseVisual( dpy, scrnum, attrib );
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, r_win, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;

win_c = XCreateWindow( dpy, win, 30, 30, 440, 440,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );

ctx = glXCreateContext( dpy, visinfo, NULL, True );
XMapWindow(dpy,win);
XMapWindow(dpy,win_c);
XLockDisplay(dpy) ;
bool a=glXMakeCurrent( dpy, win_c, ctx );
XUnlockDisplay(dpy) ;
XPending(dpy);

a=a;
XPending( dpy );
while(1);


ТАк Вот если создать отдельный проект и поместить его в int main
(int c, char* a[])
то вызов функции bool a=glXMakeCurrent( dpy, win_c, ctx ); возвращает true, и всё вроде OK. а вот если в какую небуть shared library дання функция вылетает на SIGSEGV с указанием на внутренюю функцию glXChannelRectSyncSGIX(). Может кто встречал эти грабли

★★

Почему бы не использовать Glut? И портабельнее, и гемороя меньше. ;-)

human0id ★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.