actarian / vscode-glsl-canvas

Live WebGL preview of GLSL shaders
MIT License
335 stars 25 forks source link

Custom Uniforms Documentation? #16

Closed matthewconstantine closed 5 years ago

matthewconstantine commented 5 years ago

I'm pretty new at glsl coding and I have found this extension is incredibly helpful. Thanks!

I'd love to use dat.gui but couldn't figure out how. Could you include an example? I tried to define and declare a uniform, thinking it would appear automatically when I clicked the options icon. Is there more to making it work?

uniform float density;
#define density 0.2
actarian commented 5 years ago

@matthewconstantine Thank you! You can open VSCode Preferences settings.json or workspace .vscode/settings.json and add custom uniforms as a key value pair:

{ 
    "glsl-canvas.uniforms": {
        "u_color": [1.0, 0.0, 0.0]
    }
}

You can find major info here: https://github.com/actarian/vscode-glsl-canvas/blob/master/README.md

and here https://github.com/actarian/vscode-glsl-canvas/blob/master/src/snippets/snippets.md