[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11397] branches/soc-2007-maike/source/ blender/src: GLSL Branch
Brecht Van Lommel
brechtvanlommel at pandora.be
Sat Jul 28 06:22:24 CEST 2007
Revision: 11397
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11397
Author: blendix
Date: 2007-07-28 06:22:24 +0200 (Sat, 28 Jul 2007)
Log Message:
-----------
GLSL Branch
===========
- Bugfix to make colorband textures work.
- Move code print so the code is not printed after freeing.
- Move material free so the material is not used after freeing.
- Add include to define M_PI on windows.
Modified Paths:
--------------
branches/soc-2007-maike/source/blender/src/glsl_colorband.c
branches/soc-2007-maike/source/blender/src/glsl_drawobject.c
branches/soc-2007-maike/source/blender/src/glsl_material.c
branches/soc-2007-maike/source/blender/src/glsl_node_util.c
branches/soc-2007-maike/source/blender/src/glsl_uniforms.c
Modified: branches/soc-2007-maike/source/blender/src/glsl_colorband.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_colorband.c 2007-07-27 21:54:01 UTC (rev 11396)
+++ branches/soc-2007-maike/source/blender/src/glsl_colorband.c 2007-07-28 04:22:24 UTC (rev 11397)
@@ -60,8 +60,9 @@
glGenTextures(1, &colorband->texid);
glActiveTexture(GL_TEXTURE0 + type);
glBindTexture(GL_TEXTURE_1D, colorband->texid);
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, COLORBAND_WIDTH, 0, GL_RGBA, GL_UNSIGNED_BYTE, colorband->tex);
- glEnable(GL_TEXTURE_1D);
+ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, COLORBAND_WIDTH, 0, GL_RGBA, GL_FLOAT, colorband->tex);
colorband->tex_set = 1;
glActiveTexture(GL_TEXTURE0);
}
Modified: branches/soc-2007-maike/source/blender/src/glsl_drawobject.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_drawobject.c 2007-07-27 21:54:01 UTC (rev 11396)
+++ branches/soc-2007-maike/source/blender/src/glsl_drawobject.c 2007-07-28 04:22:24 UTC (rev 11397)
@@ -429,11 +429,15 @@
}
dm->release(dm);
- glPopMatrix();
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_1D);
+ glPopMatrix();
+
+ // TODO: disable the right number of texture units depending on material
+ for(i=2; i>=0; i--) {
+ glActiveTexture(GL_TEXTURE0 + i);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_1D);
+ }
glUseProgram(0);
-
}
Modified: branches/soc-2007-maike/source/blender/src/glsl_material.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_material.c 2007-07-27 21:54:01 UTC (rev 11396)
+++ branches/soc-2007-maike/source/blender/src/glsl_material.c 2007-07-28 04:22:24 UTC (rev 11397)
@@ -170,11 +170,6 @@
{
int i;
- if(material){
- BLI_ghash_free(material->parent, NULL, NULL);
- MEM_freeN(material);
- }
-
if(material->diff_ramp)
material->diff_ramp->free(material->diff_ramp);
if(material->spec_ramp)
@@ -184,6 +179,11 @@
material->del_tex(material, i);
}
+ if(material){
+ BLI_ghash_free(material->parent, NULL, NULL);
+ MEM_freeN(material);
+ }
+
printf("\n GLSL Material removed.\n");
}
Modified: branches/soc-2007-maike/source/blender/src/glsl_node_util.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_node_util.c 2007-07-27 21:54:01 UTC (rev 11396)
+++ branches/soc-2007-maike/source/blender/src/glsl_node_util.c 2007-07-28 04:22:24 UTC (rev 11397)
@@ -134,9 +134,9 @@
GFREE, program_node->node_code,
GFREE, program_node->main_code);
+ printf("\n Code:\n%s\n", code);
+
shader = glsl_create_GLshader(code, GL_FRAGMENT_SHADER, 1);
-
- printf("\n Code:\n%s\n", code);
MEM_freeN(program_node);
Modified: branches/soc-2007-maike/source/blender/src/glsl_uniforms.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_uniforms.c 2007-07-27 21:54:01 UTC (rev 11396)
+++ branches/soc-2007-maike/source/blender/src/glsl_uniforms.c 2007-07-28 04:22:24 UTC (rev 11397)
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_arithb.h"
#include "BLI_ghash.h"
#include "butspace.h"
More information about the Bf-blender-cvs
mailing list