Compute Basic GLSL Sample


Category:  Compute
Min PC GPU: Fermi-based (GTX 4xx)
Min Tegra Device: Tegra K1

Description

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

APIs Used

Shared User Interface

The OpenGL 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.

Other controls are listed below.

Device Input Result
touch 1-Finger Drag Orbit-rotate the camera
2-Finger Drag Move up/down/left/right
2-Finger Pinch Scale the view
mouse Left-Button Drag Orbit-rotate the camera
Right-Button Drag Move up/down/left/right
Middle-Click Drag Scale the view (up:out, down:in)
keyboard Escape Quit the application
  Tab Toggle Tweakbar visibility
gamepad Start Toggle Tweakbar visibility
  Right Thumbstick Orbit-rotate the camera
  Left Thumbstick Move forward/backward. Slide left/right
  Left/Right Triggers Move up/down

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.

See Also


NVIDIA® GameWorks™ Documentation Rev. 1.0.220830 ©2014-2022. NVIDIA Corporation and affiliates. All Rights Reserved.