45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
/***********************************************************************************************************************
|
|
*
|
|
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
|
|
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
|
|
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
|
|
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
|
|
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
|
|
* scope and manner of such use.
|
|
*
|
|
***********************************************************************************************************************/
|
|
|
|
#include "ebo.h"
|
|
|
|
EBO::EBO(const array_of_indices& indices)
|
|
{
|
|
glGenBuffers(1, &id);
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
|
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLuint), indices.data(), GL_STATIC_DRAW);
|
|
}
|
|
EBO::EBO(const std::vector<array_of_indices>& array_of_indices)
|
|
{
|
|
std::size_t start = 0;
|
|
for (const auto& indices : array_of_indices)
|
|
{
|
|
glGenBuffers(1, &id);
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
|
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLuint), indices.data(), GL_STATIC_DRAW);
|
|
start += indices.size() * sizeof(GLuint);
|
|
}
|
|
}
|
|
|
|
void EBO::Bind()
|
|
{
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id);
|
|
}
|
|
|
|
void EBO::Unbind()
|
|
{
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
}
|
|
|
|
void EBO::Delete()
|
|
{
|
|
glDeleteBuffers(1, &id);
|
|
} |