formatting
This commit is contained in:
@@ -79,10 +79,12 @@ public:
|
||||
void startRotating();
|
||||
void stopRotating();
|
||||
|
||||
// Toggles
|
||||
// Debug
|
||||
void setDebug(bool value);
|
||||
void toggleDebug();
|
||||
bool getDebug() const;
|
||||
|
||||
// TEMPORARY DEBUG API
|
||||
void toggleRaster();
|
||||
|
||||
public:
|
||||
|
||||
@@ -10,6 +10,7 @@ int main() {
|
||||
map.setLonLatZoom(settings.longitude, settings.latitude, settings.zoom);
|
||||
map.setAngle(settings.angle);
|
||||
map.setDebug(settings.debug);
|
||||
map.toggleRaster();
|
||||
|
||||
// fprintf(stderr, "lon: %f, lat: %f, zoom: %f, angle: %f, debug: %d\n", settings.l)
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define TextureMax 64
|
||||
const int TextureMax = 64;
|
||||
|
||||
using namespace llmr;
|
||||
|
||||
GLuint Texturepool::getTextureID() {
|
||||
if (texture_ids.empty())
|
||||
{
|
||||
if (texture_ids.empty()) {
|
||||
GLuint new_texture_ids[TextureMax];
|
||||
glGenTextures(TextureMax, new_texture_ids);
|
||||
for (uint32_t id = 0; id < TextureMax; id++) {
|
||||
@@ -32,22 +31,27 @@ void Texturepool::removeTextureID(GLuint texture_id) {
|
||||
|
||||
texture_ids.insert(texture_id);
|
||||
|
||||
if (texture_ids.size() > TextureMax)
|
||||
if (texture_ids.size() > TextureMax) {
|
||||
needs_clear = true;
|
||||
}
|
||||
|
||||
if (needs_clear)
|
||||
if (needs_clear) {
|
||||
clearTextureIDs();
|
||||
}
|
||||
}
|
||||
|
||||
void Texturepool::clearTextureIDs() {
|
||||
std::vector<GLuint> ids_to_remove;
|
||||
ids_to_remove.reserve(texture_ids.size());
|
||||
|
||||
for (std::set<GLuint>::iterator id_iterator = texture_ids.begin(); id_iterator != texture_ids.end(); ++id_iterator)
|
||||
for (std::set<GLuint>::iterator id_iterator = texture_ids.begin();
|
||||
id_iterator != texture_ids.end(); ++id_iterator) {
|
||||
ids_to_remove.push_back(*id_iterator);
|
||||
}
|
||||
|
||||
if (!ids_to_remove.empty())
|
||||
if (!ids_to_remove.empty()) {
|
||||
glDeleteTextures((GLsizei)ids_to_remove.size(), &ids_to_remove[0]);
|
||||
}
|
||||
|
||||
texture_ids.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user