[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30105] branches/soc-2010-jwilkins/source/ blender/editors/sculpt_paint/paint_stroke.c: * overlay is calculated as a set of GLubytes instead of floats so it takes up less memory while being calculated (also moving towards maybe unifying the texcache and overlay)
Jason Wilkins
Jason.A.Wilkins at gmail.com
Thu Jul 8 11:06:49 CEST 2010
Revision: 30105
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30105
Author: jwilkins
Date: 2010-07-08 11:06:49 +0200 (Thu, 08 Jul 2010)
Log Message:
-----------
* overlay is calculated as a set of GLubytes instead of floats so it takes up less memory while being calculated (also moving towards maybe unifying the texcache and overlay)
Modified Paths:
--------------
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c 2010-07-08 08:26:10 UTC (rev 30104)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c 2010-07-08 09:06:49 UTC (rev 30105)
@@ -241,8 +241,8 @@
static int changed_timestamp = -1;
static Snapshot snap;
- float* buffer = 0;
- float* p;
+ GLubyte* buffer = 0;
+ GLubyte* p;
int width, height;
float x, y;
@@ -266,7 +266,7 @@
width = height = 512;
- p = buffer = MEM_mallocN(2*sizeof(float)*width*height, "load_tex");
+ p = buffer = MEM_mallocN(2*sizeof(unsigned char)*width*height, "load_tex");
xlim = brush->size / (float)vc->ar->winx * width;
ylim = brush->size / (float)vc->ar->winy * height;
@@ -305,7 +305,7 @@
x += brush->mtex.ofs[0];
y += brush->mtex.ofs[1];
- *p = *(p+1) = get_tex_pixel(brush, x, y);
+ *p = *(p+1) = (GLubyte)(get_tex_pixel(brush, x, y) * 255);
p += 2;
}
@@ -319,11 +319,11 @@
if (refresh) {
if (!init) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width, height, 0, GL_LUMINANCE_ALPHA, GL_FLOAT, buffer);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, buffer);
init = 1;
}
else {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_LUMINANCE_ALPHA, GL_FLOAT, buffer);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, buffer);
}
if (buffer)
More information about the Bf-blender-cvs
mailing list