Skip to content

Commit

Permalink
failed to build under linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacey committed Apr 6, 2024
1 parent 5093085 commit 10c9bb0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/ngl/BufferTextures.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
/// @brief BufferTexture storage class
#include "Types.h"
#include <string>
#include <unordered_map>

namespace ngl
{
Expand Down Expand Up @@ -72,8 +73,8 @@ struct BufferTexture
class BufferTextures
{
public:
static size_t numBuffers() noexcept;

static size_t numBuffers() noexcept;
static void clear() noexcept;
private:
static std::unordered_map< std::string, BufferTexture > s_texturebuffers;
};
Expand Down
11 changes: 10 additions & 1 deletion src/BufferTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@ size_t BufferTextures::numBuffers() noexcept
return s_texturebuffers.size();
}

}
void BufferTextures::clear() noexcept
{
for(auto &t : s_texturebuffers)
{
glDeleteBuffers(1, &t.second.id);
}
s_texturebuffers.clear();
}

}// end namespace ngl
6 changes: 6 additions & 0 deletions tests/BufferTextureTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

TEST(BufferTextures,construct)
{
ngl::BufferTextures::clear();
EXPECT_EQ(ngl::BufferTextures::numBuffers(),0);
}

TEST(BufferTextures,add)
{
ngl::BufferTextures::clear();

}

0 comments on commit 10c9bb0

Please sign in to comment.