您好,谁能帮我解决这行代码?我一直面临这个对象未设置为实例错误,我也被来自stackoverflow的人提供了这个方法来尝试。非常感谢!
string shader = @"#version 120
#version 150 compatibility
uniform sampler2D tex;
void main()
{
vec4 pixcol = texture2D(tex, gl_TexCoord[0].xy);
vec4 colors[3];
colors[0] = vec4(0.,0.,1.,1.);
colors[1] = vec4(1.,1.,0.,1.);
colors[2] = vec4(1.,0.,0.,1.);
float lum = (pixcol.r+pixcol.g+pixcol.b)/3.;
int ix = (lum < 0.5)? 0:1;
vec4 thermal = mix(colors[ix],colors[ix+1],(lum-float(ix)*0.5)/0.5);
gl_FragColor = thermal;
}";
GL.ShaderSource(m_shader_handle, shader);