PropertyBuffer CreateIndexBuffer()
{
- unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ const unsigned int numberElements = sizeof(indexData)/sizeof(indexData[0]) ;
+
Property::Map indexFormat;
indexFormat["indices"] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, 3 );
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat, numberElements );
indices.SetData(indexData);
return indices;
tet_infoline("Test SetGeometryType and GetGeometryType: with index buffer");
unsigned int numVertex = 4u;
- unsigned int numIndex = 3u; // 6 unsigned short
+ unsigned int numIndex = 6u; // 6 unsigned short
PropertyBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
PropertyBuffer indexBuffer = CreateIndexBuffer( );
DALI_ASSERT_DEBUG( mSize && "No data in the property buffer!" );
const void *data = &((*mData)[0]);
+ std::size_t dataSize = GetDataSize();
// Index buffer needs to be unsigned short which is not supported by the property system
Vector<unsigned short> ushortData;
ushortData[i] = unsignedData[i];
}
data = &(ushortData[0]);
+ dataSize = ushortData.Size() * sizeof( unsigned short );
}
GpuBuffer::Target target = GpuBuffer::ARRAY_BUFFER;
{
target = GpuBuffer::ELEMENT_ARRAY_BUFFER;
}
-
- mGpuBuffer->UpdateDataBuffer( GetDataSize(), data, GpuBuffer::STATIC_DRAW, target );
+ mGpuBuffer->UpdateDataBuffer( dataSize, data, GpuBuffer::STATIC_DRAW, target );
}