Commit bd689e63 authored by Janis Born's avatar Janis Born
Browse files

ArrayBufferControl can now define integer attributes

parent acd92f84
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
GLenum type; GLenum type;
GLint dimension; GLint dimension;
GLboolean normalized; GLboolean normalized;
GLboolean isInteger;
}; };
// ===================================================================================================== \/ // ===================================================================================================== \/
...@@ -65,7 +66,14 @@ public: ...@@ -65,7 +66,14 @@ public:
inline ArrayBufferControl& attribute (const std::string& _name, GLenum _type, GLint _dimension, GLboolean _normalized = GL_FALSE) 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); mAttributeDefines.push_back(a);
return *this; return *this;
} }
......
...@@ -16,10 +16,20 @@ SharedArrayBuffer ArrayBufferControl::create(void) ...@@ -16,10 +16,20 @@ SharedArrayBuffer ArrayBufferControl::create(void)
for(AttributeDefineVec::size_type i = 0; i < mAttributeDefines.size(); i++) for(AttributeDefineVec::size_type i = 0; i < mAttributeDefines.size(); i++)
{ {
arrayBuffer->defineAttribute( mAttributeDefines[i].name, if(mAttributeDefines[i].isInteger)
mAttributeDefines[i].type, {
mAttributeDefines[i].dimension, arrayBuffer->defineIntegerAttribute(mAttributeDefines[i].name,
mAttributeDefines[i].normalized ); mAttributeDefines[i].type,
mAttributeDefines[i].dimension);
}
else
{
arrayBuffer->defineAttribute(mAttributeDefines[i].name,
mAttributeDefines[i].type,
mAttributeDefines[i].dimension,
mAttributeDefines[i].normalized);
}
} }
if (mpData != NULL) if (mpData != NULL)
{ {
...@@ -28,5 +38,3 @@ SharedArrayBuffer ArrayBufferControl::create(void) ...@@ -28,5 +38,3 @@ SharedArrayBuffer ArrayBufferControl::create(void)
} }
return arrayBuffer; return arrayBuffer;
} }
Supports Markdown
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