# Using Shaders in an IDL Application

The IDLgrShader object class exposes OpenGL Shader Language (GLSL) code within an IDL application. Using shader object properties, you can define the required vertex shader and fragment shader components by either passing in a string containing the GLSL program or by passing in a filename.

Always associate a shader object with an atomic graphic object using the SHADER property. SHADER is a property of the following objects:

- IDLgrAxis
- IDLgrContour
- IDLgrImage
- IDLgrLight
- IDLgrPlot
- IDLgrPolygon
- IDLgrPolyLine
- IDLgrROI
- IDLgrROIGroup
- IDLgrSurface
- IDLgrText
- IDLgrVolume

Although a shader object can be associated with any number of the listed graphic objects, a shader program is typically written with a specific object in mind since the IDL application will likely pass object-specific parameters to the shader program. For example, a byte-scale image processing shader would have little applicability to a text object. Additional shader-related properties exist on IDLgrImage, IDLgrLight, IDLgrPlot, IDLgrPolygon, IDLgrPolyline, and IDLgrSurface.

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

Note: In an image processing application, more than a single shader can be associated with an IDLgrImage object through the use of an IDLgrFilterChain object. See “Filter Chain Shaders” for details.

Note: Shaders are a hardware-based feature. Be sure to specify the hardware renderer (for example, set the IDLgrWindow RENDERER property to 0).