View Full Version : glVertexAttrib() without glBegin()/glEnd()?
09-23-2010, 09:24 AM
Just a quick question: I know that glBegin() and glEnd() have been dropped from recent versions of the spec, but I noticed today that glVertexAttrib() is still there. How is the latter intended to be used without the former?
09-23-2010, 11:47 AM
glVertexAttrib sets an attribute on the "current" vertex.
If the vertex array for an attribute input to a shader is not enabled, then the shader still needs some input. That input comes from the "current" vertex-- e.g. the same value is replicated for every vertex.
09-23-2010, 02:23 PM
Okay, thanks! I suspected that might be the case, but I figured at that point you could just use a uniform variable.
09-27-2010, 11:06 PM
It's useful for reusing a shader with a model that has an attribute that is constant. With glVertexAttrib(), you don't need to write another shader for that case, if you already have one written for the varying attribute case.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.