I have these function calls :
OSPImgBlit(&img->_obj, &win1->_obj, 0, 0, 0, 0, 640, 480);
OSPRun(&win1->_obj, OSPWND_SWAP);
for these implementations :
void OSPwnd_swap(OSPobj *obj, va_list arg) {
OSPwindow *wnd = (OSPwindow *) obj;
XdbeSwapInfo swpifo;
swpifo.swap_window = wnd->_wnd;
swpifo.swap_action = XdbeUndefined;
// XdbeSwapBuffers returns true on success, we return 0 on success.
if(XdbeSwapBuffers(wnd->_dpy->_dpy, &swpifo, 1)) {
OSPrint(1, "OSPwnd_swap : Window %d swapped "
"on connection %d",
wnd->_wnd, XConnectionNumber(wnd->_dpy->_dpy));
/* XFlush(wnd->_dpy->_dpy); */
}
else {
OSPrint(1, "OSPwnd_swap : Unable to swap window %d "
"on connection %d",
wnd->_wnd, XConnectionNumber(wnd->_dpy->_dpy));
}
}
void OSPImgBlit(OSPobj *orig, OSPobj *dest, int x_orig, int y_orig,
int x_dest, int y_dest, unsigned int width, unsigned int height) {
OSPimage *orig_as_image = (OSPimage *) orig;
OSPwindow *orig_as_window = (OSPwindow *) orig;
OSPimage *dest_as_image = (OSPimage *) dest;
OSPwindow *dest_as_window = (OSPwindow *) dest;
enum {
image_to_image = 0,
image_to_window = 1,
window_to_image = 2,
window_to_window = 3
} mode = image_to_window;
switch(mode) {
case image_to_window:
XPutImage(dest_as_window->_dpy->_dpy, dest_as_window->_bbf,
dest_as_window->_gc, orig_as_image->_img,
x_orig, y_orig, x_dest, y_dest, width, height);
default:;
}
}
The entire code is here : https://github.com/DJTECKING/OSPOOC.git
My application starts correctly but when I attempt to close the window I created, it happen one of these behavior randomly : - segfault - BadDrawable on X_PutImage - nothing (not working close button on closing window) - Correctly closed window and application
I guess something like I'm using a already closed window or freed image, but in the entire code I don't understand how can this happen, any idea?
Also XPutImage only blits a square while I was attempting to copy the whole window.
Yet another question that might be separated of this topic, I continue to face ugly tearing effects, even with Xdouble buffer extension, was not this extension supposed to avoid this?
I haven't 10 reputation so here is direct image link:
http://i.stack.imgur.com/AnlMo.png