l'arbre
l'arbre

Reputation: 719

unknown layout specifier 'triangles'

I just started testing around with geometry shaders a bit. I want to draw a triangle for every point. This is my shader:

#version 150

layout (points) in;
layout(triangles, max_vertices = 3) out;

void main(void)
{
    gl_Position = gl_in[0].gl_Position + vec4(0, 0, 0, 0);
    EmitVertex();
    gl_Position = gl_in[0].gl_Position + vec4(0.1, 0, 0, 0);
    EmitVertex();
    gl_Position = gl_in[0].gl_Position + vec4(0, 0.1, 0, 0);
    EmitVertex();
    EndPrimitive();
}

This is the error message:

error C3008: unknown layout specifier 'triangles'

It kind of works when replacing "triangles" with "points", but obviously it's drawing points instead.

Upvotes: 0

Views: 1712

Answers (1)

BDL
BDL

Reputation: 22165

According to the standard the only allowed primitive types for outputs are

  • points
  • line_strip
  • triangle_strip

So what you want is

layout(triangle_strip, max_vertices = 3) out;

Upvotes: 4

Related Questions