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

Small bug correction in DataPerFaceRender.

parent a30b1e96
...@@ -59,7 +59,7 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen ...@@ -59,7 +59,7 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen
std::vector<VEC3> buffer; std::vector<VEC3> buffer;
buffer.reserve(16384); buffer.reserve(16384);
std::vector<VEC3> bufferData; std::vector<T> bufferData;
bufferData.reserve(16384); bufferData.reserve(16384);
TraversorCell<typename PFP::MAP, FACE> traFace(map, good); TraversorCell<typename PFP::MAP, FACE> traFace(map, good);
...@@ -91,10 +91,11 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen ...@@ -91,10 +91,11 @@ DataPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboData, typen
memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3)); memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
vboPosition.releasePtr(); 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()); vboData.allocate(bufferData.size());
VEC3* ptrCol = reinterpret_cast<VEC3*>(vboData.lockPtr()); T* ptrData = reinterpret_cast<T*>(vboData.lockPtr());
memcpy(ptrCol,&bufferData[0],bufferData.size()*sizeof(VEC3)); memcpy(ptrData,&bufferData[0],bufferData.size()*sizeof(T));
vboData.releasePtr(); vboData.releasePtr();
} }
...@@ -105,9 +106,6 @@ inline void DataPerFaceRender::draw(Utils::GLSLShader* sh) ...@@ -105,9 +106,6 @@ inline void DataPerFaceRender::draw(Utils::GLSLShader* sh)
sh->disableVertexAttribs(); sh->disableVertexAttribs();
} }
}//end namespace VBO }//end namespace VBO
}//end namespace Algo }//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