DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Renderer Engine Workflow
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

The Render Engine provides an API for drawing points, lines, triangles, boxes, ellipses, and grids.

dwRenderEngineParams: Render Engine Parameters

Below are the parameters for the initialization of the Render Engine:

dwRectf bounds

The bounds are the display boundaries for the Render Engine.

The Render Engine works by rendering into tiles. More tiles can be added, but there is one tile initially. This is the default tile. This default tile state represents the state of that tile.

uint32_t bufferSize

This is the default buffer size for rendering primitives in bytes. It is used to allocate an internal GPU buffer which is then used when rendering data.

uint32_t maxBufferCount

The maximum static buffer count is used when calling dwRenderEngine_addbuffer and dwRenderEngine_removeBuffer. It allocates buffers for static rendering.

Rendering simple primitives

Here is a simple example to render a list of 3 random 3D boxes:

const uint32_t boxCount = 3;
typedef struct
{
float32_t aRandomFloatToDemonstrateOffset;
bool aRandomBoolToDemonstrateOffset;
dwVector3f size;
int32_t aRandomIntToDemonstrateStride;
} Box3D;
Box3D boxes[boxCount];
for (uint32_t i = 0; i < boxCount; ++i)
{
boxes[i].pos.x = getRandom() * 4 - 2;
boxes[i].pos.y = getRandom() * 4 - 2;
boxes[i].pos.z = getRandom() * 4 - 2;
boxes[i].size.x = 1.5f;
boxes[i].size.y = 0.5f;
boxes[i].size.z = 1.5f;
}
dwRenderEngine_setLineWidth(3.0f, m_renderEngine);
dwRenderEngine_setColor({0.0f, 0.5f, 1.0f, 1.0f}, m_renderEngine);
dwRenderEngine_setLookAtByAngles(10.0f * M_PI / 180.0f,
10.0f * M_PI / 180.0f,
5.0f,
{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, m_renderEngine);
16.0f / 9.0f, 0.01f, 1000.0f, m_renderEngine);
boxes,
sizeof(Box3D), // NOTE THE STRIDE
// NOTE THE OFFSET POINTS TO WHERE THE FIRST
// FIELD OF THE DATA STARTS FOR EACH ELEMENT
offsetof(Box3D, pos),
boxCount,
m_renderEngine);

For more examples of how to use the Render Engine see: