Class TGLFeatures

Unit

Declaration

type TGLFeatures = class(TObject)

Description

OpenGL(ES) features, analyzed based on extensions and version. A single instance of this class is assigned to GLFeatures after the first rendering context was created. If you have multiple rendering contexts, our engine assumes they share resources and have equal features.

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public function MaxTextureUnits: Cardinal;

Properties

Public property Version_1_2: Boolean read FVersion_1_2;
Public property Version_1_3: Boolean read FVersion_1_3;
Public property Version_1_4: Boolean read FVersion_1_4;
Public property Version_1_5: Boolean read FVersion_1_5;
Public property Version_2_0: Boolean read FVersion_2_0;
Public property Version_2_1: Boolean read FVersion_2_1;
Public property Version_3_0: Boolean read FVersion_3_0;
Public property Version_3_1: Boolean read FVersion_3_1;
Public property Version_3_2: Boolean read FVersion_3_2;
Public property Version_3_3: Boolean read FVersion_3_3;
Public property Version_4_0: Boolean read FVersion_4_0;
Public property ARB_shadow: Boolean read FARB_shadow;
Public property EXT_texture_filter_anisotropic: Boolean read FEXT_texture_filter_anisotropic;
Public property NV_multisample_filter_hint: Boolean read FNV_multisample_filter_hint;
Public property ARB_occlusion_query: Boolean read FARB_occlusion_query;
Public property EXT_framebuffer_blit: Boolean read FEXT_framebuffer_blit;
Public property EXT_fog_coord: Boolean read FEXT_fog_coord;
Public property ARB_window_pos: Boolean read FARB_window_pos;
Public property MESA_window_pos: Boolean read FMESA_window_pos;
Public property CLAMP_TO_EDGE: TGLenum read FCLAMP_TO_EDGE;
Public property MaxTextureSize: Cardinal read FMaxTextureSize;
Public property MaxLights: Cardinal read FMaxLights;
Public property MaxCubeMapTextureSize: Cardinal read FMaxCubeMapTextureSize;
Public property MaxTexture3DSize: Cardinal read FMaxTexture3DSize;
Public property MaxTextureMaxAnisotropyEXT: Single read FMaxTextureMaxAnisotropyEXT;
Public property QueryCounterBits: TGLint read FQueryCounterBits;
Public property MaxRenderbufferSize: TGLuint read FMaxRenderbufferSize;
Public property MaxClipPlanes: Cardinal read FMaxClipPlanes;
Public property Multisample: Boolean read FMultisample;
Public property MaxTextureUnitsFixedFunction: Cardinal read FMaxTextureUnitsFixedFunction;
Public property MaxTextureUnitsShaders: Cardinal read FMaxTextureUnitsShaders;
Public property UseMultiTexturing: Boolean read FUseMultiTexturing;
Public property Texture3D: TGLSupport read FTexture3D;
Public property Framebuffer: TGLSupport read FFramebuffer;
Public property FBOMultiSampling: Boolean read FFBOMultiSampling;
Public property CurrentMultiSampling: Cardinal read FCurrentMultiSampling;
Public property PackedDepthStencil: Boolean read FPackedDepthStencil;
Public property ShadowVolumesPossible: Boolean read FShadowVolumesPossible;
Public property TextureNonPowerOfTwo: Boolean read FTextureNonPowerOfTwo;
Public property TextureCubeMap: TGLSupport read FTextureCubeMap;
Public property TextureCompression: TTextureCompressions read FTextureCompression;
Public property VertexBufferObject: Boolean read FVertexBufferObject;
Public property BlendConstant: Boolean read FBlendConstant;
Public property TextureFloat: Boolean read FTextureFloat;
Public property TextureDepth: Boolean read FTextureDepth;
Public property Shaders: TGLSupport read FShaders write FShaders;
Public property EnableFixedFunction: Boolean read FEnableFixedFunction write FEnableFixedFunction;
Public property Memory: TGLMemoryInfo read FMemory;
Public property MaxViewportDimensions: TVector2Integer read FMaxViewportDimensions;

Description

Methods

Public constructor Create;
 
Public destructor Destroy; override;
 
Public function MaxTextureUnits: Cardinal;

Maximum number of texture units you can safely always use. If EnableFixedFunction, this is MaxTextureUnitsFixedFunction, otherwise MaxTextureUnitsShaders.

Properties

Public property Version_1_2: Boolean read FVersion_1_2;

OpenGL versions supported. Checked by looking at GL version string and by checking whether actual entry points are available.

This is important because bad OpenGL implementations (like the horrible ATI Linux closed drivers) sometimes lie, claiming support in the GL version string but actually lacking proper function entry points. We check the actual presence of entry points (GLExt.Load_GL_version_x_x do that).

We *also* check version string (TGLVersion.AtLeast), since OpenGL may have some buggy entry point in case of work-in-progress features (not yet advertised in GL version string), e.g. Mesa 6.x had such buggy glStencilOpSeparate. This is correct OpenGL behavior AFAIK, and we handle it.

Public property Version_1_3: Boolean read FVersion_1_3;
 
Public property Version_1_4: Boolean read FVersion_1_4;
 
Public property Version_1_5: Boolean read FVersion_1_5;
 
Public property Version_2_0: Boolean read FVersion_2_0;
 
Public property Version_2_1: Boolean read FVersion_2_1;
 
Public property Version_3_0: Boolean read FVersion_3_0;
 
Public property Version_3_1: Boolean read FVersion_3_1;
 
Public property Version_3_2: Boolean read FVersion_3_2;
 
Public property Version_3_3: Boolean read FVersion_3_3;
 
Public property Version_4_0: Boolean read FVersion_4_0;
 
Public property ARB_shadow: Boolean read FARB_shadow;

Is the extension below loaded. Note: we prefer to avoid exposing directly each extension presence like below. Instead most interesting extensions are wrapped in "features" like UseMultiTexturing, see lower.

Public property EXT_texture_filter_anisotropic: Boolean read FEXT_texture_filter_anisotropic;
 
Public property NV_multisample_filter_hint: Boolean read FNV_multisample_filter_hint;
 
Public property ARB_occlusion_query: Boolean read FARB_occlusion_query;
 
Public property EXT_framebuffer_blit: Boolean read FEXT_framebuffer_blit;
 
Public property EXT_fog_coord: Boolean read FEXT_fog_coord;
 
Public property ARB_window_pos: Boolean read FARB_window_pos;
 
Public property MESA_window_pos: Boolean read FMESA_window_pos;
 
Public property CLAMP_TO_EDGE: TGLenum read FCLAMP_TO_EDGE;

GL_CLAMP_TO_EDGE, if available in current OpenGL version. Otherwise GL_CLAMP.

Use this (insteaf of direct GL_CLAMP_TO_EDGE) to work with really ancient OpenGL versions before 1.2. Note that our engine officially supports only OpenGL >= 1.2, so don't expect everything to work smootly with such ancient OpenGL anyway!

Public property MaxTextureSize: Cardinal read FMaxTextureSize;

Constant (for given context) OpenGL limits. Initialized to 0 if appropriate OpenGL functionality is not available.

Note that MaxLights is only relevant if we use OpenGL fixed-function pipeline. Otherwise the actual limit is defined purely by Scene.RenderOptions.MaxLightsPerShape, specific to each TCastleScene, and is completely configurable (can be higher or lower than MaxLights).

Public property MaxLights: Cardinal read FMaxLights;
 
Public property MaxCubeMapTextureSize: Cardinal read FMaxCubeMapTextureSize;
 
Public property MaxTexture3DSize: Cardinal read FMaxTexture3DSize;
 
Public property MaxTextureMaxAnisotropyEXT: Single read FMaxTextureMaxAnisotropyEXT;
 
Public property QueryCounterBits: TGLint read FQueryCounterBits;
 
Public property MaxRenderbufferSize: TGLuint read FMaxRenderbufferSize;
 
Public property MaxClipPlanes: Cardinal read FMaxClipPlanes;
 
Public property Multisample: Boolean read FMultisample;
 
Public property MaxTextureUnitsFixedFunction: Cardinal read FMaxTextureUnitsFixedFunction;

Number of texture units available for fixed-function pipeline. Equal to 0 on OpenGLES (that doesn't have fixed-function pipeline). Equal to glGetInteger(GL_MAX_TEXTURE_UNITS), if multi-texturing available. Equal to 1 (OpenGL supports always 1 texture) otherwise.

Public property MaxTextureUnitsShaders: Cardinal read FMaxTextureUnitsShaders;

Number of texture units available for shader pipeline.

Public property UseMultiTexturing: Boolean read FUseMultiTexturing;

Are all OpenGL multi-texturing extensions for VRML/X3D MultiTexture support available.

This used to check a couple of multitexturing extensions, like ARB_multitexture. Right now, it simply checks for OpenGL 1.3 version. It is supported by virtually all existing GPUs. So it's acceptable to just check it, and write your code for 1.3, and eventual fallback code (when this is false) write only for really ancient GPUs.

Public property Texture3D: TGLSupport read FTexture3D;

Are 3D textures supported by OpenGL. If they are, note that GL_TEXTURE_3D and GL_TEXTURE_3D_EXT are equal, so often both Texture3D = gsStandard and Texture3D = gsExtension cases may be handled by the same code.

Public property Framebuffer: TGLSupport read FFramebuffer;

Is Framebuffer supported. Value gsExtension means that EXT_framebuffer_object is used, gsStandard means that ARB_framebuffer_object (which is a "core extesion", present the same way in OpenGL 3 core, also in OpenGL ES >= 2.0 core) is available.

Public property FBOMultiSampling: Boolean read FFBOMultiSampling;

Is multisampling possible for FBO buffers and textures. Although these are two orthogonal features of OpenGL, in practice you want to use multisample for both FBO buffers and textures, or for none — otherwise, FBO can not be initialized correctly when you mix various multisample settings.

Public property CurrentMultiSampling: Cardinal read FCurrentMultiSampling;

How multi-sampling was initialized for this OpenGL context. Value = 1 means that no multi-sampling is initialized. Values > 1 mean that you have multi-sampling, with given number of samples per pixel. Contrast this with TCastleWindow.MultiSampling or TOpenGLControl.MultiSampling, that say how many samples you wanted to get.

Public property PackedDepthStencil: Boolean read FPackedDepthStencil;

Does OpenGL context have depth buffer packed with stencil buffer. See OpenGL extensions EXT_packed_depth_stencil and OES_packed_depth_stencil (http://www.opengl.org/registry/specs/EXT/packed_depth_stencil.txt, https://www.khronos.org/registry/OpenGL/extensions/OES/OES_packed_depth_stencil.txt) for explanation what does it mean.

This is important for FBOs, as the depth/stencil have to be set up differently depending on PackedDepthStencil value. This is also important for all code using TGLRenderToTexture with TGLRenderToTexture.Buffer equal tbDepth or tbColorAndDepth: your depth texture must be prepared differently, to include both depth+stencil data, to work.

For now, this is simply equal to GL_EXT_packed_depth_stencil. (TODO: for core OpenGL 3, how to detect should we use packed version? http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt incorporates EXT_packed_depth_stencil, so forward-compatible contexts do not need to declare it. Should we assume that forward-compatible gl 3 contexts always have depth/stencil packed?)

Public property ShadowVolumesPossible: Boolean read FShadowVolumesPossible;

Does OpenGL context support shadow volumes. This simply checks do we have stencil buffer with at least 4 bits for now.

Public property TextureNonPowerOfTwo: Boolean read FTextureNonPowerOfTwo;

Are non-power-of-2 textures supported.

Public property TextureCubeMap: TGLSupport read FTextureCubeMap;

Are cubemaps supported.

gsExtension means GL_ARB_texture_cube_map on core OpenGL. gsStandard means standard feature of OpenGL or OpenGL ES. Since the constants defined by ARB_texture_cube_map were promoted to core with the same values, the distinction between gsExtension and gsStandard in practice doesn't exist.

Public property TextureCompression: TTextureCompressions read FTextureCompression;

Which texture compression formats are supported.

Public property VertexBufferObject: Boolean read FVertexBufferObject;

VBO support (in OpenGL (ES) core).

Public property BlendConstant: Boolean read FBlendConstant;

glBlendColor and GL_CONSTANT_ALPHA support.

Public property TextureFloat: Boolean read FTextureFloat;

Support for float texture formats for glTexImage2d.

Public property TextureDepth: Boolean read FTextureDepth;

Support for depth texture formats for glTexImage2d.

Public property Shaders: TGLSupport read FShaders write FShaders;

GLSL shaders support.

Note: Setting it is allowed for now, as a simple way to force non-shader rendering, to test it. You should not use this or rely it will be available in future versions.

Public property EnableFixedFunction: Boolean read FEnableFixedFunction write FEnableFixedFunction;

Enable OpenGL fixed-function rendering on desktops.

  • This makes Gouraud-shaded shapes rendered using OpenGL fixed-function pipeline on desktops.

  • It also makes TDrawableImage.Draw, DrawPrimitive2D (and consequently most of the 2D user-interface) rendered using OpenGL fixed-function pipeline on desktops.

  • It also allows you to use fixed-function pipeline calls in the TCastleWindow.OnRender callback, TCastleUserInterface.Render override and related places.

  • It also allows some deprecated rendering features like WindowPos to continue to work.

This is False by default on modern GPUs (that have good GLSL support).

On OpenGLES, it must be False always, since OpenGLES >= 2 has no fixed-function pipeline.

Public property Memory: TGLMemoryInfo read FMemory;

Total and current memory available. Call Memory.Refresh whenever needed.

Public property MaxViewportDimensions: TVector2Integer read FMaxViewportDimensions;
 

Generated by PasDoc 0.16.0.