czm_viewport

czm_viewport

An automatic GLSL uniform containing the viewport's x, y, width, and height properties in an vec4's x, y, z, and w components, respectively.

Like all automatic uniforms, czm_viewport does not need to be explicitly declared. However, it can be explicitly declared when a shader is also used by other applications such as a third-party authoring tool.

Example
// GLSL declaration
uniform vec4 czm_viewport;

// Scale the window coordinate components to [0, 1] by dividing
// by the viewport's width and height.
vec2 v = gl_FragCoord.xy / czm_viewport.zw;
See:
  • Context#getViewport
Source: