Commit bd689e63 authored by Janis Born's avatar Janis Born

ArrayBufferControl can now define integer attributes

parent acd92f84
......@@ -30,6 +30,7 @@ public:
GLenum type;
GLint dimension;
GLboolean normalized;
GLboolean isInteger;
};
// ===================================================================================================== \/
......@@ -65,7 +66,14 @@ public:
inline ArrayBufferControl& attribute (const std::string& _name, GLenum _type, GLint _dimension, GLboolean _normalized = GL_FALSE)
{
AttributeDefine a = {_name, _type, _dimension, _normalized};
AttributeDefine a = {_name, _type, _dimension, _normalized, GL_FALSE};
mAttributeDefines.push_back(a);
return *this;
}
inline ArrayBufferControl& integerAttribute (const std::string& _name, GLenum _type, GLint _dimension)
{
AttributeDefine a = {_name, _type, _dimension, GL_FALSE, GL_TRUE};
mAttributeDefines.push_back(a);
return *this;
}
......
......@@ -16,10 +16,20 @@ SharedArrayBuffer ArrayBufferControl::create(void)
for(AttributeDefineVec::size_type i = 0; i < mAttributeDefines.size(); i++)
{
arrayBuffer->defineAttribute( mAttributeDefines[i].name,
mAttributeDefines[i].type,
mAttributeDefines[i].dimension,
mAttributeDefines[i].normalized );
if(mAttributeDefines[i].isInteger)
{
arrayBuffer->defineIntegerAttribute(mAttributeDefines[i].name,
mAttributeDefines[i].type,
mAttributeDefines[i].dimension);
}
else
{
arrayBuffer->defineAttribute(mAttributeDefines[i].name,
mAttributeDefines[i].type,
mAttributeDefines[i].dimension,
mAttributeDefines[i].normalized);
}
}
if (mpData != NULL)
{
......@@ -28,5 +38,3 @@ SharedArrayBuffer ArrayBufferControl::create(void)
}
return arrayBuffer;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment