The debug subsytem provides an unified way of drawing visual shapes used for debugging. It consists of a squential command queue that process debug call place them into a list and process them all at once. First you need to notify the system to start gathering drawing commands, accumulate the commands and finally tell the system to send all the draw calls to the GPU.
Using this sytem you can choose when to send debug draw commands; it can either be on the OnDisplay
function of a Camera (which would also draw directly in the 3d viewport of the editor), a Scene or an App event.
Name | Description |
DrawBegin | Initiate the drawing. |
Declaration
|
DrawText | Draw text on screen using the default font embedded in the Debug class. |
Declaration vec2 DrawText( const vec2 location, const vec4 color, const char *str ) Parameters
location : The lower left starting point where the string should be displayed (in pixel).
color : The color to use to draw the string.
str : The string to draw on screen.
Return Value
Return the size in pixel occupied by the text.
|
DrawLine | Draw a colored line in 3d. |
Declaration void DrawLine( const vec3 start, const vec3 end, const vec4 color )
start : Start position of the line.
end : End position of the line
color : Color to use to draw the line.
|
DrawShadedLine | Draw a shaded line in 3d where a color can be assigned for the start and the end point. |
Declaration void DrawShadedLine( const vec3 start, const vec3 end, const vec4 color0, const vec4 color1 )
start : Start position of the line.
end : End position of the line
color0 : Color of the starting position.
color1 : Color of the end position.
|
DashedLine | Draw a dash line. |
Declaration void DashedLine( const vec3 start, const vec3 end, const vec4 color, unsigned int resolution )
start : Start position of the line.
end : End position of the line
color : Color to use to draw the line.
resolution : Amount of segment that should be drawed.
|
DrawLineStrip | Draw a line re-using the last point to create a new segment. |
Declaration void DrawLineStrip( const vec3 location, const vec4 color )
location : Location of the current point on the line.
color : Color to use to draw the point.
|
DrawParabolicCurve | Draw a parabolic curve between two point in space. |
Declaration void DrawParabolicCurve( const vec3 start, const vec3 end, const vec4 color, float smooth_factor, unsigned int resolution, unsigned char axis ) Parameters
start : Starting point location.
end : End point location.
color : The color to use to draw the curve.
smooth_factor : Smooth factor to tweak the tension of the arc.
axis : Specify the axis that should be arced.
|
DrawPoint | Force the application to synchronize based on a specific time step. |
Declaration void DrawPoint( const vec3 location, const vec4 color ) Parameters
location : Specify the location of the point.
color : Specify the color of the point.
|
DrawTriangle | Draw a triangle. |
Declaration void DrawTriangle( const vec3 v0, const vec3 v1, const vec3 v2, const vec4 color ) Parameters
v0 : First vertex.
v1 : Second vertex.
v2 : Third vertex.
color : Specify the color of the triangle.
|
DrawArc | Draw a full or partial circle. |
Declaration void DrawArc( const mat4 m, float radius, float angle, const vec4 color, unsigned int resolution, bool solid, bool closure ) Parameters
m : Transformation matrix to apply on the vertices generated for the arc.
radius : Base radius of the arc.
angle : Determine the circomference of the arc.
color : Color to use to draw the arc.
resolution : Total amount of segment to draw.
solid : Control to either draw triangles or wireframes.
closure : Force the last vertex to be connected back to the first.
|
DrawDashedArc | Draw a dashed full or partial circle. |
Declaration void DrawDashedArc( const mat4 m, float radius, float angle, const vec4 color, unsigned int resolution ) Parameters
m : Transformation matrix to apply on the vertices generated for the arc.
radius : Base radius of the arc.
angle : Determine the circomference of the arc.
color : Color to use to draw the arc.
resolution : Total amount of segment to draw.
|
DrawBBox | Draw a bounding box. |
Declaration void DrawBBox( const bbox box, const vec4 color ) Parameters
box : Coordinate of the bounding box.
color : Determine the color to use to draw the bounding box wireframe.
|
DrawAABB | Draw an axis aligned bounding box. |
Declaration void DrawAABB( const vec3 min, const vec3 max, const vec4 color ) Parameters
min : Minimum coordinate.
max : Maximum coordinate.
color : Determine the color to use to draw the box wireframe.
|
DrawDiamond | Draw a tri-dimensional wireframed diamond. |
Declaration void DrawDiamond( const mat4 m, float base, const vec4 color ) Parameters
m : Transformation to apply to the diamond generated vertices.
base : Size of the diamond base.
color : Color of the wireframe.
|
DrawWirePyramid | Function to draw a tri-dimensional wireframe pyramid. |
Declaration void DrawWirePyramid( const mat4 m, float base, float height, const vec4 color ) Parameters
m : Transformation matrix to apply to all generated vertices of the pyramid.
base : Base size of the pyramid.
height : Height of the pyramid.
color : Color to use to draw the pyramid wireframes.
|
DrawSolidPyramid | Function to draw a tri-dimensional solid pyramid. |
Declaration void DrawSolidPyramid( const mat4 m, float base, float height, const vec4 color ) Parameters
m : Transformation matrix to apply to all generated vertices of the pyramid.
base : Base size of the pyramid.
height : Height of the pyramid.
color : Color to use to draw the pyramid poygons.
|
DrawSolidCone | Draw a solid tri-dimensional cone. |
Declaration void DrawSolidCone( const mat4 m, unsigned int resolution, float radius, float height, const vec4 color ) Parameters
m : Transformation matrix to apply to all generated vertices of the cone.
resolution : Amount of segment to draw.
radius : Base radius of the cone.
height : Height of the cone.
color : Color to use to draw the cone's polygons.
|
DrawSolidBox | Draw a solid colored box. |
Declaration void DrawSolidBox( const mat4 m, const vec3 size, const vec4 color ) Parameters
m : Transformation matrix to apply to the box vertices.
size : Size of the box for each axis.
color : Color of the box.
|
DrawWireBox | Draw a colored wireframe box. |
Declaration void DrawWireBox( const mat4 m, const vec3 size, const vec4 color ) Parameters
m : Transformation matrix to apply to the box vertices.
size : Size of the box for each axis.
color : Color of the box.
|
DrawSolidCylinder | Draw a solid colored cylinder. |
Declaration void DrawSolidCylinder( const mat4 m, unsigned int resolution, float height, float radius, const vec4 color ) Parameters
m : Transformation matrix to apply to the cylinder vertices.
resolution : Total amount of segment to draw the cylinder.
height : Specify the cylinder height.
radius : Specify the base radius of the cylinder.
color : Determine the color of the cylinder.
|
DrawWireCone | Function to draw a wireframe cone. |
Declaration void DrawWireCone( const mat4 m, unsigned int resolution, float height, float radius, const vec4 color ) Parameters
m : Transformation matrix to apply to the cylinder vertices.
resolution : Total amount of segment to draw the cylinder.
height : Specify the cylinder height.
radius : Specify the base radius of the cylinder.
color : Determine the color of the cylinder.
|
DrawSolidPlane | Function to draw a solid plane. |
Declaration void DrawSolidPlane( const mat4 m, const vec2 size, const vec4 color ) Parameters
m : Transformation matrix to apply to the plane vertices.
size : Size of the plane on the X and Y axis.
color : Color to use to draw the plane.
|
DrawWirePlane | Function to draw a plane made of wireframes. |
Declaration void DrawWirePlane( const mat4 m, const vec2 size, const vec4 color ) Parameters
m : Transformation matrix to apply to the plane vertices.
size : Size of the plane on the X and Y axis.
color : Color to use to draw the plane wireframes.
|
DrawWireBall | Function to draw a wireframe ball. |
Declaration void DrawWireBall( const mat4 m, unsigned int resolution, float radius, const vec4 color ) Parameters
m : Transformation matrix to apply to the ball vertices.
resolution : Controls the amount of segments to draw the ball.
radius : Radius of the ball.
color : Color of the sphere wireframes.
|
DrawWireSphere | Function to draw a sphere made of wireframes. |
Declaration void DrawWireSphere( const mat4 m, float radius, const vec4 color ) Parameters
m : Transformation matrix to apply to the sphere vertices.
radius : Radius of the sphere.
color : Color to use to draw the sphere wireframes.
|
DrawSolidSphere | Function to draw a solid sphere. |
Declaration void DrawSolidSphere( const mat4 m, float radius, const vec4 color ) Parameters
m : Transformation matrix to apply to the sphere vertices.
radius : Radius of the sphere.
color : Color to use to draw the sphere polygons.
|
DrawEnd | Stop gathering drawing commands and send the draw queue to the GPU. |
Declaration
|
Find below a quick example on how to use the debug drawing API.