Skip to content

Instantly share code, notes, and snippets.

@antoineMoPa
Last active September 29, 2018 03:36
Show Gist options
  • Save antoineMoPa/892aee51e0fa8e8a6fe212c384e66866 to your computer and use it in GitHub Desktop.
Save antoineMoPa/892aee51e0fa8e8a6fe212c384e66866 to your computer and use it in GitHub Desktop.

Converting a GLSL 3 Shader back to GLSL 1 for webgl1

Let's say you have a modern shader written in glsl 300, but you need to make it work with webgl1.

Remove: #version 300 es

Replace:

in,out -> varying
texture -> texture2D

gl_FragColor

With webgl es, you define whatever variable you will use for color. In webgl2 with GLSL 300, it's always gl_FragColor

Set color with:

gl_FragColor = whatever_vec4_variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment