webGl shaders uncaught syntax error

I'm getting Uncaught SyntaxError: Unexpected identifier at attribute vec3 aVertexPosition;

    <script id="shader-vs" type="text/javascript">
       attribute vec3 aVertexPosition;
       uniform mat4 uMVMatrix;
       uniform mat4 uPMatrix;
       void main(void) {
       gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
   }

Anyone knows how to fix it ? I'm pretty noob in webgl and I got more and more confused.

Upvotes: 0

Views: 1828

Answers (1)

WacławJasper
WacławJasper

Reputation: 3384

Change type="text/javascript" to anything else, such as type="x-shader/x-fragment". Otherwise your GLSL will be interpreted as javascript.

Upvotes: 1

Related Questions