You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!
Notice: This tool has been deprecated and will soon be removed from Firefox. For details, see Deprecated tools.
The Shader Editor enables you to see and edit the vertex and fragment shaders used by WebGL.
With the Shader Editor you can examine and edit the source of the vertex and fragment shaders.
Here's another screencast, showing how you can use the Shader Editor for complex applications (in this case, the Unreal Engine demo):
Opening the Shader Editor
The Shader Editor is disabled by default. To enable it, open the Toolbox settings and check "Shader Editor" in the "Default Firefox Developer Tools" item. You'll now see "Shader Editor" appear in the toolbar. Click it and the Shader Editor opens.
At first you'll just see a blank window with a button asking you to reload the page:
To get started, load a page which creates a WebGL context and loads a program into it. The screenshots below are from the Unreal Engine demo.
You'll now see a window divided into three panes: a list of all the GLSL programs on the left, the vertex shader for the currently selected program in the middle, and the fragment shader for the currently selected program on the right:
The left hand pane lists all programs currently in use by a WebGL context. If you hover over an entry in the list, the geometry drawn by that program is highlighted in red:
If you click the eyeball icon just left of the program's entry, that program is disabled. This is useful for focusing on certain shaders or hiding overlapping geometry:
If you click the entry, its vertex and fragment shaders are shown in the other two panes, and you can edit them.
The middle and right hand panes show the vertex and fragment shaders for the currently selected program.
You can edit these programs and see the results the next time the WebGL context redraws (for example, in the next animation frame). For example, you can modify the colors:
The editor highlights syntax errors in your code:
If you hover over the cross shown next to a line containing an error, you'll see more details about the problem: