static bool ogl_lock_region_nonbb_readwrite( ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format, bool* restore_fbo) { bool ok; ASSERT(bitmap->parent == NULL); ASSERT(bitmap->locked == false); ASSERT(_al_get_bitmap_display(bitmap) == al_get_current_display()); /* Try to create an FBO if there isn't one. */ *restore_fbo = _al_ogl_setup_fbo_non_backbuffer(_al_get_bitmap_display(bitmap), bitmap); if (ogl_bitmap->fbo_info) { ALLEGRO_DEBUG("Locking non-backbuffer READWRITE with fbo\n"); ok = ogl_lock_region_nonbb_readwrite_fbo(bitmap, ogl_bitmap, x, gl_y, w, h, format); } else { ALLEGRO_DEBUG("Locking non-backbuffer READWRITE no fbo\n"); ok = ogl_lock_region_nonbb_readwrite_nonfbo(bitmap, ogl_bitmap, x, gl_y, w, h, format); } return ok; }
void _al_ogl_setup_fbo(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) { ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; if (bitmap->parent) bitmap = bitmap->parent; ogl_bitmap = bitmap->extra; /* We can't return here. Target's FBO can be taken away by locking * a lot of bitmaps consecutively. * Also affects ex_multiwin; resizing one window affects the other. */ if (false && display->ogl_extras->opengl_target == bitmap) return; if (ogl_bitmap->is_backbuffer) setup_fbo_backbuffer(display, bitmap); else _al_ogl_setup_fbo_non_backbuffer(display, bitmap); }