bonjour , j'essaie, sur une machine qui dispose de deux cartes graphiques identiques , sur laquel est configurer deux bureau xorg, et où tout fonctionne... d'effectuer deux affichage simultannésur les deux bureau avec des fenetres X ( pas glut) dans une application multithread ( pour l'instant avec deux thread seulement ), mais en vain ...
je crée dans le main mes deux thread avec :ensuite j crée la fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 pthread_t th1, th2; void *ret; if (pthread_create (&th1, NULL, my_thread_process, (char*)"Thread1") < 0) { fprintf (stderr, "pthread_create error for thread 1\n"); exit (1); } if (pthread_create (&th2, NULL, my_thread_process, (char*)"Thread2") < 0) { fprintf (stderr, "pthread_create error for thread 2\n"); exit (1); } (void)pthread_join (th1, &ret); (void)pthread_join (th2, &ret);avec initDisplay qui est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 void *my_thread_process (void * arg) { if (!strcmp((char*) arg , "Thread1") ) { setenv("DISPLAY", ":0.0", 1); NumThread=0; } else if ((char*) arg == "Thread2") { setenv("DISPLAY", ":0.1", 1); NumThread=1; } initDisplay(NumThread); initGLEW(NumThread); ..dessin de mon quad...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 void initDisplay(int NumThread) { Display *dpy; XVisualInfo *vi; Colormap cmap; XSetWindowAttributes swa; Window win; GLXContext cx; XEvent event; /* get a connection */ dpy = XOpenDisplay(0); /* get an appropriate visual */ vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList); /* create a GLX context */ cx = glXCreateContext(dpy, vi, 0, GL_FALSE); /* create a colormap */ cmap = XCreateColormap(dpy, RootWindow(dpy, vi-> screen), vi->visual, AllocNone); /* create a window */ swa.colormap = cmap; swa.border_pixel = 0; swa.event_mask = StructureNotifyMask; win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 100, 100, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa); XMapWindow(dpy, win); XIfEvent(dpy, &event, WaitForNotify, (char*)win); /* connect the context to the window */ glXMakeCurrent(dpy, win, cx); }
et initGLEW :si quelqu'un peut un peu me guider...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 void initGLEW (int NumThread) { glewContextInit(&_glewctx[NumThread]); }
Partager