Ah, that's at least nicer, but I meant that I somehow change texture.bind() to include texture.unbind() class texture { public void bind() { .. underlying scope(exit) texture.unbind() } private void unbind() { .. } } .. texture.bind() { .. } .. > > Yep! > > texture.bind() > { > scope(exit) texture.unbind() > ... > }