I was under the impression that the geometry shader - even though it’s only has triangle-strips - could still output triangle lists?
Maybe I’m wrong? If someone could let me know?
For example, my simple test case, I have three triangles:
Positions.push_back( Vector3f( 0.000000, 1.000000, 0.000000));
Positions.push_back( Vector3f( -1.000000, -1.000000, 0.000000));
Positions.push_back( Vector3f( 1.000000, -1.000000, 0.000000));
Positions.push_back( Vector3f( -1.000000, -2.000000, 0.000000));
Positions.push_back( Vector3f( 1.000000, -2.000000, 0.000000));
Indices.push_back( 0 );
Indices.push_back( 1 );
Indices.push_back( 2 );
Indices.push_back( 1 );
Indices.push_back( 3 );
Indices.push_back( 4 );
Indices.push_back( 1 );
Indices.push_back( 4 );
Indices.push_back( 2 );
…
// Very basic drawing code
{
glDisable( GL_CULL_FACE );
m_lightingTechnique->Enable();
glDisable(GL_RASTERIZER_DISCARD);
glBindBuffer(GL_ARRAY_BUFFER, m_particleBuffer[m_currTFB]);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); // position
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
glDrawTransformFeedback(GL_TRIANGLES, m_transformFeedback[m_currTFB]);
glDisableVertexAttribArray(0);
}
…
// Basic geometry shader
layout(triangles) in;
layout(triangle_strip) out; //
layout (max_vertices = 3) out;
void main()
{
for(int i=0; i<3; i++)
{
Position1 = Position0[i];
EmitVertex();
}
EndPrimitive();
}
// Basically, I have two triangle mesh lists - and I’m toggling back and forth to update the
// mesh data using the geometry shader - but want the data
// to remain as triangle-lists? However, it seems to fail - for example, the simple three triangles
// I only have the first triangle and the second two aren’t updated?
Thank you for any advice/help
Ben