Class TGLFeatures

Unit

Declaration

type TGLFeatures = class(TObject)

Description

OpenGL features, analyzed based on OpenGL extensions and version. A single instance of this class is assigned to GLFeatures after the first OpenGL context was created.

If you have multiple OpenGL contexts, our engine assumes they share resources and have equal features.

Hierarchy

  • TObject
  • TGLFeatures

Overview

Fields

Public Version_1_2: boolean;
Public Version_1_3: boolean;
Public Version_1_4: boolean;
Public Version_1_5: boolean;
Public Version_2_0: boolean;
Public Version_2_1: boolean;
Public Version_3_0: boolean;
Public Version_3_1: boolean;
Public Version_3_2: boolean;
Public Version_3_3: boolean;
Public Version_4_0: boolean;
Public ARB_shadow: boolean;
Public EXT_texture_filter_anisotropic: boolean;
Public NV_multisample_filter_hint: boolean;
Public ARB_occlusion_query: boolean;
Public EXT_framebuffer_blit: Boolean;
Public EXT_fog_coord: boolean;
Public ARB_window_pos: boolean;
Public MESA_window_pos: boolean;
Public CLAMP_TO_EDGE: TGLenum;
Public MaxTextureSize: Cardinal;
Public MaxLights: Cardinal;
Public MaxCubeMapTextureSize: Cardinal;
Public MaxTexture3DSize: Cardinal;
Public MaxTextureMaxAnisotropyEXT: Single;
Public QueryCounterBits: TGLint;
Public MaxRenderbufferSize: TGLuint;
Public MaxClipPlanes: Cardinal;
Public Multisample: boolean;
Public MaxTextureUnitsFixedFunction: Cardinal;
Public MaxTextureUnitsShaders: Cardinal;
Public UseMultiTexturing: boolean;
Public Texture3D: TGLSupport;
Public Framebuffer: TGLSupport;
Public FBOMultiSampling: boolean;
Public CurrentMultiSampling: Cardinal;
Public PackedDepthStencil: boolean;
Public ShadowVolumesPossible: boolean;
Public TextureNonPowerOfTwo: boolean;
Public TextureCubeMap: TGLSupport;
Public TextureCompression: TTextureCompressions;
Public VertexBufferObject: boolean;
Public BlendConstant: boolean;
Public TextureFloat: boolean;
Public TextureDepth: boolean;
Public Shaders: TGLSupport;
Public EnableFixedFunction: boolean;
Public Memory: TGLMemoryInfo;
Public MaxViewportDimensions: TVector2Integer;

Methods

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

Description

Fields

Public Version_1_2: boolean;

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 Version_1_3: boolean;
 
Public Version_1_4: boolean;
 
Public Version_1_5: boolean;
 
Public Version_2_0: boolean;
 
Public Version_2_1: boolean;
 
Public Version_3_0: boolean;
 
Public Version_3_1: boolean;
 
Public Version_3_2: boolean;
 
Public Version_3_3: boolean;
 
Public Version_4_0: boolean;
 
Public ARB_shadow: boolean;

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 EXT_texture_filter_anisotropic: boolean;
 
Public NV_multisample_filter_hint: boolean;
 
Public ARB_occlusion_query: boolean;
 
Public EXT_framebuffer_blit: Boolean;
 
Public EXT_fog_coord: boolean;
 
Public ARB_window_pos: boolean;
 
Public MESA_window_pos: boolean;
 
Public CLAMP_TO_EDGE: TGLenum;

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 MaxTextureSize: Cardinal;

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

Public MaxLights: Cardinal;
 
Public MaxCubeMapTextureSize: Cardinal;
 
Public MaxTexture3DSize: Cardinal;
 
Public MaxTextureMaxAnisotropyEXT: Single;
 
Public QueryCounterBits: TGLint;
 
Public MaxRenderbufferSize: TGLuint;
 
Public MaxClipPlanes: Cardinal;
 
Public Multisample: boolean;
 
Public MaxTextureUnitsFixedFunction: Cardinal;

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 MaxTextureUnitsShaders: Cardinal;

Number of texture units available for shader pipeline.

Public UseMultiTexturing: boolean;

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 Texture3D: TGLSupport;

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 Framebuffer: TGLSupport;

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 FBOMultiSampling: boolean;

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 CurrentMultiSampling: Cardinal;

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 TCastleWindowBase.MultiSampling or TOpenGLControl.MultiSampling, that say how many samples you wanted to get.

Public PackedDepthStencil: boolean;

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 ShadowVolumesPossible: boolean;

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

Public TextureNonPowerOfTwo: boolean;

Are non-power-of-2 textures supported.

Public TextureCubeMap: TGLSupport;

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 TextureCompression: TTextureCompressions;

Which texture compression formats are supported.

Public VertexBufferObject: boolean;

VBO support (in OpenGL (ES) core).

Public BlendConstant: boolean;

glBlendColor and GL_CONSTANT_ALPHA support.

Public TextureFloat: boolean;

Support for float texture formats for glTexImage2d.

Public TextureDepth: boolean;

Support for depth texture formats for glTexImage2d.

Public Shaders: TGLSupport;

GLSL shaders support.

Public EnableFixedFunction: boolean;

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 TCastleWindowBase.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 Memory: TGLMemoryInfo;

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

Public MaxViewportDimensions: TVector2Integer;
 

Methods

Public function MaxTextureUnits: Cardinal;

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

Public constructor Create;
 
Public destructor Destroy; override;
 

Generated by PasDoc 0.15.0.