Instantly share code, notes, and snippets.

Embed
What would you like to do?

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