X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fobjects%2Fgrits-tile.c;h=6ea70f88cbf052e38073b8087e3ea300c7f19c79;hb=8594927c0cd07daea95e8b99dc36ffef4f12da8a;hp=e2aeb4542118550037bba1c97a3a0a612eb6aaa8;hpb=957c73ef908b76227135d0c94a4df53ebf582ccd;p=grits diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c index e2aeb45..6ea70f8 100644 --- a/src/objects/grits-tile.c +++ b/src/objects/grits-tile.c @@ -32,12 +32,14 @@ * representing the OpenGL texture to use when drawing the tile. */ +#define GL_GLEXT_PROTOTYPES #include #include +#include #include "gtkgl.h" #include "grits-tile.h" -guint grits_tile_mask = 0; +static guint grits_tile_mask = 0; gchar *grits_tile_path_table[2][2] = { {"00.", "01."}, @@ -347,19 +349,22 @@ void grits_tile_free(GritsTile *root, GritsTileFreeFunc free_func, gpointer user /* Load texture mask so we can draw a texture to just a part of a triangle */ static guint _grits_tile_load_mask(void) { - guint tex; - guint8 byte = 0xff; + guint tex; + const int width = 256, height = 256; + guint8 *bytes = g_malloc(width*height); + memset(bytes, 0xff, width*height); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 1, 1, 0, - GL_ALPHA, GL_UNSIGNED_BYTE, &byte); + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, + GL_ALPHA, GL_UNSIGNED_BYTE, bytes); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + g_free(bytes); return tex; }