Does gl_FragColor do everything gl_FragData does not?

As the tin says: is there any reason to use gl_FragColorinstead gl_FragData[0]? If not, why exist gl_FragColor? Is this a simple legacy from the moment when it gl_FragDatadid not exist?

(Yes, I know that both of them are deprecated in recent versions of GLSL, but I still want to write code that can work on older cards.)

+4
source share
1 answer

I refer you to the OpenGL specification for GLSL 1.1, as it makes very few differences between the two, except that they are mutually exclusive.

OpenGL ( 1.1) - 7.2 - . 43

gl_FragColor, gl_FragData. gl_FragData, gl_FragColor. gl_FragColor, gl_FragData, .

, gl_FragColor , , , MRT ( ). , , gl_FragData [n]. , , gl_FragColor gl_FragData [0].

FBOs GLSL, . GLSL FBOs OpenGL 3.0, . ARB :

14) MRT ( )         ?

The OpenGL Shading Language defines the array gl_FragData[] to output
values to multiple buffers. There are two situations to consider.

  1) There is no MRT extension support. A shader can statically assign a
     value to either gl_FragColor or gl_FragData[0] (but not both).
     Either way the same buffer will be targeted.
  2) There is MRT support. In this case what happens is defined in the
     relevant MRT extension documentation.

, . .

+9

All Articles