Perhaps related to this thread. It doesn't look like OpenGL honors clipping on sub bitmaps. Test program:
My initial test was clipping a sub bitmap of a regular (non backbuffer) bitmap; it had the same problem.
Expected result (D3D):
{"name":"602854","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/d\/7d70960c3c746fc2e5e21cbe8ad29116.png","w":336,"h":278,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/d\/7d70960c3c746fc2e5e21cbe8ad29116"}
OpenGL:
{"name":"602855","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/e\/5ee6bba9dd6ca61d2d6945ec46283bb2.png","w":336,"h":278,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/e\/5ee6bba9dd6ca61d2d6945ec46283bb2"}
It works fine when the sub bitmap is removed.
Can you try adding this to ogl_update_clipping_rectangle (in src/opengl/ogl_bitmap.c):
if (bitmap->parent) ogl_bitmap = bitmap->parent;
Basically the check if the bitmap is the opengl_target looks wrong to me as it would fail for sub-bitmaps. Can't test it myself right now.
The attached patch seems to work.
Index: ogl_bitmap.c
===================================================================
--- ogl_bitmap.c (revision 14083)
+++ ogl_bitmap.c (working copy)
@@ -530,6 +530,10 @@
ALLEGRO_DISPLAY *ogl_disp = al_get_current_display();
ALLEGRO_BITMAP_OGL *ogl_bitmap = (void *)bitmap;
+ if (bitmap->parent) {
+ ogl_bitmap = (ALLEGRO_BITMAP_OGL *)bitmap->parent;
+ }
+
if (ogl_disp->ogl_extras->opengl_target == ogl_bitmap) {
_al_ogl_setup_bitmap_clipping(bitmap);
}