From 06e8bf08b58a97f6304487652100a955f6426745 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Thu, 16 Feb 2012 14:29:47 -0800 Subject: [PATCH] Use larger texture mask This prevents rendering artifacts (black lines) on Mac OS and possibly Win32 near the edges of masked textures. --- src/objects/grits-tile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c index 61ed022..2b89aea 100644 --- a/src/objects/grits-tile.c +++ b/src/objects/grits-tile.c @@ -34,6 +34,7 @@ #include #include +#include #include "gtkgl.h" #include "grits-tile.h" @@ -352,13 +353,15 @@ 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); -- 2.43.2