cables is under heavy development.
There might be one or another bug, please let us know about it!
cables DocumentationHow To UseWorking with filesKeyboard ShortcutsUser Interface WalkthroughBeginner TutorialBeginner 1: Drawing A CircleBeginner 2: TransformationsBeginner 3: ColorMore TransformationsintermediateImage CompositionsPost-Processing 3D Scenescommunicationcables APICommunication with an Arduino via SerialCommunicating with Arduino over MQTTExporting And EmbeddingHow to serve files externally and fix CORS headersEmbedding PatchesExternal triggers / functionsEmbedding PatchesPreviewing / uploading exported cables patchescoding opsCreating AttachmentsGeneral op/Port CallbacksPortsDynamic PortsArray PortsBoolean portsInteger Number PortsObject PortsString portsTrigger PortsFloating Point Number PortsGUI/UI attributesHello Op - Part 1LibrariesDeveloping OpsGuidelinesObject PortsWriting ShadersWeb Audio Op DevelopmentHTML and CSS in cablesLightingLightsShadowsWorking with audioBasic Audio SetupWorking with EffectsReal-Time Audio Analyzation & Audio VisualizationOffline Audio Visualization & AnalyzationFAQEmbeddingHow to integrate my cables patch into my CMS (webflow/wix/squarespace/...)?How to remove grey rectangles on touch (mobile)?Why doesn't the DownloadTexture op work on iOS?How to disable page scrolling on mobile?Mobile tippsTransparent CanvasFeatures and SupportWill there be support for (animated) GIFs?Hot to report a bug in cablesGeneral questionsLicences and paymentWhat licence do i need to use cables?Will I have to pay for it in the future?How is my work licenced when using cables?Does cables support midi and OSC?ShadertoyTechnical questionsUI / EditorGuide to VR in cablesWebGL1 and WebGL2

Writing Shaders

Parameter Qualifiers

for better compatibility between webgl 1.x and 2.x, or GLSL v1 and v3 we use predefined qualifiers.

In GLSL >=3.0 you do not use qualifiers like attribute or varying, but in and out.

In cables we use IN, OUT and UNI, then your shader can be compiled for both GLSL versions used in webgl.

Vertex Shader Qualifiers

GLSL 1.0 GLSL 3.0 cables
varying out OUT
attribute in IN
uniform uniform UNI

Fragment Shader Qualifiers

GLSL 1.0 GLSL 3.0 cables
varying in IN
uniform uniform UNI

default cables inputs

vertex shader

vec3 vPosition;         - vertex position in object space
vec2 attrTexCoord;        - vertex texture coordinates
vec3 attrVertNormal;   - vertex normal

mat4 projMatrix;       - projection matrix
mat4 mvMatrix;         - modelview matrix
mat4 modelMatrix;      - model matrix
mat4 viewMatrix        - view matrix
mat4 inverseViewMatrix - inverted view matrix

fragment shader

IN vec2 texCoord;      - texture coordinate
IN vec3 norm;          - normal


Ops.Gl.Shader.ShaderMaterial can be used to live-edit shaders and see the results immediately.
You can use shaderMaterial with any kind of mesh and the mesh will be drawn using your custom shader.


You can edit Fragment and Vertex Shader Code.

Uniforms are automatically added as Ports of the ShaderMaterial Op. (Currently float and sampler2D)



You can always use Ops.Gl.Shader.ShowShader to view the source code of the current shader.

help cables get better and edit this file on github