Routines (alphabetical) > Object Classes > Graphics Object Classes > IDLgrShader Properties

# IDLgrShader Properties

IDLgrShader objects have the following properties in addition to properties inherited from any superclasses. Properties with the word “Yes” in the “Get” column of the property table can be retrieved via IDLgrShader::GetProperty. Properties with the word “Yes” in the “Init” column of the property table can be set via IDLgrShader::Init. Properties with the word “Yes” in the “Set” column in the property table can be set via IDLgrShader::SetProperty.

Note: For a discussion of the property description tables shown below, see About Object Property Descriptions.

Objects of this class have the following properties:

- CACHE_RESULT
- FORCE_FILTER
- FRAGMENT_PROGRAM_FILENAME
- FRAGMENT_PROGRAM_STRING
- OUTPUT_DATA_TYPE
- VERTEX_PROGRAM_FILENAME
- VERTEX_PROGRAM_STRING

### CACHE_RESULT

If a shader object is associated with an IDLgrImage object, you may set this property to determine whether a shader program is executed every time Draw is called as follows:

Value | Description
0 | The default. Apply the shader each time Draw is called. This is suitable for applications with a fast graphics card or one that is interactively updated by uniform variable parameter changes. (Re-caching the image each time the shader is changed carries a performance penalty.)
Non-zero | Cache the result of applying the shader and use this cached result in subsequent renderings. This setting is appropriate for slow graphics cards or applications that requires fast redraw capabilities such as when panning or zooming.

If a software fallback is in use or the image is part of an IDLgrFilterChain, the value of this property is ignored and the result of applying the shader is always cached. This property is ignored if the shader object is associated with any object other than IDLgrImage. The default value is 0.

Note: Your graphics card must support FRAMEBUFFER_OBJECT_EXTENSION when you request caching (CACHE_RESULT=1). You can determine this support using IDLgrWindow::GetDeviceInfo.

Property Type | Integer
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### FORCE_FILTER

Set this scalar long property to a non-zero value to cause IDL to call the IDLgrShader subclass Filter method, even if the graphics hardware supports shaders. This is useful for developing and testing the software fallback option on devices that have the hardware support. The default value for this property is zero. This property can only be set at Init time.

Property Type | Integer
Name String | not displayed
Get: Yes | Set: No | Init: Yes | Registered: No

### FRAGMENT_PROGRAM_FILENAME

This property is a scalar string containing the complete filepath specifying a text file that contains the fragment program text. If specified, IDL ignores the FRAGMENT_PROGRAM_STRING property. If the file does not exist when IDL draws the scene using this shader, IDL reports an informational error and continues drawing without the shader program.

Property Type | String
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### FRAGMENT_PROGRAM_STRING

This property is a scalar string that contains the fragment program text. If your application maintains the program as an array of strings, one for each program line, use STRJOIN to create a single string that is suitable for this property. Specify a newline string (`10B`) as the delimiter in STRJOIN so that the shader program compiler can report a useful line number in any compilation error messages. For example:

programString = STRJOIN(pgmStrings, STRING(10B))

Property Type | String
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### OUTPUT_DATA_TYPE

This property controls the precision of data storage used for an interim image when the following conditions apply to the shader object:

- It is associated with an IDLgrImage object
- It is being executed on the GPU of the graphics card (suitable hardware is available)
- It is either contained in an IDLgrFilterChain object or CACHE_RESULT=1.

This scalar long property may be set to one of the following values:

Value | Description
1 | BYTE
2 | FLOAT16
3 | FLOAT32 (the default)

When the IDLgrShader is in an IDLgrFilterChain, OUTPUT_DATA_TYPE specifies the precision of the temporary storage used to pass data from one shader to the next in the chain. When CACHE_RESULT is set to 1, OUTPUT_DATA_TYPE specifies the precision of the cache used to store the result of the shader operation.

Note: If you will be capturing the image data during or after applying the shaders, the OUTPUT_DATA_TYPE property and the DATA_TYPE keyword of IDLgrImage::ReadFilteredData should have consistent values.

Note: For best performance use the lowest precision possible without loss of data.

The default value is 3.

Property Type | Integer
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### VERTEX_PROGRAM_STRING

This property is a scalar string that contains the vertex program text. If your application maintains the program as an array of strings, one for each program line, use STRJOIN to create a single string that is suitable for this property. Specify a newline string (`10B`) as the delimiter in STRJOIN so that the shader program compiler can report a useful line number in any compilation error messages. For example:

programString = STRJOIN(pgmStrings, STRING(10B))

Property Type | String
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### VERTEX_PROGRAM_FILENAME

This property is a scalar string containing the complete filepath specifying a text file that contains the vertex program text. If specified, IDL ignores the VERTEX_PROGRAM_STRING property. If the file does not exist when IDL draws the scene using this shader, IDL reports an informational error and continues drawing without the shader program.

Property Type | String
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No