DriveWorks SDK Reference
5.8.83 Release
For Test and Development only

Renderer Engine Workflow

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
Defines a rectangle with floating point numbers.
Definition: Types.h:224

The bounds are the display boundaries for the Render Engine.

The state for a render engine tile.
Definition: RenderEngine.h:299

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);
float32_t x
Definition: Types.h:356
float float32_t
Specifies POD types.
Definition: Types.h:70
Defines a three-element floating-point vector.
Definition: Types.h:355
DW_VIZ_API_PUBLIC dwStatus dwRenderEngine_render(dwRenderEnginePrimitiveType type, const void *buffer, uint32_t vertexStrideBytes, uint32_t offsetBytes, uint32_t primitiveCount, dwRenderEngineHandle_t engine)
Render an external buffer.
DW_VIZ_API_PUBLIC dwStatus dwRenderEngine_setLookAtByAngles(float32_t xAngleRadians, float32_t yAngleRadians, float32_t distance, dwVector3f center, dwVector3f up, dwRenderEngineHandle_t engine)
Defines the camera position on a sphere surface around a center point, with the camera looking toward...
DW_VIZ_API_PUBLIC dwStatus dwRenderEngine_setPerspectiveProjection(float32_t fovRadsY, float32_t aspect, float32_t near, float32_t far, dwRenderEngineHandle_t engine)
Sets the projection matrix for the current tile as defined by the parameters.
DW_VIZ_API_PUBLIC dwStatus dwRenderEngine_setColor(dwRenderEngineColorRGBA color, dwRenderEngineHandle_t engine)
Sets the foreground drawing color of the current tile.
DW_VIZ_API_PUBLIC dwStatus dwRenderEngine_setLineWidth(float32_t lineWidth, dwRenderEngineHandle_t engine)
Sets the line width of the current tile.
@ DW_RENDER_ENGINE_PRIMITIVE_TYPE_BOXES_3D
Interleaved is x,y,z,width,height,depth,x,y,z,width,height,depth Min vertex size is 6 floats.
Definition: RenderEngine.h:111

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