This section describes how to create a shader configuration file. The configuration file is required to link the fragment shader and vertex shader source files together to produce an overall effect. The shader configuration file configures the type of effect that is produced.
To create a new shader configuration file:
Right-click on the SimpleTest project in the Package Explorer pane and select New → Shader Configuration.
The Shader Configuration dialog box is displayed.
The Shader Configuration file (named
shaders.shaderconfig) is created in the SimpleTest project and the Shader Configuration Editor pane is displayed. See Figure 3.6:
For more information about the shader configuration editor, see Shader Configuration editor.
The shader configuration editor enables you to manage shader effects for a project. A default effect, called New Effect, is created when the shader configuration is created. The default effect is used for this example.
The shader configuration editor separates vertex and fragment shaders into two lists. You can add any source file in the project to these lists. This enables utility shader sources, that are neither specifically vertex or fragment shader sources, to be reused.
Click Add Shader in either the Vertex Shaders section or the Fragment Shader section.
The Resource Selection dialog box is displayed.
Click the + icon next to SimpleTest and then click the src folder. See Figure Figure 3.7:
Click the check box next to simple.vert.
The shader source is added to the effect.
To add a shader to the shader sectioneither:
Use the buttons on the dialog:
Click Add Shader in the Fragment Shaders section.
Click the + icon next to SimpleTest and then click the src folder.
Click simple.frag in the Resource Selection dialog box.
Drag a shader from the Package Explorer window or the Project Explorer window into the Vertex Shaders or Fragment Shaders list.
The Shader Configuration Editor contains the shaders. See Figure 3.8:
Select File → Save to save the configuration.
You have created your first shader effect called New Effect.
Eclipse displays warning messages in the Problems pane when the shader effect is created. These warnings are a result of uninitiated uniform and attribute variables in the shader programs. These can be ignored and eventually disappear after completing the Rendering the shader effect section.