2 Replies Latest reply on Jan 3, 2014 7:46 AM by cippyboy

    OpenGL Geometry shaders and different inputs/outputs

    cippyboy

      I'm running the latest AMD Driver for my HD 7850 and I'm seeing a weird behavior when drawing points that expand to triangles in the geometry shader. For some reason my specifications are not taken into acount :

       

      layout(points) in;

      layout(triangle_strip, max_vertices = 4) out;

       

      With them on or commented, the output is exactly the same, instead of getting a small quad for each point, I get a bigger quad of points(as if the geometry part doesn't even execute)

       

      As of note, the equivalent DX11 shaders work flawlessly.

       

      Side issue : nothing I tried disables point antialiasing, they even get rendered at a size of 2x2 at a minimum, you can check the picture for proof.

        • Re: OpenGL Geometry shaders and different inputs/outputs
          nou
          layout(points) in;
          layout(triangle_strip, max_vertices=4) out;
          
          uniform mat4 ModelViewMatrix;
          uniform mat4 ProjectionMatrix;
          
          in geom_vert
          {
              vec4 position;
          }gl_in[];
          
          out geom_frag
          {
              vec2 texcoord;
              vec4 color;
          };
          
          void main(void)
          {
              const float size = 0.1;
              vec4 pos = ModelViewMatrix * gl_in[0].position;
              color = gl_in[0].position;
              texcoord = vec2(-1, -1);
              gl_Position = ProjectionMatrix * (pos+vec4(texcoord*size, 0.0, 0.0));
              EmitVertex();
              texcoord = vec2(1, -1);
              gl_Position = ProjectionMatrix * (pos+vec4(texcoord*size, 0.0, 0.0));
              EmitVertex();
              texcoord = vec2(-1, 1);
              gl_Position = ProjectionMatrix * (pos+vec4(texcoord*size, 0.0, 0.0));
              EmitVertex();
              texcoord = vec2(1, 1);
              gl_Position = ProjectionMatrix * (pos+vec4(texcoord*size, 0.0, 0.0));
              EmitVertex();
              EndPrimitive();
          }
          
          
          

          my simple geometry shader which draw quad in position of point.

          • Re: OpenGL Geometry shaders and different inputs/outputs
            cippyboy

            Thanks for the reply,I think I found the problem. I was rendering to a half resolution RT hence why the points were always antialiased, they were stretched a bit. Second off, the quads do appear but I was rendering to a half resolution RT, binding my initial framebuffer on a texture slot (even if I'm not using it right now) and then rendering again to the initial framebuffer. That might generate a corruption there. When I switched to rendering to a temporary full resolution RT, everything seems to work just fine.