Portal:OpenGL Shading Language/Opaque Types

From OpenGL Wiki
< Portal:OpenGL Shading Language
Revision as of 04:55, 25 July 2013 by Alfonse (talk | contribs) (Basic opaque type definition.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GLSL has a number of special types called 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.