javaandroidopengl-esglslopengl-es-2.0

What versions of GLSL can I use in OpenGL ES 2.0?


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?


Solution

  • 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.