You are REALLY overthinking this IMHO... don't waste time making a copy, just send it tbitmap.canvas.pixels. You seem to be expanding tBitmap for no good reason near as I can tell...
Literally if your expanded object inherits from tBitmap, why aren't you just doing:
I'm not getting what all that extra code is even in there for.Code:procedure TNewBitmap.UpdateTexture; begin self.FTexture:=CreateTexture(width,height,@canvas.pixels); end;
Likewise, once I've bound it, I'd release tbitmap -- I'd probably have tbitmap as a property of the texture instead of the other way around -- if I had it a property at all and not a local var in the constructor. Load it, bind it, release the tbitmap, continue on your merry way -- unless you really need to keep allocating and releasing it because you're running dry on available memory on the GPU.
Bookmarks