diff --git a/engine/gf_draw_common.c b/engine/gf_draw_common.c index 35a0d94..ede351d 100644 --- a/engine/gf_draw_common.c +++ b/engine/gf_draw_common.c @@ -77,10 +77,25 @@ void gf_draw_reshape(gf_draw_t* draw) { gf_draw_driver_reshape(draw); } /* Runs every frame */ void gf_draw_frame(gf_draw_t* draw) { gf_color_t color; + float z = 16; color.r = color.g = color.b = color.a = 255; if(draw->draw_3d) { } - gf_graphic_draw_texture_polygon(draw, test_texture, color, 3, 4, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, 1.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, -1.0); + gf_graphic_draw_texture_polygon(draw, test_texture, color, GF_GRAPHIC_3D, 4, + /* clang-format off */ + 0.0, 0.0, + -1.0, 0.0, -1.0, + + 0.0, 1.0 * z, + -1.0, 0.0, 1.0, + + 1.0 * z, 1.0 * z, + 1.0, 0.0, 1.0, + + 1.0 * z, 0.0, + 1.0, 0.0, -1.0 + /* clang-format on */ + ); if(draw->draw != NULL) draw->draw(draw); } diff --git a/engine/gf_graphic_common.c b/engine/gf_graphic_common.c index c9b7613..add4d74 100644 --- a/engine/gf_graphic_common.c +++ b/engine/gf_graphic_common.c @@ -25,4 +25,4 @@ void gf_graphic_text(gf_draw_t* draw, float x, float y, float size, const char* float gf_graphic_text_width(gf_draw_t* draw, float size, const char* text) { return (float)strlen(text) * (size * GF_GRAPHIC_FONT_ASPECT_X / GF_GRAPHIC_FONT_ASPECT_Y); } -void gf_graphic_draw_texture_2d(gf_draw_t* draw, float x, float y, float w, float h, gf_texture_t* texture, gf_color_t color) { gf_graphic_draw_texture_polygon(draw, texture, color, 2, 4, 0.0, 0.0, x, y, 0.0, 1.0, x, y + h, 1.0, 1.0, x + w, y + h, 1.0, 0.0, x + w, y); } +void gf_graphic_draw_texture_2d(gf_draw_t* draw, float x, float y, float w, float h, gf_texture_t* texture, gf_color_t color) { gf_graphic_draw_texture_polygon(draw, texture, color, GF_GRAPHIC_2D, 4, 0.0, 0.0, x, y, 0.0, 1.0, x, y + h, 1.0, 1.0, x + w, y + h, 1.0, 0.0, x + w, y); } diff --git a/engine/graphic/opengl/gf_driver.c b/engine/graphic/opengl/gf_driver.c index a7758ef..2971484 100644 --- a/engine/graphic/opengl/gf_driver.c +++ b/engine/graphic/opengl/gf_driver.c @@ -55,8 +55,10 @@ gf_draw_driver_texture_t* gf_draw_driver_register_texture(gf_draw_t* draw, int w glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, d); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +#if 0 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); +#endif glBindTexture(GL_TEXTURE_2D, 0); return r; diff --git a/engine/include/gf_graphic.h b/engine/include/gf_graphic.h index b240036..7f8f7be 100644 --- a/engine/include/gf_graphic.h +++ b/engine/include/gf_graphic.h @@ -23,6 +23,9 @@ #define GF_GRAPHIC_FONT_ASPECT_X 1 #define GF_GRAPHIC_FONT_ASPECT_Y 2 +#define GF_GRAPHIC_2D 2 +#define GF_GRAPHIC_3D 3 + #define GF_SET_COLOR(color, red, green, blue, alpha) \ color.r = (red); \ color.g = (green); \