Topenglpanel Here

procedure TMyOpenGLPanel.OnTimer(Sender: TObject); begin FAngle := FAngle + 2; if FAngle >= 360 then FAngle := FAngle - 360; Repaint; // triggers Paint method end;

// Setup matrices ModelMat := TMatrix.Identity; ModelMat := ModelMat * TMatrix.CreateRotationY(DegToRad(FAngle)); ModelMat := ModelMat * TMatrix.CreateRotationX(DegToRad(FAngle * 0.7));

procedure TMyOpenGLPanel.StopAnimation; begin FTimer.Enabled := False; end;

type TMyOpenGLPanel = class(TOpenGLPanel) private FAngle: Single; FTimer: TTimer; procedure OnTimer(Sender: TObject); protected procedure Paint; override; procedure Resize; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure StartAnimation; procedure StopAnimation; end; TOpenGlPanel

procedure TMyOpenGLPanel.Paint; var ModelMat, ViewMat, ProjMat: TMatrix; Center: TPoint3D; i: Integer; begin inherited; if not Assigned(Context) then Exit;

ProjMat := TMatrix.CreatePerspectiveFovRH( DegToRad(60), // Field of view Width / Max(Height, 1), // Aspect ratio 0.1, 100.0 // Near/far planes );

implementation

ViewMat := TMatrix.CreateLookAt( Point3D(0, 2, 5), // Eye position Point3D(0, 0, 0), // Look-at center Point3D(0, 1, 0) // Up vector );

procedure TMyOpenGLPanel.StartAnimation; begin FTimer.Enabled := True; end;

procedure TMyOpenGLPanel.Resize; begin inherited; if Assigned(Context) then Context.SetViewport(RectF(0, 0, Width, Height)); end; procedure TMyOpenGLPanel

uses System.UITypes, FMX.Graphics, System.Math;

end. procedure TForm1.FormCreate(Sender: TObject); begin var Panel := TMyOpenGLPanel.Create(Self); Panel.Parent := Self; Panel.Align := TAlignLayout.Client; Panel.StartAnimation; end; Custom Helper (simplified cube drawing) Add this to the implementation section or a separate unit:

uses System.SysUtils, System.Classes, System.Math.Vectors, FMX.Types, FMX.Controls3D, FMX.Objects3D, FMX.MaterialSources, FMX.Controls.Presentation, FMX.Controls, FMX.Forms, FMX.Types3D, FMX.Context.GLES, FMX.Layers3D; procedure TMyOpenGLPanel.OnTimer(Sender: TObject)

constructor TMyOpenGLPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); FAngle := 0; FTimer := TTimer.Create(Self); FTimer.Interval := 30; // ~33 FPS FTimer.OnTimer := OnTimer; FTimer.Enabled := False; end;

unit uOpenGLPanelDemo; interface

www.thebiccountant.com/

New Generation Finance - Accounting - Controlling using Microsoft BI stack

Alluring Analytics

A Power BI Creator Blog

RADACAD

Work smarter by Mastering Functions in Excel

ExcelUser Blog

Work smarter by Mastering Functions in Excel

Excel Esquire

Helping lawyers make the most of Microsoft Excel

ASAP Utilities Blog

Work smarter by Mastering Functions in Excel

Analyst Cave

Work smarter by Mastering Functions in Excel

The Spreadsheet Page

Work smarter by Mastering Functions in Excel

Peltier Tech

Peltier Technical Services - Excel Charts and Programming

ExcelFort Analytics

Turn your data into opportunities

Let's Talk Excel

Q&A about Excel

yoursumbuddy

Doug Glancy's Excel Site