Results 1 to 10 of 13

Thread: Create OpenGL Texture from TBitmap

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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:

    Code:
    procedure TNewBitmap.UpdateTexture;
    begin
    	self.FTexture:=CreateTexture(width,height,@canvas.pixels);
    end;
    I'm not getting what all that extra code is even in there for.

    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.
    Last edited by deathshadow; 18-06-2012 at 10:13 AM.
    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •