You copied the Doc URL to your clipboard.

3.2.2. Creating a new Shader Configuration File

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:

  1. Right-click on the SimpleTest project in the Package Explorer pane and select New → Shader Configuration.

    The Shader Configuration dialog box is displayed.

  2. Click SimpleTest.

  3. Click Finish.

  4. 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:

    Figure 3.6. Shader Configuration Editor

    Shader Configuration Editor

    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.

  5. Click Add Shader in either the Vertex Shaders section or the Fragment Shader section.

    The Resource Selection dialog box is displayed.

  6. Click the + icon next to SimpleTest and then click the src folder. See Figure Figure 3.7:

    Figure 3.7. Resources dialog box

    Resources dialog box

  7. Click the check box next to simple.vert.

  8. Click OK.

    The shader source is added to the effect.

  9. To add a shader to the shader sectioneither:

    • Use the buttons on the dialog:

      1. Click Add Shader in the Fragment Shaders section.

      2. Click the + icon next to SimpleTest and then click the src folder.

      3. Click simple.frag in the Resource Selection dialog box.

      4. Click OK.

    • Drag a shader from the Package Explorer window or the Project Explorer window into the Vertex Shaders or Fragment Shaders list.

  10. The Shader Configuration Editor contains the shaders. See Figure 3.8:

    Figure 3.8. Edited Shader Configuration Editor

    Edited Shader Configuration Editor

  11. Select File → Save to save the configuration.

    You have created your first shader effect called New Effect.

    Note

    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.

Was this page helpful? Yes No