{
#ifdef HAVE_GL
int ww = (w + 3) & ~3, hh = (h + 3) & ~3;
+ BC_WindowBase *current_window = BC_WindowBase::get_synchronous()->current_window;
+ window_id = current_window->get_id();
+
+ pbuffer = BC_WindowBase::get_synchronous()->get_pbuffer(ww, hh, &glx_context);
+ if( pbuffer ) return;
+
int pb_attrs[] = {
GLX_PBUFFER_WIDTH, ww,
GLX_PBUFFER_HEIGHT, hh,
None
};
- BC_WindowBase *current_window = BC_WindowBase::get_synchronous()->current_window;
Display *dpy = current_window->get_display();
GLXFBConfig *fb_cfgs = current_window->glx_pbuffer_fb_configs();
int nfb_cfgs = current_window->n_fbcfgs_pbuffer;
// __LINE__, current_config, visinfo, BC_Resources::error, pbuffer);
if( pbuffer ) {
- window_id = current_window->get_id();
glx_context = glXCreateContext(dpy, visinfo, current_window->glx_win_context, 1);
- BC_WindowBase::get_synchronous()->put_pbuffer(w, h, pbuffer, glx_context);
+ BC_WindowBase::get_synchronous()->put_pbuffer(ww, hh, pbuffer, glx_context);
}
else
printf("BC_PBuffer::create_pbuffer: failed\n");
table_lock->lock("BC_Resources::release_textures");
for(int i = 0; i < pbuffer_ids.total; i++) {
PBufferID *ptr = pbuffer_ids.values[i];
- if(ptr->w == w && ptr->h == h && ptr->glx_pbuffer == glx_pbuffer) {
+ if( ptr->w == w && ptr->h == h && ptr->glx_pbuffer == glx_pbuffer ) {
exists = 1;
break;
}
}
-
if(!exists) {
PBufferID *ptr = new PBufferID(current_window->get_id(),
glx_pbuffer, glx_context, w, h);
table_lock->unlock();
}
-GLXPbuffer BC_Synchronous::get_pbuffer(int w,
- int h,
- int *window_id,
- GLXContext *glx_context)
+GLXPbuffer BC_Synchronous::get_pbuffer(int w, int h, GLXContext *glx_context)
{
table_lock->lock("BC_Resources::release_textures");
for(int i = 0; i < pbuffer_ids.total; i++) {
ptr->window_id == current_window->get_id() ) {
GLXPbuffer result = ptr->glx_pbuffer;
*glx_context = ptr->glx_context;
- *window_id = ptr->window_id;
ptr->in_use = 1;
table_lock->unlock();
return result;
table_lock->lock("BC_Resources::release_textures");
for(int i = 0; i < pbuffer_ids.total; i++) {
PBufferID *ptr = pbuffer_ids.values[i];
- if(ptr->window_id == window_id) {
+ if( ptr->window_id == window_id ) {
ptr->in_use = 0;
}
}
GLXContext glx_context);
// Get the PBuffer by window_id and dimensions if it exists.
// Must be called inside synchronous loop.
- GLXPbuffer get_pbuffer(int w,
- int h,
- int *window_id,
- GLXContext *glx_context);
+ GLXPbuffer get_pbuffer(int w, int h, GLXContext *glx_context);
// Release a pbuffer for use by get_pbuffer.
void release_pbuffer(int window_id, GLXPbuffer pbuffer);