Skip to content

Commit

Permalink
Removed unused fillInterleavedBuffer()
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Oct 26, 2023
1 parent 1287b8b commit 8018ffb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
56 changes: 0 additions & 56 deletions src/glview/VertexArray.cc
Expand Up @@ -11,27 +11,6 @@

void addAttributeValues(IAttributeData&) {}

void VertexData::fillInterleavedBuffer(GLbyte *interleaved_buffer) const
{
// All attribute vectors need to be the same size to interleave
if (attributes_.size()) {
size_t last_size = attributes_[0]->size() / attributes_[0]->count();

GLbyte *dst_start = interleaved_buffer;
for (const auto& data : attributes_) {
size_t size = data->sizeofAttribute();
GLbyte *dst = dst_start;
const GLbyte *src = data->toBytes();
for (size_t i = 0; i < last_size; ++i) {
std::memcpy((void *)dst, (void *)src, size);
src += size;
dst += stride_;
}
dst_start += size;
}
}
}

void VertexData::getLastVertex(std::vector<GLbyte>& interleaved_buffer) const
{
GLbyte *dst_start = interleaved_buffer.data();
Expand All @@ -51,27 +30,6 @@ void VertexData::remove(size_t count)
}
}

// void VertexData::createInterleavedVBO(GLuint& vbo) const
// {
// size_t total_bytes = this->sizeInBytes();
// if (total_bytes) {
// std::vector<GLbyte> interleaved_buffer;
// interleaved_buffer.resize(total_bytes);
// fillInterleavedBuffer(interleaved_buffer.data());

// if (vbo == 0) {
// glGenBuffers(1, &vbo);
// }

// GL_TRACE("glBindBuffer(GL_ARRAY_BUFFER, %d)", vbo);
// GL_CHECKD(glBindBuffer(GL_ARRAY_BUFFER, vbo));
// GL_TRACE("glBufferData(GL_ARRAY_BUFFER, %d, %p, GL_STATIC_DRAW)", total_bytes % (void *)interleaved_buffer.data());
// GL_CHECKD(glBufferData(GL_ARRAY_BUFFER, total_bytes, interleaved_buffer.data(), GL_STATIC_DRAW));
// GL_TRACE0("glBindBuffer(GL_ARRAY_BUFFER, 0)");
// GL_CHECKD(glBindBuffer(GL_ARRAY_BUFFER, 0));
// }
// }

void VertexData::append(const VertexData& data) {
size_t i = 0;
for (auto& a : attributes_) {
Expand Down Expand Up @@ -216,20 +174,6 @@ void VertexArray::createVertex(const std::array<Vector3d, 3>& points,
}
}

void VertexArray::fillInterleavedBuffer(std::vector<GLbyte>& interleaved_buffer) const
{
size_t total_bytes = this->sizeInBytes();
if (total_bytes) {
interleaved_buffer.resize(total_bytes);
GLbyte *dst = interleaved_buffer.data();

for (const auto& data : vertices_) {
data->fillInterleavedBuffer(dst);
dst += data->sizeInBytes();
}
}
}

void VertexArray::createInterleavedVBOs()
{
for (const auto& state : states_) {
Expand Down
5 changes: 0 additions & 5 deletions src/glview/VertexArray.h
Expand Up @@ -213,8 +213,6 @@ class VertexData

void allocateBuffers(size_t num_vertices);

// Create an interleaved buffer and return it as GLbyte array pointer
void fillInterleavedBuffer(GLbyte *interleaved_buffer) const;
// Get the last interleaved vertex
void getLastVertex(std::vector<GLbyte>& interleaved_buffer) const;
// Create an interleaved buffer in the provided vbo.
Expand Down Expand Up @@ -332,9 +330,6 @@ class VertexArray

void allocateBuffers(size_t num_vertices);

// Create an interleaved buffer and return it as GLbyte array pointer
void fillInterleavedBuffer(std::vector<GLbyte>& interleaved_buffer) const;

// Create an interleaved VBO from the VertexData in the array.
void createInterleavedVBOs();

Expand Down

0 comments on commit 8018ffb

Please sign in to comment.