Class TBGLFrameBuffer

Unit

Declaration

type TBGLFrameBuffer = class(TBGLCustomFrameBuffer)

Description

Frame buffer in OpenGL.

A frame buffer is a texture that can be used as a drawing surface in OpenGL.

Example of drawing on a framebuffer and then drawing it on the OpenGL control:

uses ..., BGRABitmapTypes, BGRAOpenGL;

procedure TForm1.OpenGLControlPaint(Sender: TObject);
var
  mousePos: TPoint;
  buf: TBGLFrameBuffer;
begin
  // Draw Background
  BGLViewPort(OpenGLControl.Width, OpenGLControl.Height, BGRAWhite);
  // Create framebuffer
  buf := TBGLFrameBuffer.Create(256,256);
  // Use it
  BGLCanvas.ActiveFrameBuffer := buf;

  BGLCanvas.Fill(CSSYellow);
  BGLCanvas.Line(0,0,128,128, BGRABlack);
  mousePos := ScreenToClient(Mouse.CursorPos);
  BGLCanvas.FillRect(mousePos.x - 50, mousePos.y - 50, mousePos.x + 50, mousePos.y + 50, CSSRed, False);

  // Render framebuffer on the control
  BGLCanvas.ActiveFrameBuffer := nil;
  BGLCanvas.PutImage(0,0, buf.Texture);
  // Free framebuffer
  buf.Free;

  // Update
  OpenGLControl.SwapBuffers;
end;

Hierarchy

Overview

Fields

Protected FFrameBufferId: GLuint;
Protected FHeight: integer;
Protected FMatrix: TAffineMatrix;
Protected FProjectionMatrix: TMatrix4D;
Protected FRenderBufferId: GLuint;
Protected FSettingMatrices: boolean;
Protected FTexture: IBGLTexture;
Protected FWidth: integer;

Methods

Public constructor Create(AWidth,AHeight: integer);
Public destructor Destroy; override;
Public function MakeTextureAndFree: IBGLTexture; override;
Protected function GetHandle: pointer; override;
Protected function GetHeight: integer; override;
Protected function GetMatrix: TAffineMatrix; override;
Protected function GetProjectionMatrix: TMatrix4D; override;
Protected function GetTexture: IBGLTexture; override;
Protected function GetWidth: integer; override;
Protected procedure SetMatrix(AValue: TAffineMatrix); override;
Protected procedure SetProjectionMatrix(AValue: TMatrix4D); override;

Description

Fields

Protected FFrameBufferId: GLuint;

This item has no description.

Protected FHeight: integer;

This item has no description.

Protected FMatrix: TAffineMatrix;

This item has no description.

Protected FProjectionMatrix: TMatrix4D;

This item has no description.

Protected FRenderBufferId: GLuint;

This item has no description.

Protected FSettingMatrices: boolean;

This item has no description.

Protected FTexture: IBGLTexture;

This item has no description.

Protected FWidth: integer;

This item has no description.

Methods

Public constructor Create(AWidth,AHeight: integer);

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public function MakeTextureAndFree: IBGLTexture; override;

This item has no description.

Protected function GetHandle: pointer; override;

This item has no description.

Protected function GetHeight: integer; override;

This item has no description.

Protected function GetMatrix: TAffineMatrix; override;

This item has no description.

Protected function GetProjectionMatrix: TMatrix4D; override;

This item has no description.

Protected function GetTexture: IBGLTexture; override;

This item has no description.

Protected function GetWidth: integer; override;

This item has no description.

Protected procedure SetMatrix(AValue: TAffineMatrix); override;

This item has no description.

Protected procedure SetProjectionMatrix(AValue: TMatrix4D); override;

This item has no description.