Routines (alphabetical) > Object Classes > Graphics Object Classes > IDLgrShaderConvol3

# IDLgrShaderConvol3

A convolution shader object is a subclass of IDLgrShader that can be associated with an IDLgrImage object via the SHADER property to perform general 3x3 convolution operations such as smoothing and edge detection on the image data as it is drawn to the screen. If hardware shader support is available, IDL will use it. Otherwise, this object performs the operation using a software-based alternative.

IDLgrShaderConvol3 performs the convolution operation on each channel independently, using either a predefined convolution KERNEL or a user-specified kernel.

Since the hardware shader programs require data in floating-point format, this function converts the input data into the floating-point range of [0,1], applies the scaling, and then maps the scaled data into the device's output range.

The reserved uniform variable `_IDL_ImageStep` is set by the IDLgrImage object before calling the shader program. This GLSL type `vec2` variable contains the texture coordinate offsets needed to locate adjacent texels in both the x and y dimensions. These offsets are useful to shader programs that implement convolution kernels because it is necessary to use neighboring texels in these computations.

Note: Setting IDLgrImage RENDER_METHOD=1 (do not render image as texture-mapped polygon) disables all shader functionality including the software-based alternative.

This object class is implemented in the IDL language. Its source code can be found in the file `idlgrshaderconvol3__define.pro` in the `lib` subdirectory of the IDL distribution.

## Superclasses

IDLgrShader

## Creation

See IDLgrShaderConvol3::Init.

## Properties

Objects of this class have the following properties. See IDLgrShaderConvol3 Properties for details on individual properties.

- BASE_BLEND_FACTOR
- CONVOL_BLEND_FACTOR
- KERNEL

In addition, objects of this class inherit the properties of all superclasses of this class.

## Methods

This class has the following methods:

- IDLgrShaderConvol3::Cleanup
- IDLgrShaderConvol3::GetProperty
- IDLgrShaderConvol3::Init
- IDLgrShaderConvol3::SetProperty

In addition, this class inherits the methods of its superclass (IDLgrShader).

## Examples

The following example creates four instances of the IDLgrShaderConvol3 object and lets you apply one or more shaders to an image by modifying the IDLgrFilterChain object.

See `shader_filterchain_doc__define.pro` for the complete, working example, which is located in the `examples/doc/shaders` subdirectory of the IDL distribution. Run the example by creating entering `o=OBJ_NEW('shader_filterchain_doc')` at the IDL command prompt or view the file in an IDL Editor window by entering `.edit shader_filterchain_doc__define.pro`.

## Version History

6.4 | Introduced

## See Also

IDLgrShader, IDLgrImage, IDLgrFilterChain, IDLgrShaderBytscl