Question

Is there any possibility of exporting from geometry shader only triangles instead triangle strips? This enables some interesting possibilities. OpenGL 3.3.

glProgramParameteriARB(mVoxelShd, GL_GEOMETRY_OUTPUT_TYPE_ARB, GL_TRIANGLE_STRIP);

Specifies witch output mode does the shader. And if I try:

glProgramParameteriARB(mVoxelShd, GL_GEOMETRY_OUTPUT_TYPE_ARB, GL_TRIANGLES);

It compiles and works fine, but it manifests identically like triangle strips.

Also the GLSL language specification 3.3:

The layout qualifier identifiers for geometry shader outputs are

  • layout-qualifier-id
  • points
  • line_strip
  • triangle_strip
  • max_vertices = integer-constant

Here it seems there is no "triangles".

Était-ce utile?

La solution

My mistake, it seems that independent triangles can be exported in the geometry shader by using EndPrimitive() after each specified triangle sequence. And this seems even more powerfull. Triangle strips and independent triangles both can be created from a single shader, without changing geometry output type.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top