There are two such shaders:
// Vertex shader program var VSHADER_SOURCE = 'attribute vec4 a_Position;\n' + 'attribute vec4 a_Color;\n' + 'varying vec4 v_Color;\n' + // varying variable 'void main() {\n' + ' gl_Position = a_Position;\n' + ' gl_PointSize = 10.0;\n' + ' v_Color = a_Color;\n' + // Pass the data to the fragment shader '}\n'; // Fragment shader program var FSHADER_SOURCE = '#ifdef GL_ES\n' + 'precision mediump float;\n' + // Precision qualifier (See Chapter 6) '#endif GL_ES\n' + 'varying vec4 v_Color;\n' + // Receive the data from the vertex shader 'void main() {\n' + ' gl_FragColor = v_Color;\n' + '}\n'; gl.getShaderParameter(shader, gl.COMPILE_STATUS); function: gl.getShaderParameter(shader, gl.COMPILE_STATUS);
The vertex shader is assembled without problems , but not fragmentary. This is what comes to the console: Failed to compile shader: ERROR: 0:3: 'GL_ES' : unexpected token after conditional expression
The code of someone else and I do not understand these lines here:
'#ifdef GL_ES\n' + 'precision mediump float;\n' + '#endif GL_ES\n' + At first I sinned on a video card but she had nothing to do with it. This code is taken from the source of the book and no one spoke badly about it on the network.
Help me find the cause of the error.