The appended GLSL fragment shader is giving me a syntax error using
2ba98efdf6653a4cb885d576d2e6f349c69679d4 . A bit of experimentation
suggests it is the array of colors created. Does Mesa support:
vec4 somearray[] = vec4[] (
vec4(0.0, 0.0, 0.0, 0.0)
);
?
Also, I attached a couple patches covering minor issues. 0001 is
probably wrong; seems like these libs should probably end up in
GL_LIB_DEPS but don't in my configuration (autoconf, osmesa, no
gallium, no egl, mangled).
-tom
Shader that fails with a syntax error:
#version 120
uniform sampler3D texVolume; ///< the data volume
uniform sampler1D texTrans1D; ///< the 1D Transfer function
uniform float fTransScale; ///< scale for 1D Transfer function lookup
uniform float fStepScale; ///< opacity correction quotient
vec4 r3d_lut(float value) {
const float alpha = 0.6;
const float mn = -0.998139;
const float mx = 0.998138;
int i;
vec4 colors[7] = vec4[] (
vec4(0.0, 0.0, 1.0, alpha),
vec4(0.0, 1.0, 0.0, alpha),
vec4(0.0, 1.0, 1.0, alpha),
vec4(1.0, 0.0, 0.0, alpha),
vec4(1.0, 0.0, 1.0, alpha),
vec4(1.0, 1.0, 0.0, alpha),
vec4(1.0, 1.0, 1.0, alpha)
);
const float incr = (mx - mn) / float(colors.length);
float v = mn;
for(i=0; i < 7 && v < value; i++) { v += incr; }
return colors[i];
}
void main(void)
{
/// get volume value
float fVolumVal = texture3D(texVolume, gl_TexCoord[0].xyz).x;
/// apply 1D transfer function
vec4 vTransVal = texture1D(texTrans1D, fVolumVal*fTransScale);
/// apply opacity correction
vTransVal.a = 1.0 - pow(1.0 - vTransVal.a, fStepScale);
// premultiply color with alpha (for front to back)
vTransVal.xyz *= vTransVal.a;
/// write result to fragment color
gl_FragColor = vTransVal;
//gl_FragColor = r3d_lut(fVolumVal);
}
Note that if one comments out the r3d_lut method the shader compiles
successfully.
From dd6911509e09d41c69c393008102ca895a6683cd Mon Sep 17 00:00:00 2001
From: Tom Fogal <[email protected]>
Date: Fri, 17 Jul 2009 20:17:10 -0600
Subject: [PATCH] Fix 'glslcompiler' compilation.
---
src/mesa/drivers/glslcompiler/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mesa/drivers/glslcompiler/Makefile b/src/mesa/drivers/glslcompiler/Makefile
index ffe4e0a..a56d59d 100644
--- a/src/mesa/drivers/glslcompiler/Makefile
+++ b/src/mesa/drivers/glslcompiler/Makefile
@@ -33,7 +33,7 @@ default: $(PROGRAM)
glslcompiler: $(OBJECTS)
- $(CC) $(OBJECTS) $(GL_LIB_DEPS) -o $@
+ $(CC) $(OBJECTS) $(GL_LIB_DEPS) -o $@ -lpthread -lm -ldl
glslcompiler.o: glslcompiler.c
--
1.5.6.5
From 24825c2ebf2f45d8454aead994a668eedb8c19a8 Mon Sep 17 00:00:00 2001
From: Tom Fogal <[email protected]>
Date: Fri, 17 Jul 2009 20:18:28 -0600
Subject: [PATCH] Fix 'glslcompiler' example run.
Command line option is "number", not "numbers".
---
docs/shading.html | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/shading.html b/docs/shading.html
index 77c86be..dfef054 100644
--- a/docs/shading.html
+++ b/docs/shading.html
@@ -213,7 +213,7 @@ Here's an example of using the compiler to compile a vertex shader and
emit GL_ARB_vertex_program-style instructions:
</p>
<pre>
- bin/glslcompiler --debug --numbers --fs progs/glsl/CH06-brick.frag.txt
+ bin/glslcompiler --debug --number --fs progs/glsl/CH06-brick.frag.txt
</pre>
<p>
results in:
--
1.5.6.5
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev