Panda3D
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GraphicsStateGuardian Class Reference

Encapsulates all the communication with a particular instance of a given rendering backend. Tries to guarantee that redundant state-change requests are not issued (hence "state guardian"). More...

Inheritance diagram for GraphicsStateGuardian:
GraphicsStateGuardianBase TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

Public Types

enum  ShaderModel {
  SM_00 = 0, SM_11 = 1, SM_20 = 2, SM_2X = 3,
  SM_30 = 4, SM_40 = 5, SM_50 = 6
}
 

Public Member Functions

bool beginScene ()
 Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene(). This must be called in the draw thread. More...
 
 clearFlashTexture ()
 Resets the "flash texture", so that no textures will flash. See set_flash_texture(). More...
 
 endScene ()
 Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene(). More...
 
bool getAlphaScaleViaTexture ()
 Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via an additional Texture layer, or false if we need to actually munge the alpha. More...
 
bool getAlphaScaleViaTexture (const TextureAttrib tex_attrib)
 This variant of get_alpha_scale_via_texture() answers the question of whether the GSG can implement an alpha scale via an additional Texture layer, considering the current TextureAttrib that will be in effect. This considers whether there is at least one additional texture slot available on the GSG. More...
 
bool getColorScaleViaLighting ()
 Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale using materials and/or ambient lights, or false if we need to actually munge the color. More...
 
CoordinateSystem getCoordinateSystem ()
 Returns the coordinate system in effect on this particular gsg. Normally, this will be the default coordinate system, but it might be set differently at runtime. More...
 
bool getCopyTextureInverted ()
 Returns true if this particular GSG has the property that any framebuffer-to-texture copy results in a texture that is upside-down and backwards from Panda's usual convention; that is, it copies into a texture from the bottom up instead of from the top down. More...
 
str getDriverRenderer ()
 Returns GL_Renderer. More...
 
int getDriverShaderVersionMajor ()
 Returns the major version of the shader model. More...
 
int getDriverShaderVersionMinor ()
 Returns the minor version of the shader model. More...
 
str getDriverVendor ()
 Returns the vendor of the video card driver. More...
 
str getDriverVersion ()
 Returns driver version This has an implementation-defined meaning, and may be "" if the particular graphics implementation does not provide a way to query this information. More...
 
int getDriverVersionMajor ()
 Returns major version of the video driver. This has an implementation-defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information. More...
 
int getDriverVersionMinor ()
 Returns the minor version of the video driver. This has an implementation-defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information. More...
 
GraphicsEngine getEngine ()
 Returns the graphics engine that created this GSG. Since there is normally only one GraphicsEngine object in an application, this is usually the same as the global GraphicsEngine. More...
 
Texture getFlashTexture ()
 Returns the current "flash texture", if any, or NULL if none. See set_flash_texture(). More...
 
float getGamma (float gamma)
 Get the current gamma setting. More...
 
CoordinateSystem getInternalCoordinateSystem ()
 Returns the coordinate system used internally by the GSG. This may be the same as the external coordinate system reported by get_coordinate_system(), or it may be something different. More...
 
Loader getLoader ()
 Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More...
 
int getMax2dTextureArrayLayers ()
 Returns the largest possible number of pages, or -1 if there is no particular limit. Returns 0 if 2-d texture arrays not supported. More...
 
int getMax3dTextureDimension ()
 Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is no particular limit. Returns 0 if 3-d textures are not supported. More...
 
int getMaxClipPlanes ()
 Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit. More...
 
int getMaxColorTargets ()
 Returns the maximum number of simultaneous color textures that may be attached for render-to-texture, as supported by this particular GSG. If you exceed this number, the lowest-priority render targets will not be applied. Use RenderTarget::set_priority() to adjust the relative importance of the different render targets. More...
 
int getMaxCubeMapDimension ()
 Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit. Returns 0 if cube map textures are not supported. More...
 
int getMaximumSimultaneousRenderTargets ()
 Deprecated. Use get_max_color_targets() instead, which returns the exact same value. More...
 
int getMaxLights ()
 Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit. More...
 
int getMaxTextureStages ()
 Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG. If you exceed this number, the lowest-priority texture stages will not be applied. Use TextureStage::set_priority() to adjust the relative importance of the different texture stages. More...
 
int getMaxVertexTransformIndices ()
 Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware. If this number is 0 (but get_max_transforms() is nonzero), then the graphics hardware (or API) doesn't support indexed transforms, but can support direct transform references. More...
 
int getMaxVertexTransforms ()
 Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware. If this number is 0, then the hardware (or the graphics backend) doesn't support soft-skinned vertices (in which case Panda will animate the vertices in software). More...
 
GraphicsPipe getPipe ()
 Returns the graphics pipe on which this GSG was created. More...
 
PreparedGraphicsObjects getPreparedObjects ()
 Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects). More...
 
object getPreparedTextures ()
 
bool getRuntimeColorScale ()
 Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale directly, without requiring any munging of vertices or tricks with lighting. More...
 
SceneSetup getScene ()
 Returns the current SceneSetup object. More...
 
ShaderGenerator getShaderGenerator ()
 Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More...
 
int getShaderModel ()
 Returns the ShaderModel. More...
 
bool getSupports2dTextureArray ()
 Returns true if this GSG can render 2-d textures array. More...
 
bool getSupports3dTexture ()
 Returns true if this GSG can render 3-d (volumetric) textures. More...
 
bool getSupportsBasicShaders ()
 Returns true if this particular GSG supports arbfp1+arbvp1 or above. More...
 
bool getSupportsCgProfile (str name)
 Returns true if this particular GSG supports the specified Cg Shader Profile. More...
 
bool getSupportsCompressedTexture ()
 Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing. More...
 
bool getSupportsComputeShaders ()
 Returns true if this particular GSG supports compute shaders. More...
 
bool getSupportsCubeMap ()
 Returns true if this GSG can render cube map textures. More...
 
bool getSupportsDepthStencil ()
 Returns true if this particular GSG supports textures whose format is F_depth_stencil. This only returns true if the GSG supports the full packed depth-stencil functionality. More...
 
bool getSupportsDepthTexture ()
 Returns true if this particular GSG supports textures whose format is F_depth_stencil. This returns true if the GSG supports GL_DEPTH_COMPONENT textures, which are considered a limited but still valid case of F_depth_stencil. More...
 
bool getSupportsGenerateMipmap ()
 Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software. If this is true, then mipmaps can safely be enabled for rendered textures (e.g. using the MultitexReducer). More...
 
bool getSupportsGeometryInstancing ()
 Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model. In OpenGL, this is done using the EXT_draw_instanced extension. More...
 
bool getSupportsGeometryShaders ()
 Returns true if this particular GSG supports geometry shaders. More...
 
bool getSupportsGlsl ()
 Returns true if this particular GSG supports GLSL shaders. More...
 
bool getSupportsOcclusionQuery ()
 Returns true if this GSG supports an occlusion query. If this is true, then begin_occlusion_query() and end_occlusion_query() may be called to bracket a sequence of draw_triangles() (or whatever) calls to measure pixels that pass the depth test. More...
 
bool getSupportsSamplerObjects ()
 Returns true if this particular GSG supports the use of sampler objects to record texture sampling parameters separately from the texture objects. This doesn't really affect functionality, but if this is false, it may mean that using the same texture with different SamplerState objects will result in reduced performance. More...
 
bool getSupportsStencil ()
 Returns true if this particular GSG supports stencil buffers at all. More...
 
bool getSupportsTessellationShaders ()
 Returns true if this particular GSG supports tesselation shaders. More...
 
bool getSupportsTexNonPow2 ()
 Returns true if this GSG can handle non power of two sized textures. More...
 
bool getSupportsTextureCombine ()
 Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of the texture blend modes specified by set_combine_rgb() and/or set_combine_alpha(). If this is false, you must limit yourself to using the simpler blend modes. More...
 
bool getSupportsTextureDot3 ()
 Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes. More...
 
bool getSupportsTextureSavedResult ()
 Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to save the result of a TextureStage and re-use it for multiple inputs. More...
 
bool getSupportsTimerQuery ()
 Returns true if this GSG supports a timer query. More...
 
bool getSupportsTwoSidedStencil ()
 Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon. More...
 
Texture::QualityLevel getTextureQualityOverride ()
 Returns the global quality_level override specified by set_texture_quality_override. More...
 
const GraphicsThreadingModel getThreadingModel ()
 Returns the threading model that was used to create this GSG. More...
 
bool getTimerQueriesActive ()
 Returns true if timer queries are currently enabled on this GSG. More...
 
bool hasExtension (str extension)
 Returns true if the GSG implements the extension identified by the given string. This currently is only implemented by the OpenGL back-end. More...
 
bool isActive ()
 Returns the active flag associated with the GraphicsStateGuardian. More...
 
bool isHardware ()
 Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only. More...
 
bool isValid ()
 Returns true if the GSG has been correctly initialized within a graphics context, false if there has been some problem or it hasn't been initialized yet. More...
 
bool needsReset ()
 Returns true if the gsg is marked as needing a reset. More...
 
 releaseAll ()
 Releases all prepared objects. More...
 
int releaseAllGeoms ()
 Frees the resources for all geoms associated with this GSG. More...
 
int releaseAllIndexBuffers ()
 Frees the resources for all index buffers associated with this GSG. More...
 
int releaseAllSamplers ()
 Frees the resources for all samplers associated with this GSG. More...
 
int releaseAllTextures ()
 Frees the resources for all textures associated with this GSG. More...
 
int releaseAllVertexBuffers ()
 Frees the resources for all vertex buffers associated with this GSG. More...
 
 restoreGamma ()
 Restore original gamma setting. More...
 
 setActive (bool active)
 Sets the active flag associated with the GraphicsStateGuardian. If the GraphicsStateGuardian is marked inactive, nothing is rendered. This is not normally turned off unless there is a problem with the rendering detected at a low level. More...
 
 setCoordinateSystem (CoordinateSystem cs)
 Changes the coordinate system in effect on this particular gsg. This is also called the "external" coordinate system, since it is the coordinate system used by the scene graph, external to to GSG. More...
 
 setFlashTexture (Texture tex)
 Sets the "flash texture". This is a debug feature; when enabled, the specified texture will begin flashing in the scene, helping you to find it visually. More...
 
bool setGamma (float gamma)
 Set gamma. Returns true on success. More...
 
 setIncompleteRender (bool incomplete_render)
 Sets the incomplete_render flag. When this is true, the frame will be rendered even if some of the geometry or textures in the scene are not available (e.g. they have been temporarily paged out). When this is false, the frame will be held up while this data is reloaded. More...
 
 setLoader (Loader loader)
 Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More...
 
bool setScene (SceneSetup scene_setup)
 Sets the SceneSetup object that indicates the initial camera position, etc. This must be called before traversal begins. Returns true if the scene is acceptable, false if something's wrong. This should be called in the draw thread only. More...
 
 setShaderGenerator (ShaderGenerator shader_generator)
 Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More...
 
 setShaderModel (int shader_model)
 Sets the ShaderModel. This will override the auto- detected shader model during GSG reset. Useful for testing lower-end shaders. More...
 
 setTextureQualityOverride (Texture::QualityLevel quality_level)
 Specifies the global quality_level to be imposed for all Textures rendered by this GSG. This overrides the value set on individual textures via Texture::set_quality_level(). Set this to Texture::QL_default in order to allow the individual texture quality levels to be respected. More...
 
- Public Member Functions inherited from GraphicsStateGuardianBase
bool getEffectiveIncompleteRender ()
 
list getGsgs ()
 
bool getIncompleteRender ()
 
int getMaxTextureDimension ()
 
int getMaxVerticesPerArray ()
 
int getMaxVerticesPerPrimitive ()
 
int getSupportedGeomRendering ()
 
bool getSupportsCompressedTextureFormat (int compression_mode)
 
bool getSupportsMultisample ()
 
bool getSupportsShadowFilter ()
 
bool getSupportsTextureSrgb ()
 
bool prefersTriangleStrips ()
 
- Public Member Functions inherited from TypedWritable
object __reduce__ ()
 
object __reduce_persist__ (object pickler)
 
str encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. Returns empty string on failure. More...
 
bool encodeToBamStream (String data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. Returns true on success, false on failure. More...
 
UpdateSeq getBamModified ()
 Returns the current bam_modified counter. This counter is normally incremented automatically whenever the object is modified. More...
 
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). More...
 

Static Public Member Functions

static TextureStage getAlphaScaleTextureStage ()
 Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from GraphicsStateGuardianBase
static TypeHandle getClassType ()
 
static GraphicsStateGuardianBase getDefaultGsg ()
 Returns a pointer to the "default" GSG. This is typically the first GSG created in an application; in a single-window application, it will be the only GSG. This GSG is used to determine default optimization choices for loaded geometry. More...
 
static GraphicsStateGuardianBase getGsg (int n)
 Returns the nth GSG in the universe. GSG's automatically add themselves and remove themselves from this list as they are created and destroyed. More...
 
static int getNumGsgs ()
 Returns the total number of GSG's in the universe. More...
 
static setDefaultGsg (GraphicsStateGuardianBase default_gsg)
 Specifies a particular GSG to use as the "default" GSG. See get_default_gsg(). More...
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypedWritableReferenceCount decodeFromBamStream (str data, BamReader reader)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. Returns NULL on error. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritable
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Detailed Description

Encapsulates all the communication with a particular instance of a given rendering backend. Tries to guarantee that redundant state-change requests are not issued (hence "state guardian").

There will be one of these objects for each different graphics context active in the system.

Member Enumeration Documentation

◆ ShaderModel

Enumerator
SM_00 
SM_11 
SM_20 
SM_2X 
SM_30 
SM_40 
SM_50 

Member Function Documentation

◆ beginScene()

bool beginScene ( )

Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene(). This must be called in the draw thread.

The return value is true if successful (in which case the scene will be drawn and end_scene() will be called later), or false if unsuccessful (in which case nothing will be drawn and end_scene() will not be called).

◆ clearFlashTexture()

clearFlashTexture ( )

Resets the "flash texture", so that no textures will flash. See set_flash_texture().

◆ endScene()

endScene ( )

Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene().

◆ getAlphaScaleTextureStage()

static TextureStage getAlphaScaleTextureStage ( )
static

Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true.

◆ getAlphaScaleViaTexture() [1/2]

bool getAlphaScaleViaTexture ( )

Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via an additional Texture layer, or false if we need to actually munge the alpha.

◆ getAlphaScaleViaTexture() [2/2]

bool getAlphaScaleViaTexture ( const TextureAttrib  tex_attrib)

This variant of get_alpha_scale_via_texture() answers the question of whether the GSG can implement an alpha scale via an additional Texture layer, considering the current TextureAttrib that will be in effect. This considers whether there is at least one additional texture slot available on the GSG.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getColorScaleViaLighting()

bool getColorScaleViaLighting ( )

Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale using materials and/or ambient lights, or false if we need to actually munge the color.

◆ getCoordinateSystem()

CoordinateSystem getCoordinateSystem ( )

Returns the coordinate system in effect on this particular gsg. Normally, this will be the default coordinate system, but it might be set differently at runtime.

◆ getCopyTextureInverted()

bool getCopyTextureInverted ( )

Returns true if this particular GSG has the property that any framebuffer-to-texture copy results in a texture that is upside-down and backwards from Panda's usual convention; that is, it copies into a texture from the bottom up instead of from the top down.

If this is true, then on offscreen GraphicsBuffer created for the purposes of rendering into a texture should be created with the invert flag set true, to compensate. Panda will do this automatically if you create an offscreen buffer using GraphicsOutput::make_texture_buffer().

◆ getDriverRenderer()

str getDriverRenderer ( )

Returns GL_Renderer.

◆ getDriverShaderVersionMajor()

int getDriverShaderVersionMajor ( )

Returns the major version of the shader model.

◆ getDriverShaderVersionMinor()

int getDriverShaderVersionMinor ( )

Returns the minor version of the shader model.

◆ getDriverVendor()

str getDriverVendor ( )

Returns the vendor of the video card driver.

◆ getDriverVersion()

str getDriverVersion ( )

Returns driver version This has an implementation-defined meaning, and may be "" if the particular graphics implementation does not provide a way to query this information.

◆ getDriverVersionMajor()

int getDriverVersionMajor ( )

Returns major version of the video driver. This has an implementation-defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information.

◆ getDriverVersionMinor()

int getDriverVersionMinor ( )

Returns the minor version of the video driver. This has an implementation-defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information.

◆ getEngine()

GraphicsEngine getEngine ( )

Returns the graphics engine that created this GSG. Since there is normally only one GraphicsEngine object in an application, this is usually the same as the global GraphicsEngine.

◆ getFlashTexture()

Texture getFlashTexture ( )

Returns the current "flash texture", if any, or NULL if none. See set_flash_texture().

◆ getGamma()

float getGamma ( float  gamma)

Get the current gamma setting.

◆ getInternalCoordinateSystem()

CoordinateSystem getInternalCoordinateSystem ( )

Returns the coordinate system used internally by the GSG. This may be the same as the external coordinate system reported by get_coordinate_system(), or it may be something different.

In any case, vertices that have been transformed before being handed to the GSG (that is, vertices with a contents value of C_clip_point) will be expected to be in this coordinate system.

◆ getLoader()

Loader getLoader ( )

Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.

◆ getMax2dTextureArrayLayers()

int getMax2dTextureArrayLayers ( )

Returns the largest possible number of pages, or -1 if there is no particular limit. Returns 0 if 2-d texture arrays not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMax3dTextureDimension()

int getMax3dTextureDimension ( )

Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is no particular limit. Returns 0 if 3-d textures are not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxClipPlanes()

int getMaxClipPlanes ( )

Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxColorTargets()

int getMaxColorTargets ( )

Returns the maximum number of simultaneous color textures that may be attached for render-to-texture, as supported by this particular GSG. If you exceed this number, the lowest-priority render targets will not be applied. Use RenderTarget::set_priority() to adjust the relative importance of the different render targets.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxCubeMapDimension()

int getMaxCubeMapDimension ( )

Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit. Returns 0 if cube map textures are not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaximumSimultaneousRenderTargets()

int getMaximumSimultaneousRenderTargets ( )

Deprecated. Use get_max_color_targets() instead, which returns the exact same value.

◆ getMaxLights()

int getMaxLights ( )

Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxTextureStages()

int getMaxTextureStages ( )

Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG. If you exceed this number, the lowest-priority texture stages will not be applied. Use TextureStage::set_priority() to adjust the relative importance of the different texture stages.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxVertexTransformIndices()

int getMaxVertexTransformIndices ( )

Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware. If this number is 0 (but get_max_transforms() is nonzero), then the graphics hardware (or API) doesn't support indexed transforms, but can support direct transform references.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getMaxVertexTransforms()

int getMaxVertexTransforms ( )

Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware. If this number is 0, then the hardware (or the graphics backend) doesn't support soft-skinned vertices (in which case Panda will animate the vertices in software).

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

◆ getPipe()

GraphicsPipe getPipe ( )

Returns the graphics pipe on which this GSG was created.

◆ getPreparedObjects()

PreparedGraphicsObjects getPreparedObjects ( )

Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects).

◆ getPreparedTextures()

object getPreparedTextures ( )

◆ getRuntimeColorScale()

bool getRuntimeColorScale ( )

Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale directly, without requiring any munging of vertices or tricks with lighting.

◆ getScene()

SceneSetup getScene ( )

Returns the current SceneSetup object.

◆ getShaderGenerator()

ShaderGenerator getShaderGenerator ( )

Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.

◆ getShaderModel()

int getShaderModel ( )

Returns the ShaderModel.

◆ getSupports2dTextureArray()

bool getSupports2dTextureArray ( )

Returns true if this GSG can render 2-d textures array.

◆ getSupports3dTexture()

bool getSupports3dTexture ( )

Returns true if this GSG can render 3-d (volumetric) textures.

◆ getSupportsBasicShaders()

bool getSupportsBasicShaders ( )

Returns true if this particular GSG supports arbfp1+arbvp1 or above.

◆ getSupportsCgProfile()

bool getSupportsCgProfile ( str  name)

Returns true if this particular GSG supports the specified Cg Shader Profile.

◆ getSupportsCompressedTexture()

bool getSupportsCompressedTexture ( )

Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing.

◆ getSupportsComputeShaders()

bool getSupportsComputeShaders ( )

Returns true if this particular GSG supports compute shaders.

◆ getSupportsCubeMap()

bool getSupportsCubeMap ( )

Returns true if this GSG can render cube map textures.

◆ getSupportsDepthStencil()

bool getSupportsDepthStencil ( )

Returns true if this particular GSG supports textures whose format is F_depth_stencil. This only returns true if the GSG supports the full packed depth-stencil functionality.

◆ getSupportsDepthTexture()

bool getSupportsDepthTexture ( )

Returns true if this particular GSG supports textures whose format is F_depth_stencil. This returns true if the GSG supports GL_DEPTH_COMPONENT textures, which are considered a limited but still valid case of F_depth_stencil.

◆ getSupportsGenerateMipmap()

bool getSupportsGenerateMipmap ( )

Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software. If this is true, then mipmaps can safely be enabled for rendered textures (e.g. using the MultitexReducer).

◆ getSupportsGeometryInstancing()

bool getSupportsGeometryInstancing ( )

Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model. In OpenGL, this is done using the EXT_draw_instanced extension.

◆ getSupportsGeometryShaders()

bool getSupportsGeometryShaders ( )

Returns true if this particular GSG supports geometry shaders.

◆ getSupportsGlsl()

bool getSupportsGlsl ( )

Returns true if this particular GSG supports GLSL shaders.

◆ getSupportsOcclusionQuery()

bool getSupportsOcclusionQuery ( )

Returns true if this GSG supports an occlusion query. If this is true, then begin_occlusion_query() and end_occlusion_query() may be called to bracket a sequence of draw_triangles() (or whatever) calls to measure pixels that pass the depth test.

◆ getSupportsSamplerObjects()

bool getSupportsSamplerObjects ( )

Returns true if this particular GSG supports the use of sampler objects to record texture sampling parameters separately from the texture objects. This doesn't really affect functionality, but if this is false, it may mean that using the same texture with different SamplerState objects will result in reduced performance.

◆ getSupportsStencil()

bool getSupportsStencil ( )

Returns true if this particular GSG supports stencil buffers at all.

◆ getSupportsTessellationShaders()

bool getSupportsTessellationShaders ( )

Returns true if this particular GSG supports tesselation shaders.

◆ getSupportsTexNonPow2()

bool getSupportsTexNonPow2 ( )

Returns true if this GSG can handle non power of two sized textures.

◆ getSupportsTextureCombine()

bool getSupportsTextureCombine ( )

Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of the texture blend modes specified by set_combine_rgb() and/or set_combine_alpha(). If this is false, you must limit yourself to using the simpler blend modes.

◆ getSupportsTextureDot3()

bool getSupportsTextureDot3 ( )

Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes.

◆ getSupportsTextureSavedResult()

bool getSupportsTextureSavedResult ( )

Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to save the result of a TextureStage and re-use it for multiple inputs.

◆ getSupportsTimerQuery()

bool getSupportsTimerQuery ( )

Returns true if this GSG supports a timer query.

◆ getSupportsTwoSidedStencil()

bool getSupportsTwoSidedStencil ( )

Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon.

◆ getTextureQualityOverride()

Texture::QualityLevel getTextureQualityOverride ( )

Returns the global quality_level override specified by set_texture_quality_override.

This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().

◆ getThreadingModel()

const GraphicsThreadingModel getThreadingModel ( )

Returns the threading model that was used to create this GSG.

◆ getTimerQueriesActive()

bool getTimerQueriesActive ( )

Returns true if timer queries are currently enabled on this GSG.

◆ hasExtension()

bool hasExtension ( str  extension)

Returns true if the GSG implements the extension identified by the given string. This currently is only implemented by the OpenGL back-end.

◆ isActive()

bool isActive ( )

Returns the active flag associated with the GraphicsStateGuardian.

◆ isHardware()

bool isHardware ( )

Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only.

◆ isValid()

bool isValid ( )

Returns true if the GSG has been correctly initialized within a graphics context, false if there has been some problem or it hasn't been initialized yet.

◆ needsReset()

bool needsReset ( )

Returns true if the gsg is marked as needing a reset.

◆ releaseAll()

releaseAll ( )

Releases all prepared objects.

◆ releaseAllGeoms()

int releaseAllGeoms ( )

Frees the resources for all geoms associated with this GSG.

◆ releaseAllIndexBuffers()

int releaseAllIndexBuffers ( )

Frees the resources for all index buffers associated with this GSG.

◆ releaseAllSamplers()

int releaseAllSamplers ( )

Frees the resources for all samplers associated with this GSG.

◆ releaseAllTextures()

int releaseAllTextures ( )

Frees the resources for all textures associated with this GSG.

◆ releaseAllVertexBuffers()

int releaseAllVertexBuffers ( )

Frees the resources for all vertex buffers associated with this GSG.

◆ restoreGamma()

restoreGamma ( )

Restore original gamma setting.

◆ setActive()

setActive ( bool  active)

Sets the active flag associated with the GraphicsStateGuardian. If the GraphicsStateGuardian is marked inactive, nothing is rendered. This is not normally turned off unless there is a problem with the rendering detected at a low level.

◆ setCoordinateSystem()

setCoordinateSystem ( CoordinateSystem  cs)

Changes the coordinate system in effect on this particular gsg. This is also called the "external" coordinate system, since it is the coordinate system used by the scene graph, external to to GSG.

Normally, this will be the default coordinate system, but it might be set differently at runtime. It will automatically be copied from the current lens's coordinate system as each DisplayRegion is rendered.

◆ setFlashTexture()

setFlashTexture ( Texture  tex)

Sets the "flash texture". This is a debug feature; when enabled, the specified texture will begin flashing in the scene, helping you to find it visually.

The texture also flashes with a color code: blue for mipmap level 0, yellow for mipmap level 1, and red for mipmap level 2 or higher (even for textures that don't have mipmaps). This gives you an idea of the choice of the texture size. If it is blue, the texture is being drawn the proper size or magnified; if it is yellow, it is being minified a little bit; and if it red, it is being minified considerably. If you see a red texture when you are right in front of it, you should consider reducing the size of the texture to avoid wasting texture memory.

Not all rendering backends support the flash_texture feature. Presently, it is only supported by OpenGL.

◆ setGamma()

bool setGamma ( float  gamma)

Set gamma. Returns true on success.

◆ setIncompleteRender()

setIncompleteRender ( bool  incomplete_render)

Sets the incomplete_render flag. When this is true, the frame will be rendered even if some of the geometry or textures in the scene are not available (e.g. they have been temporarily paged out). When this is false, the frame will be held up while this data is reloaded.

Setting this true allows for a smoother frame rate, but occasionally parts of the frame will be invisible or missing (they will generally come in within a second or two). Setting this false guarantees that every frame will be complete, but may cause more chugs as things are loaded up at runtime.

You may want to set this false during loading screens, to guarantee that all of your assets are available by the time you take the loading screen down.

This flag may also be set individually on each DisplayRegion. It will be considered true for a given DisplayRegion only if it is true on both the GSG and on the DisplayRegion.

◆ setLoader()

setLoader ( Loader  loader)

Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.

◆ setScene()

bool setScene ( SceneSetup  scene_setup)

Sets the SceneSetup object that indicates the initial camera position, etc. This must be called before traversal begins. Returns true if the scene is acceptable, false if something's wrong. This should be called in the draw thread only.

◆ setShaderGenerator()

setShaderGenerator ( ShaderGenerator  shader_generator)

Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.

◆ setShaderModel()

setShaderModel ( int  shader_model)

Sets the ShaderModel. This will override the auto- detected shader model during GSG reset. Useful for testing lower-end shaders.

◆ setTextureQualityOverride()

setTextureQualityOverride ( Texture::QualityLevel  quality_level)

Specifies the global quality_level to be imposed for all Textures rendered by this GSG. This overrides the value set on individual textures via Texture::set_quality_level(). Set this to Texture::QL_default in order to allow the individual texture quality levels to be respected.

This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().