Home -> IRenderableNode -> SetPrimitiveMode

Description

The SetPrimitiveMode method specifies how vertex data is interpreted to form geometric primitives. The PrimitiveMode enumeration specifies the valid list of primitive modes.

ImportantImportant

There is no default value for the primitive mode, and it must be set before this node is added to the tree. Attempts to add an IRenderableNode as a child to an IStateGroupNode without the primitive mode being set will be ignored, and an error will be logged.

WarningWarning

Once the IRenderableNode has been added as a child node, the primitive mode can no longer be changed, and calling the SetPrimitiveMode will return false. Removing the node as a child later will also not allow the primitive mode to be modified. If you want to change the primitive mode for a renderable which has been added as a child, you need to create a new IRenderableNode object.

WarningWarning

Due to API limitations, primitive restart is always enabled under Direct3D 11 renderers, and cannot be turned off. To avoid issues, you should consider the primitive restart index values to be reserved, and avoid their use regardless of whether primitive restart is enabled or not.

Usage

SuccessToken SetPrimitiveMode(PrimitiveMode primitiveMode, bool primitiveRestartEnabled = false);

Argument list

primitiveMode [PrimitiveMode]
The PrimitiveMode to use when drawing this object
primitiveRestartEnabled [bool]
For LineStrip and TriangleStrip primitive modes, specifies whether primitive restart is enabled.

Return value

[SuccessToken]
True if the primitive mode was successfully modified, false otherwise. This method will only fail if the renderable node has already been added as a child node. An assertion will be raised in debug builds if the result isn't tested.

See also