Skip to content

Commit

Permalink
remove stale render_text
Browse files Browse the repository at this point in the history
  • Loading branch information
Sian Cao committed May 7, 2014
1 parent a72d30d commit d42f9b2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
37 changes: 0 additions & 37 deletions atlas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,6 @@ void TextMode::render_str(std::string s, float x, float y, float sx, float sy)
glDrawArrays(GL_TRIANGLES, 0, len * 6);
}

void TextMode::render_text(const char *text, float x, float y, float sx, float sy)
{
int len = strlen(text);

struct point_t {
GLfloat x, y, s, t;
} points[6 * len];

for (int i = 0; i < len; ++i) {
int c = text[i];
GLfloat x0 = x + _atlas.infos[c].left * sx;
GLfloat y0 = y + _atlas.infos[c].top * sy;
GLfloat w = _atlas.infos[c].width * sx, h = _atlas.infos[c].height * sy;

float tw = _atlas.infos[c].width / _atlas.width;
float tx = _atlas.infos[c].offset / _atlas.width;
float ty = _atlas.infos[c].height / _atlas.height;

int p = i * 6;
points[p++] = {x0, y0, tx, 0,};
points[p++] = {x0 + w, y0, tx + tw, 0,};
points[p++] = {x0, y0 - h, tx, ty,};

points[p++] = {x0, y0 - h, tx, ty,};
points[p++] = {x0 + w, y0, tx + tw, 0,};
points[p++] = {x0 + w, y0 - h, tx + tw, ty,};

x += _atlas.infos[c].ax * sx;
y += _atlas.infos[c].ay * sy;
}

glBindBuffer(GL_ARRAY_BUFFER, _proc.vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof points, points, GL_DYNAMIC_DRAW);
glDrawArrays(GL_TRIANGLES, 0, len * 6);

}

static timeval tv_start = {0, 0};

bool TextMode::init(int width, int height)
Expand Down
1 change: 0 additions & 1 deletion atlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class TextMode: public ActionMode {
private:
atlas_t _atlas;
void create_atlas(FT_Face face, int pointSize, std::string preloads);
void render_text(const char *text, float x, float y, float sx, float sy);
void render_str(std::string s, float x, float y, float sx, float sy);
bool load_char_helper(FT_ULong char_code);
};
Expand Down

0 comments on commit d42f9b2

Please sign in to comment.