Geometry Shader with gl_PointSize

This example file is 99% from something Mike Walzcyk shared on the Facebook group in December 2015. I duplicated the GLSL Mat and changed the output primitive type to Points. I also added a uniform uPointSize and put it in the geometry shader DAT:

[code]void main()
{
vec3 normal = getNormal();

fColor = gs_in[0].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[0].gl_Position, normal);
EmitVertex();

fColor = gs_in[1].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[1].gl_Position, normal);
EmitVertex();

fColor = gs_in[2].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[2].gl_Position, normal);
EmitVertex();

EndPrimitive();

}[/code]

I also tried some other variations:

[code] fColor = gs_in[0].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[0].gl_Position, normal);
EmitVertex();
EndPrimitive();

fColor = gs_in[1].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[1].gl_Position, normal);
EmitVertex();
EndPrimitive();

fColor = gs_in[2].color;
gl_PointSize = uPointSize;
gl_Position = explode(gl_in[2].gl_Position, normal);
EmitVertex();
EndPrimitive();[/code]

And this is what I’m reading: [url]https://www.opengl.org/sdk/docs/man/html/gl_PointSize.xhtml[/url]

Why does changing the uniform uPointSize have no effect on the Render or Geometry previewer? I think I see the right number of points in those two places, but I can’t change the point size.
geometry_shader_examples.1.toe (8.09 KB)

I’m not at my machine at the moment, what version of GLSL are you using?

I had used them successfully in this tutorial:

nvoid.gitbooks.io/introduction- … stems.html

I’m just using 4.30. You’re getting at the crux of the issue, which is that I’m not using a Convert SOP Sprite SOP at all. In the file that I shared, I have triangles inside a Geo COMP and only once I’m in the geometry shader stage (not vertex shader) do I want to convert everything into Points. I expect to see three sprites for every triangle rather than a solidly filled surface. In my other project, I have a line inside a Geo. I instance those lines and create additional points on each line with the geometry shader. After that I want sprites at the points rather than many connected lines.

By the way, nice book! It would be helpful if the links to the example files were a little easier to use.

Be sure to use the layout() lines to specify your input/output primitive types and max output vertices.

Thanks. I read a little here [url]Layout Qualifier (GLSL) - OpenGL Wiki and put this at the top of the geometry shader:

layout(triangles) in; layout(points, max_vertices=3) out;
but I don’t see any effect from gl_PointSize. I’ve also tried a few other setups involving different SOP geometries (Line SOP for example) and layout qualifiers that match those geometry types (layout(lines) in;). In those cases too, the gl_PointSize isn’t affecting the render.

I think the issue is that Point Sprite rendering is only enabled when rending particle systems as point sprites, so it’s turned off when triangles are being rendered…