Is the shader language for WebGL the same as that for OpenGL? In other words, if I write a shader for WebGL will it be fully compatible with OpenGL?
I do not want to purchase a book about OpenGL Shading Language if it is not going to work for WebGL.
WebGL 2D/3D Programming and Graphics Rendering For The Web Shaders are written in OpenGL ES Shader Language (known as ES SL).
WebGL is based on OpenGL ES, which lacks the many features that regular OpenGL is having, like it supports only vertex and fragment shaders. OpenGL has features that are not in WebGL like geometry shaders, tessellation shaders, and compute shaders. WebGL is mainly used for browsers.
As mentioned in how it works WebGL requires 2 shaders every time you draw something. A vertex shader and a fragment shader. Each shader is a function.
WebGL 1.0 only supports GLSL 1.0. 17. (Remember that WebGL is based on OpenGL ES 2.0, which was designed for computing devices with low power and limited processing.)
WebGL itself is more closely related to GLES2.0 than to desktop GL and thus uses the same shading language as ES2: The OpenGL ES Shading Language 1.0. This is somewhat similiar to the early desktop GLSL versions (like GLSL1.10 or 1.20 which were current at the time of GL2.x), but more limited. So buying a book about desktop GLSL might not be the best choice, you might want to look specifically for GLES ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With