//! (ctor) VertexAttribute::VertexAttribute(uint16_t _offset,uint8_t _numValues, uint32_t _dataType, Util::StringIdentifier _nameId,std::string _name, bool _normalize) : offset(_offset),dataSize(getGLTypeSize(_dataType)*_numValues), numValues(_numValues), dataType(_dataType), nameId(std::move(_nameId)),name(std::move(_name)), normalize(_normalize) { if((dataSize % 4) != 0) { WARN("VertexAttribute is not 4-byte aligned."); } }
void glhud_renderDefault(GLModel *parent) { // Bind our vertex array object #if USE_VAO glBindVertexArray(parent->vaoName); #else glBindBuffer(GL_ARRAY_BUFFER, parent->posBufferName); GLsizei posTypeSize = getGLTypeSize(parent->positionType); GLsizei texcoordTypeSize = getGLTypeSize(parent->texcoordType); // Set up parmeters for position attribute in the VAO including, size, type, stride, and offset in the currenly // bound VAO This also attaches the position VBO to the VAO glVertexAttribPointer(POS_ATTRIB_IDX, // What attibute index will this array feed in the vertex shader (see buildProgram) parent->positionSize, // How many elements are there per position? parent->positionType, // What is the type of this data? GL_FALSE, // Do we want to normalize this data (0-1 range for fixed-pont types) parent->positionSize*posTypeSize, // What is the stride (i.e. bytes between positions)? 0); // What is the offset in the VBO to the position data? glEnableVertexAttribArray(POS_ATTRIB_IDX); // Set up parmeters for texcoord attribute in the VAO including, size, type, stride, and offset in the currenly // bound VAO This also attaches the texcoord VBO to VAO glBindBuffer(GL_ARRAY_BUFFER, parent->texcoordBufferName); glVertexAttribPointer(TEXCOORD_ATTRIB_IDX, // What attibute index will this array feed in the vertex shader (see buildProgram) parent->texcoordSize, // How many elements are there per texture coord? parent->texcoordType, // What is the type of this data in the array? GL_TRUE, // Do we want to normalize this data (0-1 range for fixed-point types) parent->texcoordSize*texcoordTypeSize, // What is the stride (i.e. bytes between texcoords)? 0); // What is the offset in the VBO to the texcoord data? glEnableVertexAttribArray(TEXCOORD_ATTRIB_IDX); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, parent->elementBufferName); #endif // Draw the object _HACKAROUND_GLDRAW_PRE(); glDrawElements(parent->primType, parent->numElements, parent->elementType, 0); GL_ERRLOG("glhudparent render"); }