Skip to content

Commit

Permalink
move gl1 vertex array fallback to anonymous namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed Aug 14, 2018
1 parent 63759f8 commit a004b8d
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions ENIGMAsystem/SHELL/Graphics_Systems/OpenGL1/GLvertex.cpp
Expand Up @@ -36,29 +36,9 @@ map<int, std::vector<short unsigned int> > indexBufferArrays;
map<int, GLuint> vertexBufferPeers;
map<int, GLuint> indexBufferPeers;

} // anonymous namespace

namespace enigma {

void graphics_delete_vertex_buffer_peer(int buffer) {
if (vbo_is_supported) {
glDeleteBuffers(1, &vertexBufferPeers[buffer]);
vertexBufferPeers.erase(buffer);
} else {
vertexBufferArrays.erase(buffer);
}
}

void graphics_delete_index_buffer_peer(int buffer) {
if (vbo_is_supported) {
glDeleteBuffers(1, &indexBufferPeers[buffer]);
indexBufferPeers.erase(buffer);
} else {
indexBufferArrays.erase(buffer);
}
}

GLvoid* graphics_prepare_buffer_array(const int buffer, const bool isIndex) {
using namespace enigma;

const bool dirty = isIndex ? indexBuffers[buffer]->dirty : vertexBuffers[buffer]->dirty;
if (dirty) {
if (isIndex) {
Expand All @@ -81,6 +61,8 @@ GLvoid* graphics_prepare_buffer_array(const int buffer, const bool isIndex) {
}

void graphics_prepare_buffer_peer(const int buffer, const bool isIndex) {
using namespace enigma;

const bool dirty = isIndex ? indexBuffers[buffer]->dirty : vertexBuffers[buffer]->dirty;
const bool frozen = isIndex ? indexBuffers[buffer]->frozen : vertexBuffers[buffer]->frozen;
const bool dynamic = isIndex ? indexBuffers[buffer]->dynamic : vertexBuffers[buffer]->dynamic;
Expand Down Expand Up @@ -124,6 +106,28 @@ void graphics_prepare_buffer_peer(const int buffer, const bool isIndex) {
}
}

} // anonymous namespace

namespace enigma {

void graphics_delete_vertex_buffer_peer(int buffer) {
if (vbo_is_supported) {
glDeleteBuffers(1, &vertexBufferPeers[buffer]);
vertexBufferPeers.erase(buffer);
} else {
vertexBufferArrays.erase(buffer);
}
}

void graphics_delete_index_buffer_peer(int buffer) {
if (vbo_is_supported) {
glDeleteBuffers(1, &indexBufferPeers[buffer]);
indexBufferPeers.erase(buffer);
} else {
indexBufferArrays.erase(buffer);
}
}

GLvoid* graphics_prepare_buffer(const int buffer, const bool isIndex) {
if (vbo_is_supported) {
graphics_prepare_buffer_peer(buffer, isIndex);
Expand Down

0 comments on commit a004b8d

Please sign in to comment.