0 Replies Latest reply on Mar 22, 2013 10:44 AM by allforum

    glLineStipple ignored when using a shader

    allforum

      Hello,

       

      If I use a varying float variable in a fragment shader I have no more dashed lines. If I comment the line then all works well...

       

      On an ATI X1300/X1550, with the basic shaders below, glLineStipple has no effect if I uncomment the red line !

      And in the sample to reproduce below I do not use this variable !

      In my "real" shader I need a variable to compute lighting : so I have light but I have no more dashed lines...

       

      Vertex shader :

      #version 110               
      varying vec3 N;               
      varying float vx;                   

      void main(void)
      {
      gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; 
      vx = 1.0;
      N = normalize(gl_NormalMatrix * gl_Normal);
      gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
      }

       

      Fragment shader :

      #version 110                   

      varying vec3 N;               

      varying float vx;

       

      void main (void)   

      {  

      vec3 L = normalize(gl_LightSource[0].position.xyz);  

      float vvx = vx;   // If I comment this useless line the card draws again dashed lines

      vec3 R = normalize(-reflect(L,N));           

      gl_FragColor = vec4(1,0,0,1);       

      return;                       

      }

       

      Did you already see some strange things like this ? Do you have an idea of what can cause the problem ?

       

      Thanks.