Developer Guide Release

Building and Running Samples
Building the OpenGL ES 2.0 Samples
Using NV_WINSYS when Building Graphics Samples
Copying the OpenGL ES 2.0 Samples to the Target FS
Running the OpenGL ES 2.0 Samples
Resolution Selection
Layer Selection
Antialiasing Specification
Program Binary Selection
Display Selection
Running the DriveWorks Samples
Running Vulkan Samples
Running vkfish
Running vcube
Samples must be built on the host. In order to run the samples, you must be logged onto the target system.
Building the OpenGL ES 2.0 Samples
The samples are provided with source code and a Makefile.
To build the samples
1. Make a copy of the default binaries.
2. On the host system, execute these commands:
cd <top>/drive-t186ref-linux/samples/opengles2/<sample>
make clean
Where <sample> is the name of the sample you wish to build. For example, gears.
If the copytarget script is invoked without specifying a <targetfs_dir>, the script corrupts the host system files.
Using NV_WINSYS when Building Graphics Samples
The platform includes a default window system, but additional window systems are also supported. Each of the graphics samples may be built for all the supported window systems for a given platform.
To switch to a different window system
Export NV_WINSYS with one of these values:
direct-to-display (For Vulkan samples only)
Binaries are saved in separate subdirectories depending on the window system with the same name, so you can maintain the output for multiple window systems.
For example, building gears for all the window systems results in the following directories being populated with gears executables:
The following table illustrates window system support for the samples under the opengles2 and Vulkan directories:
Supported NV_WINSYS Values
x11 (Linux only)
egldevice, wayland, screen (QNX only)
Vulkan (Linux only)
direct-to-display, wayland
Copying the OpenGL ES 2.0 Samples to the Target FS
Run the copytarget script, passing in the path to the targetfs to ensure that the new binary is copied to the target:
<top>/drive-t186ref-linux/utils/scripts/copytarget-samples <targetfs_dir>
Running the OpenGL ES 2.0 Samples
By default, if no command line arguments are supplied, the sample applications run at a native resolution for the connected display.
The sample apps can be run directly on EGLDevice, or on top of a window system. To run the samples on top of a window system, the window system must first be started. Supported window systems include:
For operating instructions, click on the link for your desired window system.
Using the egldevice version of gears as an example, run the sample with the following commands:
cd /home/nvidia/drive-t186ref-linux/samples/opengles2/gears/egldevice
Resolution Selection
Set the application's output resolution with the following flag:
-windowsize <xres> <yres>
This is the window size of the application.
Set the screen resolution with:
-screensize <xres> <yres>
Use this option to set the screen size when there is no window system running, as is the case for egldevice. When a window system like X11, Weston, or QNX Screen is running, the screen size is already set, and this option is ignored.
To specify a desktop offset, use the flag:
-windowoffset <xoffset> <yoffset>
Layer Selection
When running egldevice versions of the graphics samples, applications can select the overlay where to direct the sample output. Only one application can run per overlay, and the number of overlays per display head varies depending on the hardware configuration.
-layer <depth>
For example, on DRIVE OS AGX, valid values are -layer [0|1] for -dispno [0|1] and -layer 0 for -dispno [2|3].
Here, dispno is the display number that is assigned serially from 0 through 3 for the four displays on a DRIVE OS AGX SoC.
Antialiasing Specification
Specify multi-sample antialiasing (MSAA) with:
-msaa <numsamples>
The numsamples specified are platform-dependent.
Valid values are 2, 4, or 8.
Program Binary Selection
Applications use this option to load the pre-compiled shader program binary from its current execution path. The program binaries are generated for all supported architectures when the make command is run. These binaries are generated into separate directories, each with the supported architecture name. The correct directory name needs to be specified when running the sample app.
If the program binaries are not present, the application creates the program binary from shader source and saves the created program binary in the current execution path. The application can then use these saved program binaries on the next run. The flag to control use of program binary is:
-useprogbin <boolean>
Where <boolean> is either 0 or 1.
Display Selection
When running egldevice versions of the graphics samples, applications can select the output device with the command:
-dispno <number>
Possible values for <number> are 0, 1, 2, etc. <number> corresponds to a display node. For example:
-dispno 0: sets the display on /dev/tegra_dc_0
-dispno 1: sets the display on /dev/tegra_dc_1
-dispno 2: sets the display on /dev/tegra_dc_2
Each /dev/tegra_dc_<number> can be a different display type.