Description

This basic sample demonstrates how to interoperate between OpenGL [ES] and a simple OpenGL Compute Shader-based compute kernel.

Screenshot

APIs Used

  • GL_ARB_compute_shader
  • GL_COMPUTE_SHADER

Shared User Interface

The Graphics samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Technical Details

This sample shows how to access GL textures efficiently from a compute shader, for both reading and writing.

It loads a source texture from a dds file, creates an output texture of equal size, then performs the following every frame:

  1. Bind both input and output textures to image units for compute use.

  2. Execute the compute kernel, which performs a simple color invert.

  3. Draw output texture to screen.

The Compute filter pass can be toggled from the UI.