Text renderer up and working, needs more work to be compatible with the ResourceManager and the Entity Component system

This commit is contained in:
viktorljung
2015-12-11 16:12:29 +01:00
parent 8f007f6daf
commit a8a38716bd
8 changed files with 239 additions and 2 deletions
+28
View File
@@ -4,12 +4,40 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include "OpenGL.h"
#include "GLM.h"
#include "ShaderProgram.h"
class TextRenderer
{
public:
TextRenderer();
void Initialize();
void Update();
void Draw(glm::mat4 projection, glm::mat4 view);
private:
struct Character {
GLuint TextureID; // ID handle of the glyph texture
glm::ivec2 Size; // Size of glyph
glm::ivec2 Bearing; // Offset from baseline to left/top of glyph
GLuint Advance; // Offset to advance to next glyph
};
std::map<GLchar, Character> Characters;
GLuint VAO, VBO;
void RenderText(std::string text, GLfloat x, GLfloat y, GLfloat scale, glm::vec3 color, glm::mat4 projection, glm::mat4 view);
ShaderProgram m_TextProgram;
std::string text = "";
int counter = 0;
};