我是 OpenGL ES 编程的新手,我正在尝试调试我的着色器编程,我想知道是否有任何方法可以记录特定变量的值。比如下面的vertex shader程序中,我想测试一下normal返回的值,基本上就是在找类似NSLog的东西……
attribute vec4 position;
attribute vec3 normal;
attribute vec2 texture;
varying vec2 v_texCoord;
varying float LightIntensity;
uniform mat4 modelViewProjectionMatrix;
uniform mat3 normalMatrix;
void main()
{
vec3 eyeNormal = normalize(normalMatrix * normal);
vec3 lightPosition = vec3(-1.0, 0.0, 3.0);
float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition)));
LightIntensity = nDotVP;
v_texCoord = texture;
gl_Position = modelViewProjectionMatrix * position;
}