Topenglpanel -

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;

unit uOpenGLPanelDemo; interface

{ TMyOpenGLPanel }

type TOpenGLContextHelper = class helper for TContext3D public procedure DrawCubeFace(FaceIndex: Integer; Size: Single); end; implementation

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

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

procedure TOpenGLContextHelper.DrawCubeFace(FaceIndex: Integer; Size: Single); const // Vertex data for each face (order: bottom-left, bottom-right, top-right, top-left) FaceVertices: array[0..5, 0..3] of TPoint3D = ( (( -1, -1, 1), ( 1, -1, 1), ( 1, 1, 1), (-1, 1, 1)), // front (( 1, -1, -1), (-1, -1, -1), (-1, 1, -1), ( 1, 1, -1)), // back (( -1, 1, -1), ( 1, 1, -1), ( 1, 1, 1), (-1, 1, 1)), // top (( -1, -1, 1), ( 1, -1, 1), ( 1, -1, -1), (-1, -1, -1)), // bottom (( -1, -1, -1), (-1, -1, 1), (-1, 1, 1), (-1, 1, -1)), // left (( 1, -1, 1), ( 1, -1, -1), ( 1, 1, -1), ( 1, 1, 1)) // right ); var V: array[0..3] of TPoint3D; j: Integer; begin for j := 0 to 3 do V[j] := FaceVertices[FaceIndex, j] * Size; uses System

implementation

procedure TMyOpenGLPanel.StopAnimation; begin FTimer.Enabled := False; end; implementation uses System.UITypes

Top