Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::GLCaps Class Reference

Low-level wrapper for OpenGL extension management. More...

#include <GLCaps.h>

List of all members.

Public Types

enum  { G3D_MAX_TEXTURE_UNITS = 8 }
enum  Vendor { ATI, NVIDIA, MESA, ARB }

Static Public Member Functions

static const std::string & driverVersion ()
static Vendor enumVendor ()
static const std::string & glVersion ()
static bool hasBug_glMultiTexCoord3fvARB ()
static bool hasBug_mipmapGeneration ()
static bool hasBug_normalMapTexGen ()
static bool hasBug_redBlueMipmapSwap ()
static bool hasBug_slowVBO ()
static void init ()
static int numTextureCoords ()
static int numTextures ()
static int numTextureUnits ()
static const std::string & renderer ()
static bool supports (const class TextureFormat *fmt)
static bool supports (const std::string &extName)
static bool supports_GL_ARB_fragment_program ()
static bool supports_GL_ARB_fragment_shader ()
static bool supports_GL_ARB_multitexture ()
static bool supports_GL_ARB_shader_objects ()
static bool supports_GL_ARB_shading_language_100 ()
static bool supports_GL_ARB_shadow ()
static bool supports_GL_ARB_texture_border_clamp ()
static bool supports_GL_ARB_texture_cube_map ()
static bool supports_GL_ARB_texture_non_power_of_two ()
static bool supports_GL_ARB_vertex_buffer_object ()
static bool supports_GL_ARB_vertex_program ()
static bool supports_GL_ARB_vertex_shader ()
static bool supports_GL_ATI_separate_stencil ()
static bool supports_GL_EXT_framebuffer_object ()
static bool supports_GL_EXT_geometry_shader4 ()
static bool supports_GL_EXT_stencil_two_side ()
static bool supports_GL_EXT_stencil_wrap ()
static bool supports_GL_EXT_texture3D ()
static bool supports_GL_EXT_texture_compression_s3tc ()
static bool supports_GL_EXT_texture_cube_map ()
static bool supports_GL_EXT_texture_edge_clamp ()
static bool supports_GL_EXT_texture_rectangle ()
static bool supports_GL_NV_vertex_program2 ()
static bool supports_two_sided_stencil ()
static const std::string & vendor ()


Detailed Description

Low-level wrapper for OpenGL extension management.

Can be used without G3D::RenderDevice to load and manage extensions.

OpenGL has a base API and an extension API. All OpenGL drivers must support the base API. The latest features may not be supported by some drivers, so they are in the extension API and are dynamically loaded at runtime using GLCaps::loadExtensions. Before using a specific extension you must test for its presence using the GLCaps::supports method.

For convenience, frequently used extensions have fast tests, e.g., GLCaps::supports_GL_EXT_texture_rectangle.

Note that GL_NV_texture_rectangle and GL_EXT_texture_rectangle have exactly the same constants, so supports_GL_EXT_texture_rectangle returns true if either is supported.

GLCaps assumes all OpenGL contexts have the same capabilities.

The following extensions are shortcutted with a method named similarly to GLCaps::supports_GL_EXT_texture_rectangle():

  • GL_ARB_texture_non_power_of_two
  • GL_EXT_texture_rectangle
  • GL_ARB_vertex_program
  • GL_NV_vertex_program2
  • GL_ARB_vertex_buffer_object
  • GL_ARB_fragment_program
  • GL_ARB_multitexture
  • GL_EXT_texture_edge_clamp
  • GL_ARB_texture_border_clamp
  • GL_EXT_texture_r
  • GL_EXT_stencil_wrap
  • GL_EXT_stencil_two_side
  • GL_ATI_separate_stencil
  • GL_EXT_texture_compression_s3tc
  • GL_EXT_texture_cube_map, GL_ARB_texture_cube_map
  • GL_ARB_shadow
  • GL_ARB_shader_objects
  • GL_ARB_shading_language_100
  • GL_ARB_fragment_shader
  • GL_ARB_vertex_shader
  • GL_EXT_geometry_shader4
  • GL_EXT_framebuffer_object

These methods do not appear in the documentation because they are generated using macros.

The hasBug_ methods detect specific common bugs on graphics cards. They can be used to switch to fallback rendering paths.


Member Enumeration Documentation

anonymous enum

Maximum number of texture coordinates supported by G3D and RenderDevice; used to preallocate some static arrays.

Enumerator:
G3D_MAX_TEXTURE_UNITS 

Enumerator:
ATI 
NVIDIA 
MESA 
ARB 


Member Function Documentation

static const std::string& G3D::GLCaps::driverVersion (  )  [static]

static Vendor G3D::GLCaps::enumVendor (  )  [static]

static const std::string& G3D::GLCaps::glVersion (  )  [static]

static bool G3D::GLCaps::hasBug_glMultiTexCoord3fvARB (  )  [static]

Returns true if cube map support has a specific known bug on this card.

Returns false if cube maps are not supported at all on this card.

Call after OpenGL is intialized. Will render on the backbuffer but not make the backbuffer visible. Safe to call multiple times; the result is memoized.

On some Radeon Mobility cards (up to Mobility 9200), glMultiTexCoord3fvARB and glVertex4fv together create incorrect texture lookups from cube maps. Using glVertex3fv or glTexCoord with glActiveTextureARB avoids this problem, as does using normal map generation.

static bool G3D::GLCaps::hasBug_mipmapGeneration (  )  [static]

Returns true if SGIS auto mip-map generation occasionally produces buggy results (usually, pieces of other textures in the low-level mipmaps).

Radeon Mobility 9200 has this bug for some drivers.

If this bug is detected, G3D::Texture reverts to software mipmap generation.

static bool G3D::GLCaps::hasBug_normalMapTexGen (  )  [static]

Returns true if cube map support has a specific known bug on this card that prevents correct normal map coordinate generation.

Returns false if cube maps are not supported at all on this card.

Call after OpenGL is intialized. Will render on the backbuffer but not make the backbuffer visible. Safe to call multiple times; the result is memoized.

Radeon Mobility 7500 has been shown to have a bug where not only does hasBug_glMultiTexCoord3fvARB() exist, but normal maps can't work around the problem.

If detected, G3D::Sky will revert to non-cube map textures.

static bool G3D::GLCaps::hasBug_redBlueMipmapSwap (  )  [static]

Radeon mobility 7500 occasionally flips the red and blue channels when auto-generating mipmaps.

This has proven to be a reliable test for this bug.

If this bug is detected, G3D::Texture switches to RGBA8 formats for RGB8 data.

static bool G3D::GLCaps::hasBug_slowVBO (  )  [static]

Some graphics cards (e.g.

Radeon Mobility 7500) support the VBO extension but it is slower than main memory in most cases due to poor cache behavior. This method performs a speed test the first time it is invoked and identifies those cards.

static void G3D::GLCaps::init (  )  [static]

Loads OpenGL extensions (e.g.

glBindBufferARB). Call this once at the beginning of the program, after a video device is created. This is called for you if you use G3D::RenderDevice.

static int G3D::GLCaps::numTextureCoords (  )  [inline, static]

static int G3D::GLCaps::numTextures (  )  [inline, static]

Some devices (e.g.

NVIDIA cards) support more textures than texture matrices

static int G3D::GLCaps::numTextureUnits (  )  [inline, static]

static const std::string& G3D::GLCaps::renderer (  )  [static]

static bool G3D::GLCaps::supports ( const class TextureFormat fmt  )  [static]

Returns true if the given texture format is supported on this device.

static bool G3D::GLCaps::supports ( const std::string &  extName  )  [static]

static bool G3D::GLCaps::supports_GL_ARB_fragment_program (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_fragment_shader (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_multitexture (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_shader_objects (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_shading_language_100 (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_shadow (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_texture_border_clamp (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_texture_cube_map (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_texture_non_power_of_two (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_vertex_buffer_object (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_vertex_program (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ARB_vertex_shader (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_ATI_separate_stencil (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_framebuffer_object (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_geometry_shader4 (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_stencil_two_side (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_stencil_wrap (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_texture3D (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_texture_compression_s3tc (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_texture_cube_map (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_texture_edge_clamp (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_EXT_texture_rectangle (  )  [inline, static]

static bool G3D::GLCaps::supports_GL_NV_vertex_program2 (  )  [inline, static]

static bool G3D::GLCaps::supports_two_sided_stencil (  )  [static]

Returns true if either GL_EXT_stencil_two_side or GL_ATI_separate_stencil is supported.

Convenient becaused G3D::RenderDevice unifies those extensions.

static const std::string& G3D::GLCaps::vendor (  )  [static]


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:46 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo