Programs structure
A program (brush engine or effect) is cut into sections :
•@param section
•@options section
•@functions section
•@main section
Except the main section the other sections are optional. You can place the sections in any order. A section begins with the keyword of the section and stops at the beginning of another section or at the end of the code if it is the last section. Sections contain the code to execute.
Coding
The instructions written in the @functions and @main sections are not interpreted by the editor. They are supplied as is to the compiler integrated to the graphic card of your workstation. These instructions should be written using GLSL (OpenGL Shading Language version # 330). For more information, please refer to the GLSL language specification and the many sites that provide information about this language or provide examples and tutorials.
The @params section
This section contains the program-specific settings. Each parameter is a variable that can be used in the function code or in the main section.
The parameters inserted in this section can be modified at program execution.
In the case of effects, the parameters are displayed in the effect parameter dialog.
In the case of brush engines, the parameters are displayed in the brush parameters panel in the Engine parameters category.
Types of parameters
The code editor provides an insert wizard for each parameter type.
Float type
Float types are real numbers displayed by a cursor and a number entry spinbox.
Declaration:
float <varName> = <default value> "<description>" min = <min> max = <max> increment = <increment>;
<varName>: name of the variable as used in the shader
<default value>: default value of the variable
<description>: descriptive text as displayed in the effect or brush parameter setting
<min>: minimum value, default 0.0
<max>: maximum value, default 1.0
<increment>: cursor increment value, default 0.01
Boolean type
A boolean type is a true or false value. Boolean types are displayed with a check box.
Declaration:
bool <varName> = <default value> "<description>";
<varName>: name of the variable as used in the shader
<default value>: default value, true or false
<description>: descriptive text as displayed in the effect or brush parameter setting
Enumeration type
An enumeration type is a list of integer values. The enumeration types are displayed by a list box.
Declaration :
enum <varName> = <default value> "<description>" enum values =
<value 1> "<value 1 description>"
<value 2> "<value 2 description>"
...
<value n> "<value n description>";
<varName>: name of the variable as used in the shader
<default value>: default value of the variable, a value in the list
<description>: descriptive text as displayed in the effect or brush parameter setting
<value> "<description>": list of enumeration values, the value usable in the shader and the description of the value is such that it appears in the list box.
Color type
The color type is a quadruplet variable, vec4 OpenGL variable, containing the red, green, blue and alpha components of the color. The color types are displayed with a color input field and a color selection dialog button.
Declaration :
color <varName> = rgb(<red>, <green>, <blue>[, <alpha>]) "<description>";
<varName>: name of the variable as used in the shader
<description>: descriptive text as displayed in the effect or brush parameter setting
<red>, <green>, <blue>, <alpha>: RGB components, red, green an blue components from 0 to 255, black = rgb (0, 0, 0) and white = rgb (255,255,255), transparency <alpha> from 0 to 255 is optional
Texture type
The texture types are the texture2D OpenGL variables. The texture file path is part of the variable and at run time it is not possible to choose the image file associated with the texture.
Declaration :
texture <texture_name> "<file path>" wraps = <wrap mode s> wrapt = <wrap mode t> min filter = <min filter> mag filter = <mag filter>;
<texture name>: name of the variable as used in the shader
<file path>: path of the image file of the texture. The path may contain substitution variables
•$DocumentsPath$: path of user documents (eg under Windows the Documents directory)
•$ImagesPath$: image directory path
•$InstallationPath$: path to the installation directory
<wrap mode s>, <wrap mode t>: parameter of the OpenGL S and T texture wrap. The wizard provides a list of possible values.
<min filter>: parameter of the OpenGL minification filter. The wizard provides a list of possible values.
<mag filter>: parameter of the OpenGL magnification filter. The wizard provides a list of possible values.
When compiling, YoupiPaint checks the existence of the image file and gives a warning if the file does not exist.
The @options section
This section contains run-time options, such as setting texture options for layers.
The @functions section
This section contains the code of the callable functions in the @main section.
The @main section
This section contains the main code of the program.