Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In OpenGL 3+ :</p> <ul> <li><code>varying</code> is deprecated</li> <li><code>const</code> is for... well, constants !</li> <li><code>uniform</code> is for per draw call (at most) values</li> <li><code>in</code> is for input from the previous pipeline stage, i.e. per vertex (or per fragment) values at most, per primitive if using glAttribDivisor and hardware instanciation</li> <li><code>out</code> is for output to the next stage</li> </ul> <p>Regarding outputs for fragment shaders : in OpenGL3 and up, most of the built-in variables for fragment shader output (such as <code>gl_FragColor</code>, with the notable exception of <code>gl_FragDepth</code>) are deprecated and should be replaced with user-defined <code>out</code> variables.</p> <p>If you are outputting to the default framebuffer, whatever you declare as the output of the fragment shader ends up in the color buffer. If you've bound an FBO with multiple color buffers (i.e. multiple render targets), you'll need to manually bind each of your <code>out</code> variables to the correct color buffer index via <code>glBindFragDataLocationIndexed</code>.</p> <p>All the details you could ever want about both the GLSL ('server') side and the OpenGL ('client') side can be found :</p> <ul> <li>in <a href="http://www.opengl.org/registry/doc/glspec41.core.20100725.pdf" rel="noreferrer">the OpenGL specification</a>, specifically pages 248-250 for color buffer output on fragment shaders. </li> <li>in <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.00.8.clean.pdf" rel="noreferrer">the GLSL specs</a>, page 38 and on for shader outputs.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload