6
\$\begingroup\$

Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without sending any vertex positions - gl_Position could be set completely procedurally.

That said I'd still need to specify a "t" value per point via vertex attributes.

Is it possible to specify attributes (ie via glVertexAttribPointer) without specifying vertices? Or does the GL need "space" in the buffers for vertices - even if they aren't initialized.

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

Sure, modern GL doesn't have any such limitations, just pass the correct data to glVertexAttribPointer, 1D vertex attribute is supported.

Think about it, using glVertexAttribPointer, where do you say to the GL that this data are vertices? Nowhere, it's generic, any implementation should accept any data you pass.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Thanks for the answer, I actually found confirmation of this in the OpenGL ES 2.0 specification the other day, but now can't find the reference to post here. \$\endgroup\$
    – Justicle
    Aug 18, 2010 at 18:47
  • 1
    \$\begingroup\$ Beware that this won't work on all GL implementations. Empty gl_Position is not supported until 3.0? (not sure). You need to pass at least one vertex position otherwise the shader is not run. So as usual, the GL version you're targeting is essential to answer the question properly. There are some platforms that don't have GL3.x yet unfortunately.. \$\endgroup\$ Nov 11, 2011 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .