## Running Pigment Applications

Running Pigment Applications — Run and debug your Pigment applications.

## Running and debugging Pigment applications

### Pigment environment variables

Pigment inspects a few environment variables.

`PGM_PLUGIN_PATH`. This environment variable can be set to a colon-separated list of paths. Pigment will scan these paths for rendering plug-ins. These plug-ins will be loaded in addition to, and before the plug-ins found in the system paths.

`PGM_DEBUG`. If GStreamer has been configured with `--enable-gst-debug=yes`, this variable can be set to a list of debug options, which causes Pigment to print out different types of debugging information to stderr. The variable takes a comma-separated list of "category_name:level" pairs to set specific levels for the individual categories. The level value ranges from 0 (nothing) to 5 (LOG).

1 - `ERROR` | Logs all fatal errors. These are errors that do not allow the core or a plugin to perform the requested action. The application can still recover if programmed to handle the conditions that triggered the error.
2 - `WARNING` | Logs all warnings. Typically these are non-fatal, but user-visible problems are expected to happen.
3 - `INFO` | Logs all informational messages. These are typically used for events in the system that only happen once, or are important and rare enough to be logged at this level.
4 - `DEBUG` | Logs all debug messages. These are general debug messages for events that happen only a limited number of times during an object's lifetime; these include setup, teardown, change of parameters, ...
5 - `LOG` | Logs all log messages. These are messages for events that happen repeatedly during an object's lifetime; these include streaming and steady-state conditions.

The category_name can contain "`*"` as a wildcard. For example, setting `PGM_DEBUG` to `pgm_canvas:5,pgm_*:3`, will cause the `pgm_canvas` category to be logged at full `LOG` level, while all categories starting with `pgm_` will be logged at `INFO` level. To get all possible debug output, set `PGM_DEBUG` to `*:5`

`PGM_IMAGE_THREAD_POOL_SIZE`. This environment variable can be set to an integer in the range [1, 16] defining the number of pre-allocated threads used by the image loader thread pool. The default setting is 1.

### OpenGL Viewport environment variables

Pigment OpenGL Viewport plugin inspects a few environment variables.

`PGM_GL_VBLANK`. This environment variable can be set to override the plugin selection of the best vertical synchronization method to use depending on the graphical driver. Note that if the __GL_SYNC_TO_VBLANK environment variable used by the NVIDIA proprietary driver is set, PGM_GL_VBLANK is simply ignored.

0 - | Disable all attempts to synchronize to the VBlank.
1 - | Use the GLX_SGI_video_sync extension to synchronize to the VBlank.
2 - | Use the GLX_SGI_swap_control extension to synchronize to the VBlank.

`PGM_GL_PROGRAMS`. This environment variable can be set to 0 in order to disable the use of all ARB vertex and fragment programs. In this case, Pigment will behave as if programs were not supported.

`PGM_GL_CSP_PROGRAM`. This environment variable can be set to 0 in order to disable the use of a fragment program to handle the color space conversion from I420 or YV12 YCbCr formats to RGB. It removes the I420 and YV12 pixel formats from the list of supported formats in the viewport.

`PGM_GL_FPS`. This environment variable can be set to an integer specifying the framerate in which the rendering loop should run. Note that the vertical synchronization will not work correctly when running Pigment with a custom framerate.

`PGM_GL_ARGB_VISUAL`. This environment variable can be set to 1 to enable the search for an ARGB visual when the plugin is used on Xlib/GLX. It means that if you are running in a composited environment, you will be able to change the opacity of the window.

`PGM_GL_INDIRECT_RENDERING`. This environment variable can be set to 1 to explicitly request the creation of a indirect rendered OpenGL context.

### OpenGL ES Viewport environment variables

Pigment OpenGL ES Viewport plugin inspects a few environment variables.

`PGM_GLES_SWAP_INTERVAL`. This environment variable can be set to an integer specifying the minimum number of vertical refresh periods (interval) that should occur for each buffer swap. A value of 0 specifies that buffer swaps must not be synchronized.

`PGM_GLES_FPS`. This environment variable can be set to an integer specifying the framerate in which the rendering loop should run. Note that the vertical synchronization will not work correctly when running Pigment with a custom framerate.