summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fontwrapper-ft.cc
diff options
context:
space:
mode:
authorEnne Walker <enne.walker@gmail.com>2010-05-14 12:16:19 -0400
committerEnne Walker <enne.walker@gmail.com>2010-05-14 18:18:54 -0400
commit6375f13e84238370564a57711c19cffaf3b3009d (patch)
treeca2f6503f925b04d5946b9c38ba2d2f90446b8ad /crawl-ref/source/fontwrapper-ft.cc
parenta7c8d89bd1ae36e219795d8cefb8333bc068bbfc (diff)
downloadcrawl-ref-6375f13e84238370564a57711c19cffaf3b3009d.tar.gz
crawl-ref-6375f13e84238370564a57711c19cffaf3b3009d.zip
Expose GL state to draw call API.
This avoids weird global state setting and then querying in the next function.
Diffstat (limited to 'crawl-ref/source/fontwrapper-ft.cc')
-rw-r--r--crawl-ref/source/fontwrapper-ft.cc19
1 files changed, 6 insertions, 13 deletions
diff --git a/crawl-ref/source/fontwrapper-ft.cc b/crawl-ref/source/fontwrapper-ft.cc
index d31277e95e..3f3c25e802 100644
--- a/crawl-ref/source/fontwrapper-ft.cc
+++ b/crawl-ref/source/fontwrapper-ft.cc
@@ -312,12 +312,13 @@ void FTFontWrapper::render_textblock(unsigned int x_pos, unsigned int y_pos,
if (!m_buf->size())
return;
+ glmanager->reset_transform();
+
GLState state;
state.array_vertex = true;
state.array_texcoord = true;
state.blend = true;
state.texture = true;
- glmanager->set(state);
m_tex.bind();
// Defaults to GLW_QUADS
@@ -328,12 +329,8 @@ void FTFontWrapper::render_textblock(unsigned int x_pos, unsigned int y_pos,
GLW_3VF color(0.0f, 0.0f, 0.0f);
glmanager->set_current_color(color);
- trans.x++;
- trans.y++;
- glmanager->set_transform(&trans);
- m_buf->draw();
- trans.x--;
- trans.y--;
+ GLW_3VF trans_shadow(trans.x + 1, trans.y + 1, 0.0f);
+ m_buf->draw(state, &trans_shadow);
color.set(1.0f, 1.0f, 1.0f);
glmanager->set_current_color(color);
@@ -342,9 +339,7 @@ void FTFontWrapper::render_textblock(unsigned int x_pos, unsigned int y_pos,
// TODO: Review this to see if turning array color on and off
// here is really necessary ...
state.array_colour = true;
- glmanager->set(state);
- glmanager->set_transform(&trans);
- m_buf->draw();
+ m_buf->draw(state, &trans);
}
static void _draw_box(int x_pos, int y_pos, float width, float height,
@@ -370,9 +365,7 @@ static void _draw_box(int x_pos, int y_pos, float width, float height,
state.array_vertex = true;
state.array_colour = true;
state.blend = true;
- glmanager->set(state);
-
- buf->draw();
+ buf->draw(state);
}
unsigned int FTFontWrapper::string_height(const formatted_string &str) const