Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
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. –  Justicle Aug 18 '10 at 18:47
    
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.. –  Bjorn Wesen Nov 11 '11 at 23:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.