Search code examples
openglopengl-3mesaubuntu-13.10

Precision qualifier throws an error for OpenGL 3.0 under Mesa 9.2.1


A strange issue with OpenGL 3.0 under Mesa 9.2.1 on Ubuntu 13.10 (64-bit) is observed. Variable definition with explicit precision (like this: highp vec2 v;) produces an error:

syntax error, unexpected VEC2, expecting ',' or ';'

It seems like precision qualifier is disabled there for some reasons. Mesa Release Notes doesn't clear the situation -- not bugs, nor notifications are relative to the topic.

P.S. with OpenGL ES 3.0 precision qualifier works correctly.


Solution

  • Make sure you specify #version 130.

    Without a #version directive OpenGL will default to #version 110 where precision qualifiers are most certainly not valid.

    P.S. with OpenGL ES 3.0 precision qualifier works correctly.

    Unsurprising. Precision qualifiers work in both OpenGL ES GLSL #versions.