Geometry Shader beginner question (interpolation)


    Jun 11 2018 | 6:10 pm
    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 ?!

    • Jun 11 2018 | 7:30 pm
      ... Adding the attribute "@smooth_shading 1" into jit.gl.mesh object is far better...!
    • Jun 13 2018 | 8:03 pm
      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.
    • Jun 14 2018 | 3:22 pm
      post your patch and your shader if you want help debugging
    • Jun 14 2018 | 4:40 pm
      they're attached in the original post. thanks!