font fixed..

master
steffen 13 years ago
parent 56379bb493
commit 8cc646d18e

@ -121,8 +121,8 @@ void font_draw (struct font *f, char *text, float x, float y, float sx, float sy
glVertexAttribPointer (engine.gles_txcoord, 2, GL_FLOAT, GL_FALSE, 0, vt); glVertexAttribPointer (engine.gles_txcoord, 2, GL_FLOAT, GL_FALSE, 0, vt);
glDrawArrays(GL_TRIANGLE_FAN,0,4); glDrawArrays(GL_TRIANGLE_FAN,0,4);
glVertexAttribPointer (engine.gles_pos, 3, GL_FLOAT, GL_FALSE, 0, vp); // glVertexAttribPointer (engine.gles_pos, 3, GL_FLOAT, GL_FALSE, 0, vp);
glDrawArrays(GL_LINES,0,2); // glDrawArrays(GL_LINES,0,2);
/* Advance the cursor to the start of the next character */ /* Advance the cursor to the start of the next character */

@ -104,7 +104,7 @@ void font_draw (struct font *f, char *text, float x, float y, float sx, float sy
/* Upload the "bitmap", which contains an 8-bit grayscale image, as an alpha texture */ /* Upload the "bitmap", which contains an 8-bit grayscale image, as an alpha texture */
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, g->bitmap.width, g->bitmap.rows, 0, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap.buffer); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, g->bitmap.width, g->bitmap.rows, 0, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap.buffer);
/* Calculate the vertex and texture coordinates */ /* Calculate the vertex and texture coordinates */
// d_printf ("x: %f advance:%d %d", x, g->advance.x, g->advance.x >> 6); // d_printf ("char:%c bitmap.rows:%d bitmap_top:%d", *p, g->bitmap.rows, g->bitmap_top);
vp[0] = x; vp[1] = y + g->bitmap.rows - g->bitmap_top; vp[0] = x; vp[1] = y + g->bitmap.rows - g->bitmap_top;
vp[2] = x + g->bitmap.width; vp[3] = y + g->bitmap.rows - g->bitmap_top; vp[2] = x + g->bitmap.width; vp[3] = y + g->bitmap.rows - g->bitmap_top;
@ -116,11 +116,10 @@ void font_draw (struct font *f, char *text, float x, float y, float sx, float sy
glDrawArrays(GL_TRIANGLE_FAN,0,4); glDrawArrays(GL_TRIANGLE_FAN,0,4);
// glEnableClientState(GL_VERTEX_ARRAY); // glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vp); // glVertexPointer(2, GL_FLOAT, 0, vp);
glDrawArrays(GL_LINES,0,2); // glDrawArrays(GL_LINES,0,2);
// glDisableClientState(GL_VERTEX_ARRAY); // glDisableClientState(GL_VERTEX_ARRAY);
/* Advance the cursor to the start of the next character */ /* Advance the cursor to the start of the next character */
// x += (g->advance.x >> 6); // x += (g->advance.x >> 6);
// y -= (g->advance.y >> 6); // y -= (g->advance.y >> 6);

@ -161,15 +161,6 @@ void gfx_draw_polygon (struct image *dimg, iPoint *p, int pcnt, struct line_styl
glVertex2i (p[i].x, p[i].y); glVertex2i (p[i].x, p[i].y);
glEnd (); glEnd ();
if (style.width > 0.0) {
glBegin (GL_LINE_LOOP);
glLineWidth (style.width/2.0);
glColor4f (style.c.c.r, style.c.c.g, style.c.c.b, 1.0f);
for (i = 0; i < pcnt; i++)
glVertex2i (p[i].x, p[i].y);
glEnd ();
}
}; };
@ -179,6 +170,7 @@ void gfx_draw_polygon (struct image *dimg, iPoint *p, int pcnt, struct line_styl
void gfx_draw_text (struct image *dimg, int x, int y, char *text, struct color *c) { void gfx_draw_text (struct image *dimg, int x, int y, char *text, struct color *c) {
gfx_fbo_switch (dimg); gfx_fbo_switch (dimg);
glColor4f (c->c.r, c->c.g, c->c.b, 1.0f); glColor4f (c->c.r, c->c.g, c->c.b, 1.0f);
d_printf ("fint_draw:'%s'", text);
font_draw (font, text, x, y+12.0, 1.0, 1.0); font_draw (font, text, x, y+12.0, 1.0, 1.0);
}; };
@ -297,28 +289,6 @@ void gfx_img_free (struct image *img) {
}; };
/*
void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c) {
d_printf ("rect...");
// int i;
//
// gfx_fbo_switch (dimg);
// glBegin (GL_POLYGON);
// glColor4f (c.c.r, c.c.g, c.c.b, 1.0f);
// for (i = 0; i < pcnt; i++)
// glVertex2i (p[i].x, p[i].y);
// glEnd ();
//
// glBegin (GL_LINES);
// glLineWidth (style.width/2.0);
// glColor4f (style.c.c.r, style.c.c.g, style.c.c.b, 1.0f);
// for (i = 0; i < pcnt; i++)
// glVertex2i (p[i].x, p[i].y);
// glEnd ();
};
*/
#define HEADER_SIZE 8 #define HEADER_SIZE 8
int gfxpng_fd = 0; int gfxpng_fd = 0;
void png_fd_read(png_structp png, png_bytep data, png_size_t size) { void png_fd_read(png_structp png, png_bytep data, png_size_t size) {

Loading…
Cancel
Save