Detailed Description
The QGLAttributeDescription class encapsulates information about an OpenGL attribute value's layout and type.
OpenGL has many functions that take a pointer to vertex attribute values: glVertexPointer(), glNormalPointer(), glVertexAttribPointer(), etc. These functions typically take four arguments: tuple size (1, 2, 3, or 4), component type (e.g. GL_FLOAT), stride, and data pointer (glNormalPointer() does not use tuple size, assuming that it is 3). When used with vertex buffers, the data pointer may be an offset into the vertex buffer instead.
QGLAttributeDescription encapsulates the vertex attribute() kind (QGL::Position, QGL::Normal, etc) with the type(), tupleSize(), and stride() information of an attribute. The companion QGLAttributeValue class adds the data pointer.
Member Function Documentation
QGLAttributeDescription::QGLAttributeDescription()
Constructs a null attribute description with default parameters of tupleSize() and stride() set to zero, type() set to GL_FLOAT, and attribute() set to QGL::Position.
See also isNull().
QGLAttributeDescription::QGLAttributeDescription(QGL::VertexAttribute attribute, int tupleSize, GLenum type, int stride)
Constructs an attribute description with the fields attribute, tupleSize, type, and stride.
QGL::VertexAttribute QGLAttributeDescription::attribute() const
Returns the vertex attribute that this description applies to. The default value is QGL::Position.
See also setAttribute() and type().
bool QGLAttributeDescription::isNull() const
Returns true if tupleSize() is zero, which indicates an unset attribute description; false otherwise.
void QGLAttributeDescription::setAttribute(QGL::VertexAttribute attribute)
Sets the vertex attribute that this description applies to.
See also attribute().
void QGLAttributeDescription::setStride(int stride)
Sets the stride in bytes from one vertex element to the next for this attribute description.
See also stride().
void QGLAttributeDescription::setTupleSize(int tupleSize)
Sets the tuple size of this attribute in components to tupleSize.
See also tupleSize().
void QGLAttributeDescription::setType(GLenum type)
Sets the component type for this attribute description.
See also type() and sizeOfType().
int QGLAttributeDescription::sizeOfType() const
Returns the size in bytes of type().
See also type() and tupleSize().
int QGLAttributeDescription::stride() const
Returns the stride in bytes from one vertex element to the next for this attribute description. The default value of 0 indicates that the elements are tightly packed within the data array.
See also setStride().
int QGLAttributeDescription::tupleSize() const
Returns the tuple size of this attribute in components. For example, a return value of 3 indicates a vector of 3-dimensional values. If tupleSize() is zero, then this attribute description is null.
See also setTupleSize(), isNull(), and sizeOfType().
GLenum QGLAttributeDescription::type() const
Returns the component type for this attribute description. The default value is GL_FLOAT.
See also setType(), sizeOfType(), and attribute().