1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page renderer_usecase2 Renderer Engine Workflow
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 The Render Engine provides an API for drawing points, lines, triangles, boxes, ellipses, and grids.
9 ##### dwRenderEngineParams: Render Engine Parameters #####
10 Below are the parameters for the initialization of the Render Engine:
16 The bounds are the display boundaries for the Render Engine.
19 dwRenderEngineTileState defaultTile
23 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.
29 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.
32 uint32_t maxBufferCount
35 The maximum static buffer count is used when calling dwRenderEngine_addbuffer and dwRenderEngine_removeBuffer. It allocates buffers for static rendering.
37 ##### Rendering simple primitives #####
38 Here is a simple example to render a list of 3 random 3D boxes:
41 const uint32_t boxCount = 3;
44 float32_t aRandomFloatToDemonstrateOffset;
45 bool aRandomBoolToDemonstrateOffset;
48 int32_t aRandomIntToDemonstrateStride;
50 Box3D boxes[boxCount];
51 for (uint32_t i = 0; i < boxCount; ++i)
53 boxes[i].pos.x = getRandom() * 4 - 2;
54 boxes[i].pos.y = getRandom() * 4 - 2;
55 boxes[i].pos.z = getRandom() * 4 - 2;
57 boxes[i].size.x = 1.5f;
58 boxes[i].size.y = 0.5f;
59 boxes[i].size.z = 1.5f;
62 dwRenderEngine_setLineWidth(3.0f, m_renderEngine);
63 dwRenderEngine_setColor({0.0f, 0.5f, 1.0f, 1.0f}, m_renderEngine);
65 dwRenderEngine_setLookAtByAngles(10.0f * M_PI / 180.0f,
66 10.0f * M_PI / 180.0f,
68 {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, m_renderEngine);
70 dwRenderEngine_setPerspectiveProjection(60.0f * M_PI / 180.0f,
71 16.0f / 9.0f, 0.01f, 1000.0f, m_renderEngine);
73 dwRenderEngine_render(DW_RENDER_ENGINE_PRIMITIVE_TYPE_BOXES_3D,
75 sizeof(Box3D), // NOTE THE STRIDE
76 // NOTE THE OFFSET POINTS TO WHERE THE FIRST
77 // FIELD OF THE DATA STARTS FOR EACH ELEMENT
83 For more examples of how to use the Render Engine see:
84 - @ref dwx_render_engine_sample