Reading the GLSL 1.40 specification:
Fragment outputs can only be float, floating-point vectors, signed or unsigned integers or integer vectors, or arrays of any these. Matrices and structures cannot be output. Fragment outputs are declared as in the following examples:
out vec4 FragmentColor; out uint Luminosity;
The fragment color is defined writing gl_FragColor... is it right? Somebody could clear my ideas about these outputs? May I write only 'FragmentColor' of the example to determine fragment color? May I read back them ('Luminosity' for example)?
Per-Sample Processing is a stage of the OpenGL rendering pipeline, where Fragments output from a Fragment Shader are processed, and their resulting data are written to various buffers.
Uniform variables can appear in any shader within a shader program, and are always used as input variables. They can be declared in one or more shaders within a program, but if a variable with a given name is declared in more than one shader, its type must be the same in all shaders.
The Vertex-shader Each vertex shader input vertex can be comprised of up to 16 32-bit vectors (up to 4 components each) and each output vertex can be comprised of as many as 16 32-bit 4-component vectors. All vertex-shaders must have a minimum of one input and one output, which can be as little as one scalar value.
All shader stages can pass data between them by using input and output variables. If in the vertex shader we create an output variable, we will be able to read it on the fragment shader as an input variable.
The global output variable gl_FragColor is deprecated after GLSL version 120. Now you have to give it a name and type by yourself, as in your example. Regarding several outputs, this link gives you information about the mapping: http://www.opengl.org/wiki/GLSL_Objects#Program_linking
(And I found that link at: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=270999 )
Hope this helps! :D
Ooops! I see that kvark gave the relevant information. Anyway, maybe you got something out of my text too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With