Have anyone used geometry shaders in SharpGL? I cannot figure out how to accomplish it in my code. As I see method Create which is provided with ShaderProgram from SharpGL.Shaders take only Vertex Shader and Fragment Shader as parameters.

public void Create(
  OpenGL gl,
  string vertexShaderSource,
  string fragmentShaderSource,
  Dictionary<uint, string> attributeLocations
);

How can I link my geometry shader with OpenGL via SharpGL? Or I need to use another approach to get Geometry Shader worked?

有帮助吗?

解决方案

I've found the solution to my own question. Quite a straightforward OpenGL approach can be applied for this issue. All that's needed is to create a geometry shader, compile it and than attach to program.

uint program = gl.CreateProgram();
uint geom = gl.CreateShader(OpenGL.GL_GEOMETRY_SHADER);
gl.ShaderSource(shader, geometryShaderSourceString);
gl.CompileShader(shader);
gl.AttachShader(program, geom);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top