Unit CastleGLUtils
Description
Various utilities for OpenGL(ES) rendering.
Uses
- SysUtils
- Math
- Generics.Collections
- Classes
- CastleGL
- CastleImages
- CastleUtils
- CastleVectors
- CastleRectangles
- CastleColors
- CastleProjection
- CastleRenderOptions
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Class TGLMemoryInfo |
OpenGL memory information. |
Class TGLFeatures |
OpenGL(ES) features, analyzed based on extensions and version. |
Record TLineStipple |
|
Class TVertexArrayObject |
Vertex array object. |
Functions and Procedures
procedure GLInformationInitialize; |
function StrToCapabilities(const S: String): TGLRequestCapabilities; |
procedure DrawRectangle(const R: TRectangle; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawRectangle(const R: TFloatRectangle; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawRectangleOutline(const R: TRectangle; const Color: TCastleColor; const LineWidth: Single = 1; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawRectangleOutline(const R: TFloatRectangle; const Color: TCastleColor; const LineWidth: Single = 1; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawCircle(const Middle: TVector2Integer; const HorizontalRadius, VerticalRadius: Integer; const Color: TCastleColor; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawCircle(const Middle: TVector2; const HorizontalRadius, VerticalRadius: Single; const Color: TCastleColor; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawCircleOutline(const Middle: TVector2Integer; const HorizontalRadius, VerticalRadius: Integer; const Color: TCastleColor; const LineWidth: Single = 1; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawCircleOutline(const Middle: TVector2; const HorizontalRadius, VerticalRadius: Single; const Color: TCastleColor; const LineWidth: Single = 1; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const Points: array of TVector2SmallInt; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const Points: array of TVector2; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const LineStipple: TLineStipple; const Points: array of TVector2; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
procedure GLFadeRectangleDark(const X1, Y1, X2, Y2: Integer; const AFadeColor: TVector3; const FadeIntensity: Single); overload; |
procedure GLFadeRectangleDark(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
procedure GLFadeRectangleDark(const Rect: TFloatRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
procedure GLFadeRectangleLight(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
procedure GLFadeRectangleLight(const Rect: TFloatRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
procedure GLFadeRectangle(const X1, Y1, X2, Y2: Integer; const AFadeColor: TVector3; const FadeIntensity: Single); overload; deprecated 'use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true'; |
procedure GLFadeRectangle(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; deprecated 'use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true'; |
procedure GLBlendRectangle(const X1, Y1, X2, Y2: Integer; const SourceFactor: TBlendingSourceFactor; const DestinationFactor: TBlendingDestinationFactor; const Color: TVector4); overload; deprecated 'use DrawRectangle'; |
procedure GLBlendRectangle(const Rect: TRectangle; const Color: TVector4); overload; deprecated 'use DrawRectangle'; |
procedure GLBlendFunction( SourceFactor: TBlendingSourceFactor; DestinationFactor: TBlendingDestinationFactor); deprecated 'use RenderContext.BlendingEnable'; |
function GLInformationString: String; |
function GLInformationStringSummary: String; |
Types
TGLenum = GLenum; |
TGLboolean = GLboolean; |
TGLbitfield = GLbitfield; |
TGLbyte = GLbyte; |
TGLshort = GLshort; |
TGLint = GLint; |
TGLsizei = GLsizei; |
TGLubyte = GLubyte; |
TGLushort = GLushort; |
TGLuint = GLuint; |
TGLfloat = GLfloat; |
TGLclampf = GLclampf; |
TGLdouble = GLdouble; |
TGLclampd = GLclampd; |
TGLRequestCapabilities = (...); |
TPrimitiveMode = (...); |
Constants
CapabilitiesStr: array [TGLRequestCapabilities] of String = (
'automatic',
'force-fixed-function',
'force-modern'
); |
DefaultCircleSlices = 32; |
Variables
GLFeatures: TGLFeatures; |
LogGLInformationVerbose: Boolean = false; |
Description
Functions and Procedures
procedure GLInformationInitialize; |
Initialize GLVersion and GLFeatures. |
function StrToCapabilities(const S: String): TGLRequestCapabilities; |
Convert a string (like command-line argument) to TGLRequestCapabilities. |
procedure DrawRectangle(const R: TRectangle; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
Draw a rectangle filled with a color. Like with DrawPrimitive2D: Blending is automatically used if Color alpha < 1. ForceBlending forces the usage of blending. When it is |
procedure DrawRectangle(const R: TFloatRectangle; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
This item has no description. |
procedure DrawRectangleOutline(const R: TRectangle; const Color: TCastleColor; const LineWidth: Single = 1; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
Draw a rectangle frame. Like with DrawPrimitive2D: Blending is automatically used if Color alpha < 1. ForceBlending forces the usage of blending. When it is |
procedure DrawRectangleOutline(const R: TFloatRectangle; const Color: TCastleColor; const LineWidth: Single = 1; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
This item has no description. |
procedure DrawCircle(const Middle: TVector2Integer; const HorizontalRadius, VerticalRadius: Integer; const Color: TCastleColor; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
Draw a circle. It may be scaled differently in X than Y, thus resembling an ellipse. Like with DrawPrimitive2D: Blending is automatically used if Color alpha < 1. ForceBlending forces the usage of blending. When it is |
procedure DrawCircle(const Middle: TVector2; const HorizontalRadius, VerticalRadius: Single; const Color: TCastleColor; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
This item has no description. |
procedure DrawCircleOutline(const Middle: TVector2Integer; const HorizontalRadius, VerticalRadius: Integer; const Color: TCastleColor; const LineWidth: Single = 1; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
Draw a circle outline. It may be scaled differently in X than Y, thus resembling an ellipse. Like with DrawPrimitive2D: Blending is automatically used if Color alpha < 1. ForceBlending forces the usage of blending. When it is |
procedure DrawCircleOutline(const Middle: TVector2; const HorizontalRadius, VerticalRadius: Single; const Color: TCastleColor; const LineWidth: Single = 1; const CircleSlices: Cardinal = DefaultCircleSlices; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false); overload; |
This item has no description. |
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const Points: array of TVector2SmallInt; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
Draw a simple 2D primitive with a given color. This can be used to draw a series of points, lines or triangles, depending on the Blending is automatically used if Color alpha < 1. ForceBlending forces the usage of blending. When it is
Parameters
|
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const Points: array of TVector2; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
This item has no description. |
procedure DrawPrimitive2D(const Mode: TPrimitiveMode; const LineStipple: TLineStipple; const Points: array of TVector2; const Color: TCastleColor; const BlendingSourceFactor: TBlendingSourceFactor = bsSrcAlpha; const BlendingDestinationFactor: TBlendingDestinationFactor = bdOneMinusSrcAlpha; const ForceBlending: boolean = false; const LineWidth: Single = 1; const PointSize: Cardinal = 1); overload; |
Draw primitive, using a stipple (pattern) for line rendering. Note that the stipple is ignored on mobile (OpenGLES). |
procedure GLFadeRectangleDark(const X1, Y1, X2, Y2: Integer; const AFadeColor: TVector3; const FadeIntensity: Single); overload; |
Draw a rectangle that modulates colors underneath, making nice animation to AFadeColor while FadeIntensity changes from 1.0 down to 0.0. The GLFadeRectangleLight version makes a flash to AFadeColor, then goes back to normal. It works reasonably with any color (light or dark). The GLFadeRectangleDark version makes additional flash to blackness in the middle (so it goes from no modulation, to AFadeColor, to pure black, and then back to normal). So the "Dark" version is a little more impressive when you're flashing with a dark color. These are nice as a screen effect, to flash some color (e.g. flash red color when the player is hurt). Only RGB portion of AFadeColor is used. |
procedure GLFadeRectangleDark(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
This item has no description. |
procedure GLFadeRectangleDark(const Rect: TFloatRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
This item has no description. |
procedure GLFadeRectangleLight(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
This item has no description. |
procedure GLFadeRectangleLight(const Rect: TFloatRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; |
This item has no description. |
procedure GLFadeRectangle(const X1, Y1, X2, Y2: Integer; const AFadeColor: TVector3; const FadeIntensity: Single); overload; deprecated 'use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true'; |
Warning: this symbol is deprecated: use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true This item has no description. |
procedure GLFadeRectangle(const Rect: TRectangle; const AFadeColor: TCastleColor; const FadeIntensity: Single); overload; deprecated 'use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true'; |
Warning: this symbol is deprecated: use GLFadeRectangleDark, or TCastleFlashEffect with Dark = true This item has no description. |
procedure GLBlendRectangle(const X1, Y1, X2, Y2: Integer; const SourceFactor: TBlendingSourceFactor; const DestinationFactor: TBlendingDestinationFactor; const Color: TVector4); overload; deprecated 'use DrawRectangle'; |
Warning: this symbol is deprecated: use DrawRectangle Draw a rectangle with blending. Deprecated, use DrawRectangle instead. |
procedure GLBlendRectangle(const Rect: TRectangle; const Color: TVector4); overload; deprecated 'use DrawRectangle'; |
Warning: this symbol is deprecated: use DrawRectangle This item has no description. |
procedure GLBlendFunction( SourceFactor: TBlendingSourceFactor; DestinationFactor: TBlendingDestinationFactor); deprecated 'use RenderContext.BlendingEnable'; |
Warning: this symbol is deprecated: use RenderContext.BlendingEnable Call OpenGL glBlendFunc. Accepts parameters as enumerated types TBlendingSourceFactor, TBlendingDestinationFactor. Secures from using source or destination factor unsupported on current OpenGL version: makes a warnings and falls back on a sensible default (so it will always call glBlendFunc anyway). |
function GLInformationString: String; |
Multiline string describing attributes of current OpenGL(ES) library. This simply queries OpenGL(ES) using glGet* functions about many things. Does not change OpenGL(ES) state in any way. Note that the last line of returned string does not terminate with a newline character (so e.g. you may want to do Writeln( |
function GLInformationStringSummary: String; |
One-line string summarizing current OpenGL(ES). |
Types
TGLenum = GLenum; |
This item has no description. |
TGLboolean = GLboolean; |
This item has no description. |
TGLbitfield = GLbitfield; |
This item has no description. |
TGLbyte = GLbyte; |
This item has no description. |
TGLshort = GLshort; |
This item has no description. |
TGLint = GLint; |
This item has no description. |
TGLsizei = GLsizei; |
This item has no description. |
TGLubyte = GLubyte; |
This item has no description. |
TGLushort = GLushort; |
This item has no description. |
TGLuint = GLuint; |
This item has no description. |
TGLfloat = GLfloat; |
This item has no description. |
TGLclampf = GLclampf; |
This item has no description. |
TGLdouble = GLdouble; |
This item has no description. |
TGLclampd = GLclampd; |
This item has no description. |
TGLRequestCapabilities = (...); |
OpenGL(ES) capabilities to request at context creation. Use with TGLFeatures.RequestCapabilities. Values
|
TPrimitiveMode = (...); |
Primitive to draw using DrawPrimitive2D. The modes correspond to OpenGL drawing modes, see https://www.opengl.org/wiki/Primitive https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml Values
|
Constants
CapabilitiesStr: array [TGLRequestCapabilities] of String = (
'automatic',
'force-fixed-function',
'force-modern'
); |
This item has no description. |
DefaultCircleSlices = 32; |
This item has no description. |
Variables
GLFeatures: TGLFeatures; |
This item has no description. |
LogGLInformationVerbose: Boolean = false; |
Much more verbose logging of current context capabilities in GLInformationInitialize. |
Generated by PasDoc 0.16.0-snapshot.