0
votes

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".

1
Note that glProgramParameteriARB is not 3.3. That's not how 3.3 works; that's ARB_geometry_shader4, which is not the same thing as core Geometry Shaders.Nicol Bolas
That is a useful observation. This means that the language specification it is mostly correct for core features, and ARB, and EXT can employ different rules?Palax
Only core extensions are required to have the exact same semantics and functionality as the core feature. For all other extensions, the core feature does not have to match the extension version. GLSL changed significantly between ARB_shader_objects and the GL 2.0 version.Nicol Bolas

1 Answers

1
votes

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.