Results 1 to 2 of 2

Thread: glsl count in fragment shader

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2015
    Posts
    7

    Question glsl count in fragment shader

    Hello, i need color change of the rectangle for that I need to make a counter , how to do it ?
    #version 430

    out vec4 FragColor;

    float counter = 0;

    void main(){

    counter++;
    FragColor = vec4( 1,0,0,1 );
    };

    This count not work.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,101
    You need to use an atomic counter.

Similar Threads

  1. GLSL fragment shader, get the 3 vertices?
    By paulggriffiths in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-10-2017, 05:09 AM
  2. [GLSL 330] No blending in the fragment shader.
    By Lolilolight in forum OpenGL: GLSL
    Replies: 8
    Last Post: 03-30-2015, 03:58 PM
  3. [GLSL] Texture2D in fragment shader
    By GloWondub in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-12-2010, 06:56 AM
  4. GLSL: Default GL Fragment and Vertex Shader
    By Loicus in forum OpenGL: GLSL
    Replies: 2
    Last Post: 12-12-2009, 07:41 AM
  5. Replies: 4
    Last Post: 02-25-2007, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean