Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / Overview of Shader Objects

IDL

Overview of Shader Objects

Overview of Shader Objects

The shader functionality provides access to the advantages of the hardware-based, OpenGL Shading Language (GLSL). Using a shader, computationally-intensive image processing operations can be off-loaded to the graphics card, making the time and processing resources of the host computer available to other application elements. Additionally, the OpenGL Shading Language greatly expands on the capabilities of the fixed OpenGL rendering pipeline to produce advanced visual effects.

Whereas native IDL object graphics expose OpenGL capabilities through fixed object properties, GLSL offers the ability to modify virtually any object characteristic. Using shaders lets you implement realistic material and lighting effects, create animations by modifying object vertices, and achieve image processing performance rates that far exceed what is possible using the system CPU.

Note: This functionality only exposes the ability to use OpenGL Shading Language within an IDL application. It does not implement the shading language nor does this online help explain how to write shader language code. However, numerous GLSL publications and internet resources are available.

Why Use Shaders?


You can use shaders to produce elaborate 3D graphics, but shaders also offer increased performance and interactivity in image processing applications. Think about an application that performs the following operations on an image:

  • Convolution filter
  • Scale and offset bias
  • Tonal compensation (LUT)
  • Display compensation (LUT or BYTSCL)

Using the system CPU as the primary processor in a software-based solution, it is only possible to achieve a display rate of a few frames per second. However, if you use a shader program, IDL shifts the processing to the graphics card GPU and display rates of over 100 frames per second are possible. The shader program applies these operations on every draw so there is no performance penalty for altering parameters during rapid drawing sequence. This means that a user can change a parameter of the operation and see the results nearly instantaneously, which makes the image processing application highly responsive to interactive changes. See “How Shaders Enhance Performance” for details.

Shaders also provide a way to solve a wider range of image processing problems than what is possible using only the fixed functionality of the OpenGL pipeline in the standard IDL procedures and functions.

Hardware Requirements for Shaders


In general, shader programs will work on graphics cards and drivers that support the OpenGL 2.0 (or better) interface. Note that performance varies greatly between low- and high-end graphics cards, and also varies with the implementation and content of the shader program. Always use the most up-to-date drivers available for your graphics card when developing IDL applications using shaders.

Use the SHADING_LANGUAGE_VERSION keyword to IDLgrWindow::GetDeviceInfo to determine whether or not a card supports shader functionality. Executing the following code in IDL will briefly create an IDLgrWindow object and report on whether hardware shaders are available on your system:

oWin = OBJ_NEW('IDLgrWindow')
oWin->GetDeviceInfo, SHADING_LANGUAGE_VERSION=v
OBJ_DESTROY, oWin
PRINT, 'Shading language version: ', v
IF FLOAT(v) GE 1 THEN PRINT, 'Hardware shaders are available' $
  ELSE PRINT, 'Hardware shaders are not available'

A shader-equipped graphics card will not use the shader hardware if IDL is using software rendering. To make sure you are using the shading hardware, be sure to specify hardware rendering (for example, set the IDLgrWindow RENDERER property to 0 or set your graphics Preferences in the IDL Workbench).

Image processing applications can provide a software-based alternative in case the system graphics card does not support OpenGL 2.0.

Note: If there is insufficient support for the shader program, IDL draws the scene as if there was no shader object present unless a software fallback exists.

Note: Setting the IDLgrWindow property RETAIN to 2 disables hardware shaders. Software shaders are used if available.

 



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us