Download Now

    Reference TTexture

    Declared in Codebot.Render.Textures.pas on line 22

    TTexture is an OpenGL texture owned by a render context
      TTexture = class(TContextManagedObject)
      public
        constructor Create;
        destructor Destroy; override;
        { Generate mipmaps for the texture. Until the texture is loaded again the
          minify filter samples from the mipmaps. }
        procedure GenerateMipmaps;
        { Load a texture from straight alpha RGBA pixels, four bytes per pixel, with
          the first row at the top of the image }
        procedure LoadFromData(Width, Height: Integer; Pixels: Pointer);
        { Load a texture from a bitmap. Bitmap pixels are converted from
          premultiplied BGRA to the straight alpha RGBA used by the render context
          blend function. }
        procedure LoadFromBitmap(Bitmap: IBitmapData);
        { Load a texture from a stream }
        procedure LoadFromStream(Stream: TStream);
        { Load a texture from a file }
        procedure LoadFromFile(const FileName: string);
        { Output texture coords given x and y pixels }
        procedure Coord(X, Y: Integer; out V: TVec2);
        { Make the texture current optionally at a texture slot }
        procedure Push(Slot: Integer = 0);
        { Restore the previous texture }
        procedure Pop;
        { The width of the texture }
        property Width: Integer read FWidth;
        { The height of the texture }
        property Height: Integer read FHeight;
        { Flag to turn the texture on or off }
        property Active: Boolean read GetActive write SetActive;
        { Maginify filter }
        property MagFilter: TTexFilter read FMagFilter write SetMagFilter;
        { Minify filter, which also blends between mipmaps when they exist }
        property MinFilter: TTexFilter read FMinFilter write SetMinFilter;
        { Texture wrapping }
        property Wrap: Boolean read FWrap write SetWrap;
        { The underlying handle of the texture }
        property Handle: Integer read FHandle;
      end;

    See also

    IBitmapData in Codebot.Platform.pas
    TContextManagedObject in Codebot.Render.Contexts.pas
    TVec2 in Codebot.Geometry.pas