Skip to content
BKcore edited this page Feb 28, 2013 · 4 revisions

This is Shdr's Help page.

Summary

Update modes

Auto Update

This update mode will recompile your shaders and update the viewer upon every keystroke in the editor. Choose auto update if you would like to see your changes immediately. If you are experiencing delays or lags in this mode, please use a less demanding update mode.

ENTER Update

This mode will update the viewer everytime the key is used in the editor.

Ctrl+S Update

This mode will update the viewer everytime the key combination and is used in the editor.

Available Uniforms

uniform mat3 normalMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform vec2 resolution;
uniform float time;

Available Attributes

attribute vec3 position;
attribute vec3 normal;

Default Shaders

Default Vertex

precision highp float;

attribute vec3 position;
attribute vec3 normal;

uniform mat3 normalMatrix;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;

varying vec3 fNormal;
varying vec3 fPosition;

void main()
{
  fNormal = normalize(normalMatrix * normal);
  vec4 pos = modelViewMatrix * vec4(position, 1.0);
  fPosition = pos.xyz;
  gl_Position = projectionMatrix * pos;
}

Default Fragment

precision highp float;

uniform float time;
uniform vec2 resolution;

varying vec3 fPosition;
varying vec3 fNormal;

void main()
{
  gl_FragColor = vec4(fNormal, 1.0);
}