Skip to content

Commit

Permalink
Debugging map textures generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 5, 2014
1 parent 868841f commit 16aaad3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/TMXParser
Submodule TMXParser updated 1 files
+0 −1 src/tsx_tileset.cpp
17 changes: 8 additions & 9 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ GLuint Game::FramebufferAux() {
}

if(!FRAMEBUFFER_AUX) {
GLuint fbo[1];
GLuint render_buf[1];
glGenFramebuffers(1, fbo);
glGenRenderbuffers(1, render_buf);
glBindRenderbuffer(GL_RENDERBUFFER, render_buf[0]);
GLuint fbo, render_buf;
glGenFramebuffers(1, &fbo);
glGenRenderbuffers(1, &render_buf);
glBindRenderbuffer(GL_RENDERBUFFER, render_buf);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, WINDOW_WIDTH, WINDOW_HEIGHT);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[0]);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, render_buf[0]);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, render_buf);

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindRenderbuffer(GL_RENDERBUFFER, 0);

RENDERBUFFER_AUX = render_buf[0];
FRAMEBUFFER_AUX = fbo[0];
RENDERBUFFER_AUX = render_buf;
FRAMEBUFFER_AUX = fbo;
}

return FRAMEBUFFER_AUX;
Expand Down
2 changes: 1 addition & 1 deletion src/map/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void Level::Draw() const {
entity->Render();
}

super::RenderLayersAbove();
//super::RenderLayersAbove();

if(Debug::enabled) {
dynamic_collidables_->Render(1, 0, 0);
Expand Down
2 changes: 2 additions & 0 deletions src/map/tile_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,7 @@ GLuint TileMap::GenerateTexture(const std::vector<TMX::TileLayer*>& layers, int
glClear(GL_COLOR_BUFFER_BIT);
RenderLayers(layers, frame);

glBindTexture(GL_TEXTURE_2D, 0);

return texture;
}
2 changes: 2 additions & 0 deletions src/map/tileset.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <SOIL.h>
#include <iostream>
#include <sstream>
#include "tileset.hpp"

Expand Down Expand Up @@ -40,6 +41,7 @@ void Tileset::RenderTiles(int width, int height, const std::vector<std::vector<i
continue;

tile_id += tile->second.animated ? (tile->second.first_frame + frame) % tileset.frames : 0;

int col = tile_id % tileset.width;
int row = tile_id / tileset.width;

Expand Down

0 comments on commit 16aaad3

Please sign in to comment.