Commit 2f953622 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

Small bug correction in DataPerFaceRender.

parent a30b1e96
......@@ -59,7 +59,7 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen
std::vector<VEC3> buffer;
buffer.reserve(16384);
std::vector<VEC3> bufferData;
std::vector<T> bufferData;
bufferData.reserve(16384);
TraversorCell<typename PFP::MAP, FACE> traFace(map, good);
......@@ -91,10 +91,11 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen
memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
vboPosition.releasePtr();
vboData.setDataSize(3);
assert(sizeof(T) % sizeof(float) == 0 || !"DataPerFaceRender::updateVBO: VBO's only work with data types which are a multiple of 4 bytes") ;
vboData.setDataSize(sizeof(T) / sizeof(float)); // Warning : works only for data types of 4 bytes (as do the VBO's)
vboData.allocate(bufferData.size());
VEC3* ptrCol = reinterpret_cast<VEC3*>(vboData.lockPtr());
memcpy(ptrCol,&bufferData[0],bufferData.size()*sizeof(VEC3));
T* ptrData = reinterpret_cast<T*>(vboData.lockPtr());
memcpy(ptrData,&bufferData[0],bufferData.size()*sizeof(T));
vboData.releasePtr();
}
......@@ -105,9 +106,6 @@ inline void DataPerFaceRender::draw(Utils::GLSLShader* sh)
sh->disableVertexAttribs();
}
}//end namespace VBO
}//end namespace Algo
......
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