Portal:OpenGL Shading Language/Opaque Types

From OpenGL.org
Jump to: navigation, search

Among the types for GLSL variables are certain types that are designated Opaque Types. These are types that represent some construct of OpenGL that the shader is allowed to access. For example, variables that represent textures use a sampler opaque type.

Opaque types are treated specially by GLSL. They cannot be placed in structs, and their use in arrays is limited. They do not have a "value" in any real sense to GLSL; it is merely an interface to an OpenGL construct. The only way to use them, besides declaring them, is to pass them to other functions. And all opaque types have a number of built-in GLSL functions to read from or write to them.