Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Multiple writes to gl_FragColor within main

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012
    Location
    Toulon, France
    Posts
    4

    Multiple writes to gl_FragColor within main

    Hi all,

    I had to modify a little shader wrote in GLSL someone else than me wrote. In this shader, there are several lines like this:

    Code :
    gl_FragColor = ...

    From what I am use to do (and from what I read here and there), I always write the color to a temporary value (a vec4) and at the end of the main function, effectively write to gl_FragColor.

    I tried to find out if this could be a performance issue (since there are several write calls to the fragment), but could achieve to find anything related.

    So I hope some people here could say me if that's not a problem at all, or if we should write to a temporary value to avoid effective writes to the fragment color.

    Regards.

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,290
    The compiler will create a temporary automatically, if it needs one.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2012
    Location
    Toulon, France
    Posts
    4
    Thanks for this quick answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •