[grits] Use larger texture mask
- From: Andy Spencer <andys src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grits] Use larger texture mask
- Date: Thu, 16 Feb 2012 23:19:45 +0000 (UTC)
commit 06e8bf08b58a97f6304487652100a955f6426745
Author: Andy Spencer <andy753421 gmail com>
Date: Thu Feb 16 14:29:47 2012 -0800
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 files 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 <config.h>
#include <math.h>
+#include <string.h>
#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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]