sampler3d

edited June 2016 in GLSL / Shaders

Hi, i try to port a processing 1.5.1 sketch

it used sampler3d with lowlevel gl

in processing 3 i can t figure how to do that:

i use this shader :

#version 410
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif

#define PROCESSING_TEXTURE_SHADER

uniform sampler2D lut;
uniform sampler3D volume;


uniform vec2 texOffset;
in vec4 vertColor;
in vec4 vertTexCoord;
uniform float z;
out vec4 lutColor;
void main() {

    float texColor = texture(volume, vec3(0.5,0.5,0.5)).r; // error here
 // float texColor = texture(lut, vec2(0.5,0.5)).r;
     lutColor = texture(lut, vec2(texColor,z)).rgba;

}

it works well until i use the sampler i got an enigmatic:' cannot validate shader program: unknow error'

2 questions: if someone have an idea why it fails (accept the syntax sampler3d but fail (validation) when sampler3d is used in main() at firt shader call )

and how to link this texture to the shader (it return -1 for shaderimgloc[0] = gl.glGetUniformLocation(myShader.glProgram, "volume");)

thanks a lot

Answers

Sign In or Register to comment.