Download Now

    Reference TDrawingBuffer<T>

    Declared in Codebot.Render.Buffers.pas on line 143

    TDrawingBuffer<T> is the abstract base class for drawing vertex arrays. Vertices are kept in memory and uploaded to an OpenGL buffer object the next time the buffer is drawn after a change. Each drawing buffer owns its buffer objects and, when the API supports them, a vertex array object.
      TDrawingBuffer<T> = class(TDataBuffer<T>)
      protected
        procedure Changed; override;
        procedure Added(N: Integer); override;
        { CountAttributes returns the number of vertex attributes in T }
        function CountAttributes: Integer; virtual; abstract;
        { BindAttributes describes the fields of T as offsets into the bound array
          buffer using glVertexAttribPointer }
        procedure BindAttributes; virtual; abstract;
      public
        { Create a new data buffer optionally allocating room for a N number of
          future vertices }
        constructor Create(N: Integer = 0); override;
        destructor Destroy; override;
        { Set the shader program associated with draw commands }
        procedure SetProgram(Prog: Integer); overload;
        { Set the shader program by name associated with draw commands }
        procedure SetProgram(const ProgName: string); overload;
        { Adds the V T field above to the buffer }
        procedure Add(constref V: T); overload;
        { Clone additional drawing information }
        function Clone: TObject; override;
        { Begin buffering new vertex data using a specified mode }
        procedure BeginBuffer(Mode: TVertMode; Count: Integer = 0);
        { Delineate a new vertex mode type without drawing }
        procedure MarkBuffer(Mode: TVertMode);
        { End buffering and draw everything }
        procedure EndBuffer(DrawBuffer: Boolean = False);
        { Draw everything }
        procedure Draw; overload;
        { Draw items at the marked index }
        procedure Draw(Mark: Integer); overload;
        { Draw from the buffer a starting at an index using a specific mode }
        procedure Draw(Mode: TVertMode; Start: Integer; Length: Integer = 0); overload;
        { Draw from the buffer using a list of vertex indices using a specific mode }
        procedure Draw(Mode: TVertMode; Indices: WordArray); overload;
        { The number of delineated sections in the buffer }
        property MarkCount: Integer read GetMarkCount;
      end;

    See also