29

I can't seem to find a clear answer on this, despite hours of googling. Can someone just tell me what's going on? I get errors saying things like, "version 140 is not supported." Is this my device (Kindle Fire) or GL ES 2.0? Do I need to add libraries or anything?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Kyle Emmerich
  • 621
  • 3
  • 9
  • 17

4 Answers4

33

The OpenGL ES 2.0 spec refers to GLSL ES, which is not the same as GLSL.

The spec GLSL ES spec says:

This version of the language is based on version 1.10 of the desktop GLSL. However it includes a number of features that are in version 1.20 but not 1.10.

Check out the spec to see what's supported.

Thomas
  • 174,939
  • 50
  • 355
  • 478
15

OpenGL ES is not OpenGL, so similarly OpenGL ES's shader language is not OpenGL's shader language. They are similar, but they are not the same. So there is no desktop GLSL version that matches with GLSL ES's version.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
12

you actually don't have to add any libraries, 140 is far too new for Kindle Fire. Either remove the version specification or decrement it until the shader compiles. You may need to fix some other errors in the shader as the individual versions of the language do have some differences.

You can also query GL_SHADING_LANGUAGE_VERSION using glGetString() to get version of GLSL that is supported on your device (guaranteed to be 100 at least - ES 2.0 is the first one with a shading language).

Also, as mentioned by the others, OpenGL ES GLSL is not the same language as OpenGL ES (I thought that was rather obvious, OpenGL ES is not OpenGL) so the version numbers will not match. There is however GL_ARB_ES2_compatibility and its extensions to ES3, ES3.1 and ES3.2, where the mapping of the ES / non-ES GLSL languages is described, and using those it is possible to get ES-like functionality on an non-ES context.

the swine
  • 10,713
  • 7
  • 58
  • 100
  • 3
    And I thought 140 was pretty old. :( – Kyle Emmerich Jan 15 '12 at 18:25
  • 6
    Doesn't really answer the question. If something supports OpenGL ES 2.0 -- What version of GLSL does it support? (At least, at a minimum, I mean). – BrainSlugs83 Sep 03 '13 at 01:49
  • @BrainSlugs83: If something supports OpenGL ES 2.0 it is guaranteed to support GLSL ES 100. There is a lot of confusion when comparing these numbers sadly, as people see the `#version ...` directive and immediately think that apples (desktop GLSL) are somehow comparable to oranges (embedded GLSL). They are similar in many respects, but divergent in many more (and version numbering is one area where they diverge drastically). Have a look at: http://www.opengl.org/registry/gles/ - if you look under the heading "OpenGL ES 2.0 Specific", that tells you the GLSL ES version associated with it. – Andon M. Coleman Sep 29 '13 at 23:40
  • 2
    That is a valid point, however. The question was about GLSL ES and the accepted answer does not mention the fact that the version numbers are incongruent with desktop GLSL. The takeaway point here is that there is no version `140` in GLSL ES; we have `100` in ES 2.0 and the draft specification for ES 3.0 provides `300`. There have been no new language specification versions published in-between 2.0 and 3.0. – Andon M. Coleman Sep 29 '13 at 23:44
0

First of all you need to be clear:

  • OpenGL and GLSL are for desktop
  • OpenGL ES and GLSL ES are for Embedded System

If your system is using OpenGL ES 2.0, then you have to use GLSL ES 1.0 (Shader Preprocessor: #version 100)

It's tricky here that if you use #version 110 or #version 120, then the machine will understand that you want to use GLSL, not GLSL ES. Following table from Wikipedia will help you to be clear

OpenGL ES and WebGL use OpenGL ES Shading Language

enter image description here

Before OpenGL 3.3, the version naming was messy for both of them, but from OpenGL 3.3, the naming started to be clean

Tin Luu
  • 1,557
  • 16
  • 22