Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gl_Color is undeclared identifier on WebGL

I am looking at http://www.swiftless.com/tutorials/glsl/3_glcolor.html which has the following code snippet:

void main() {
// Set the output color of our current pixel
gl_FragColor = gl_Color;}

I tried to use gl_Color on my WebGL. I got an error that gl_Color is undeclared identifier.

What did I do wrong?

Thanks in advance for your help.

like image 826
pion Avatar asked Dec 17 '10 06:12

pion


1 Answers

WebGL uses Open GL ES 2.0 as its base, therefore you should be using GLSL ES 1.0 for the shaders. GLSL ES does not have a gl_Color, and therefore you will have to rewrite this shader.

like image 173
Gray Avatar answered Oct 18 '22 01:10

Gray