Geometry Shader beginner question (interpolation)
Hi everyone,
I'm jumping into the extra dimension of geometry shader...
There is some useful (and accessible) resources on the net like this one:
https://learnopengl.com/Advanced-OpenGL/Geometry-Shader
First step is to build houses based on points. Like this :

After translation from version 330 to version 120 (not an easy step...), I manage to have houses, but with a very different snow effect:

Inside the geometry shader, there is the function to create new vertice and change the color for the roof:void build_house(vec4 position)
{
gl_FrontColor = gl_FrontColorIn[0];
gl_Position = position + vec4(-0.2, -0.2, 0.0, 0.0);
EmitVertex();
gl_Position = position + vec4( 0.2, -0.2, 0.0, 0.0);
EmitVertex();
gl_Position = position + vec4(-0.2, 0.2, 0.0, 0.0);
EmitVertex();
gl_Position = position + vec4( 0.2, 0.2, 0.0, 0.0);
EmitVertex();
gl_Position = position + vec4( 0.0, 0.4, 0.0, 0.0);
gl_FrontColor = vec4(1.0);
EmitVertex();
EndPrimitive();
}
What I understand is: for the first 4 vertices, color is related to the gl_FrontColor. For the last one, the color is white. Because of the shader system, the color has to interpolate from gl_FrontColor to white, is that right ?
What am I missing ?!
...
Adding the attribute "@smooth_shading 1" into jit.gl.mesh object is far better...!

Sorry to hijack your thread, but I'm also jumping into geometry shaders and am not able to recreate your results. I'm on OSX-- any idea why I get a blank screen? Nothing in the console.
post your patch and your shader if you want help debugging
they're attached in the original post. thanks!
With gl3, after translation to version 330 I have the same result - no gradient in the roof despite activated smooth_shading. But back on gl2 it works (with version 120). Any ideas?
would need to see your updated patch and gl3 shader file to offer help
Rob, is something wrong with my files?
just remove the "flat" type qualifier from the color input/output variables in each of your programs so that the shader will interpolate the color across the pixels.
with the removal of fixed function pipeline in gl3, attributes like smooth_shading will have no effect when used with custom shaders.
That's it, thanks!