reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

of3dGraphics.cpp File Reference
#include "of3dGraphics.h"

Enumerations

enum  of3dPrimitiveType {
  OF_3D_PRIMITIVE_PLANE , OF_3D_PRIMITIVE_SPHERE , OF_3D_PRIMITIVE_ICO_SPHERE , OF_3D_PRIMITIVE_BOX ,
  OF_3D_PRIMITIVE_CONE , OF_3D_PRIMITIVE_CYLINDER , OF_3D_PRIMITIVE_BOX_WIREFRAME
}
 

Functions

void ofSetPlaneResolution (int columns, int rows)
 Set the resolution to use when drawing planes.
 
glm::vec2 ofGetPlaneResolution ()
 Get the current renderer's plane resolution as a vector.
 
void ofDrawPlane (float x, float y, float width, float height)
 Draw a plane with the current renderer.
 
void ofDrawPlane (float x, float y, float z, float width, float height)
 Draw a plane with the current renderer.
 
void ofDrawPlane (const glm::vec3 &position, float width, float height)
 Draw a plane with the current renderer.
 
void ofDrawPlane (float width, float height)
 Draw a plane with the current renderer at the origin.
 
void ofSetSphereResolution (int res)
 Set the sphere resolution for the current renderer.
 
int ofGetSphereResolution ()
 Get the sphere resolution used by the current renderer.
 
void ofDrawSphere (float x, float y, float radius)
 Draw a sphere with the current renderer.
 
void ofDrawSphere (float x, float y, float z, float radius)
 Draw a sphere with the current renderer.
 
void ofDrawSphere (const glm::vec3 &position, float radius)
 Draw a sphere with the current renderer.
 
void ofDrawSphere (float radius)
 Draw a sphere with the current renderer at the coordinate system's origin.
 
void ofSetIcoSphereResolution (int res)
 Set the icosphere resolution for the current renderer.
 
int ofGetIcoSphereResolution ()
 Get the icosphere resolution used by the current renderer.
 
void ofDrawIcoSphere (float x, float y, float z, float radius)
 Draw an icosphere with the current renderer.
 
void ofDrawIcoSphere (float x, float y, float radius)
 Draw an icosphere with the current renderer.
 
void ofDrawIcoSphere (const glm::vec3 &position, float radius)
 Draw an icosphere with the current renderer.
 
void ofDrawIcoSphere (float radius)
 Draw an icosphere with the current renderer at the origin.
 
void ofSetCylinderResolution (int radiusSegments, int heightSegments, int capSegments)
 Set the cylinder resolution for the current renderer.
 
glm::vec3 ofGetCylinderResolution ()
 Get the current renderer's cylinder resolution as a 3D vector.
 
void ofDrawCylinder (float x, float y, float radius, float height)
 Draw a cylinder with the current renderer.
 
void ofDrawCylinder (float x, float y, float z, float radius, float height)
 Draw a cylinder with the current renderer.
 
void ofDrawCylinder (const glm::vec3 &position, float radius, float height)
 Draw a cylinder with the current renderer.
 
void ofDrawCylinder (float radius, float height)
 Draw a cylinder at the origin using radius and height.
 
void ofSetConeResolution (int radiusSegments, int heightSegments, int capSegments)
 Set the cone resolution for the current renderer.
 
glm::vec3 ofGetConeResolution ()
 Get the current cone resolution.
 
void ofDrawCone (float x, float y, float z, float radius, float height)
 Draw a cone with the current renderer.
 
void ofDrawCone (float x, float y, float radius, float height)
 Draw a cone with the current renderer.
 
void ofDrawCone (const glm::vec3 &position, float radius, float height)
 Draw a cone with the current renderer.
 
void ofDrawCone (float radius, float height)
 Draw a cone at the origin using radius and height.
 
void ofSetBoxResolution (int res)
 Set the resolution the current renderer uses when drawing boxes.
 
void ofSetBoxResolution (int resWidth, int resHeight, int resDepth)
 Set the current box resolution.
 
glm::vec3 ofGetBoxResolution ()
 Get the current renderer's box resolution as a 3D vector.
 
void ofDrawBox (float x, float y, float z, float width, float height, float depth)
 Draw a cube with the current renderer.
 
void ofDrawBox (float x, float y, float z, float size)
 Draw a cube with the current renderer.
 
void ofDrawBox (const glm::vec3 &position, float width, float height, float depth)
 Draws a cube with the current renderer.
 
void ofDrawBox (const glm::vec3 &position, float size)
 Draws a cube with the current renderer.
 
void ofDrawBox (float size)
 Draws a cube with the current renderer, starting from the origin.
 
void ofDrawBox (float width, float height, float depth)
 Draws a cube with the current renderer, starting from the origin.
 
void ofSphere (float x, float y, float z, float radius)
 
void ofSphere (float x, float y, float radius)
 
void ofSphere (const glm::vec3 &position, float radius)
 
void ofSphere (float radius)
 
void ofCone (float x, float y, float z, float radius, float height)
 
void ofCone (float x, float y, float radius, float height)
 
void ofCone (const glm::vec3 &position, float radius, float height)
 
void ofCone (float radius, float height)
 
void ofBox (float x, float y, float z, float width, float height, float depth)
 
void ofBox (float x, float y, float z, float size)
 
void ofBox (const glm::vec3 &position, float width, float height, float depth)
 
void ofBox (const glm::vec3 &position, float size)
 
void ofBox (float size)
 
void ofBox (float width, float height, float depth)
 

Enumeration Type Documentation

◆ of3dPrimitiveType

Enumerator
OF_3D_PRIMITIVE_PLANE 
OF_3D_PRIMITIVE_SPHERE 
OF_3D_PRIMITIVE_ICO_SPHERE 
OF_3D_PRIMITIVE_BOX 
OF_3D_PRIMITIVE_CONE 
OF_3D_PRIMITIVE_CYLINDER 
OF_3D_PRIMITIVE_BOX_WIREFRAME 

Function Documentation

◆ ofBox() [1/6]

void ofBox ( const glm::vec3 &  position,
float  size 
)

◆ ofBox() [2/6]

void ofBox ( const glm::vec3 &  position,
float  width,
float  height,
float  depth 
)

◆ ofBox() [3/6]

void ofBox ( float  size)

◆ ofBox() [4/6]

void ofBox ( float  width,
float  height,
float  depth 
)

◆ ofBox() [5/6]

void ofBox ( float  x,
float  y,
float  z,
float  size 
)

◆ ofBox() [6/6]

void ofBox ( float  x,
float  y,
float  z,
float  width,
float  height,
float  depth 
)

◆ ofCone() [1/4]

void ofCone ( const glm::vec3 &  position,
float  radius,
float  height 
)

◆ ofCone() [2/4]

void ofCone ( float  radius,
float  height 
)

◆ ofCone() [3/4]

void ofCone ( float  x,
float  y,
float  radius,
float  height 
)

◆ ofCone() [4/4]

void ofCone ( float  x,
float  y,
float  z,
float  radius,
float  height 
)

◆ ofDrawBox() [1/6]

void ofDrawBox ( const glm::vec3 &  position,
float  size 
)

Draws a cube with the current renderer.

A cube is drawn starting from a 3D reference position, with the specified size. The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
positiona glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner.
sizeThe size of the cube.

◆ ofDrawBox() [2/6]

void ofDrawBox ( const glm::vec3 &  position,
float  width,
float  height,
float  depth 
)

Draws a cube with the current renderer.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from a 3D reference coordinate. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
positiona glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner.
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ ofDrawBox() [3/6]

void ofDrawBox ( float  size)

Draws a cube with the current renderer, starting from the origin.

The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
sizeThe size of the cube.

◆ ofDrawBox() [4/6]

void ofDrawBox ( float  width,
float  height,
float  depth 
)

Draws a cube with the current renderer, starting from the origin.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from the origin of the current reference frame. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ ofDrawBox() [5/6]

void ofDrawBox ( float  x,
float  y,
float  z,
float  size 
)

Draw a cube with the current renderer.

A cube is a rectangular solid bounded by six square faces of equal size. It is also known as a regular hexahedron, a square parallelepiped, an equilateral cuboid and a right rhombohedron. It is a regular square prism in three orientations.

It is drawn starting from a 3D reference coordinate, with the specified size. The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
xThe x-coordinate of the cube's origin.
yThe y-coordinate of the cube's origin.
zThe z-coordinate of the cube's origin.
sizeThe size of the cube.

◆ ofDrawBox() [6/6]

void ofDrawBox ( float  x,
float  y,
float  z,
float  width,
float  height,
float  depth 
)

Draw a cube with the current renderer.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from a 3D reference coordinate. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
xThe x-coordinate of the box's origin.
yThe y-coordinate of the box's origin.
zThe z-coordinate of the box's origin.
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ ofDrawCone() [1/4]

void ofDrawCone ( const glm::vec3 &  position,
float  radius,
float  height 
)

Draw a cone with the current renderer.

Cones are drawn with x, y, and z coordinates representing the centroid of the cone.

Parameters
positionThe 3D point representing this cone's position.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ ofDrawCone() [2/4]

void ofDrawCone ( float  radius,
float  height 
)

Draw a cone at the origin using radius and height.

This cone will be drawn with its position at the coordinate system's origin (0, 0, 0).

Parameters
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ ofDrawCone() [3/4]

void ofDrawCone ( float  x,
float  y,
float  radius,
float  height 
)

Draw a cone with the current renderer.

Cones are drawn with x, y, and z coordinates representing the centroid of the cylinder. This function draws a cone with a z position property of 0.

Parameters
xThe x coordinate to use when drawing this cone.
yThe y coordinate to use when drawing this cone.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ ofDrawCone() [4/4]

void ofDrawCone ( float  x,
float  y,
float  z,
float  radius,
float  height 
)

Draw a cone with the current renderer.

Cones are drawn with x, y, and z coordinates representing the centroid of the cone.

Parameters
xThe x coordinate to use when drawing this cone.
yThe y coordinate to use when drawing this cone.
zThe z coordinate to use when drawing this cone.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ ofDrawCylinder() [1/4]

void ofDrawCylinder ( const glm::vec3 &  position,
float  radius,
float  height 
)

Draw a cylinder with the current renderer.

Cyliners are drawn with x, y, and z coordinates representing the centroid of the cylinder.

Parameters
positionThe 3D point to use as a position coordinate when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ ofDrawCylinder() [2/4]

void ofDrawCylinder ( float  radius,
float  height 
)

Draw a cylinder at the origin using radius and height.

A cylinder drawn in this way will be positioned at the coordinate system origin (0, 0, 0).

Parameters
radiusThe radius to use when drawing this cylinder's circular footprint.

◆ ofDrawCylinder() [3/4]

void ofDrawCylinder ( float  x,
float  y,
float  radius,
float  height 
)

Draw a cylinder with the current renderer.

Cyliners are drawn with x, y, and z coordinates representing the centroid of the cylinder. This function doesn't specify a cylinder's z value so it defaults to 0.

Parameters
xThe x coordinate to use when drawing this cylinder.
yThe y coordinate to use when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ ofDrawCylinder() [4/4]

void ofDrawCylinder ( float  x,
float  y,
float  z,
float  radius,
float  height 
)

Draw a cylinder with the current renderer.

Cylinders are drawn with x, y, and z coordinates representing the centroid of the cylinder.

Parameters
xThe x coordinate to use when drawing this cylinder.
yThe y coordinate to use when drawing this cylinder.
zThe z coordinate to use when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ ofDrawIcoSphere() [1/4]

void ofDrawIcoSphere ( const glm::vec3 &  position,
float  radius 
)

Draw an icosphere with the current renderer.

Icospheres are drawn with their position coordinates representing the center of the sphere.

Parameters
positionA 3D point specifying the sphere's centroid.
radiusThe radius of the sphere.

◆ ofDrawIcoSphere() [2/4]

void ofDrawIcoSphere ( float  radius)

Draw an icosphere with the current renderer at the origin.

Icospheres are drawn with their position coordinates representing the center of the sphere. This function draws a sphere at the coordinate system origin (0, 0, 0).

Parameters
radiusThe radius of the sphere.

◆ ofDrawIcoSphere() [3/4]

void ofDrawIcoSphere ( float  x,
float  y,
float  radius 
)

Draw an icosphere with the current renderer.

Icospheres are drawn with their x, y, and z coordinates representing the center of the sphere. This function draws the sphere with a default origin z value of 0.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ ofDrawIcoSphere() [4/4]

void ofDrawIcoSphere ( float  x,
float  y,
float  z,
float  radius 
)

Draw an icosphere with the current renderer.

Icospheres are drawn with their x, y, and z coordinates representing the center of the sphere.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
zThe z coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ ofDrawPlane() [1/4]

void ofDrawPlane ( const glm::vec3 &  position,
float  width,
float  height 
)

Draw a plane with the current renderer.

Planes are drawn with their position coordinates specifying the center of the plane.

Parameters
positionA 3D point specifying the plane's centroid.
widthThe width of the plane.
heightThe height of the plane.

◆ ofDrawPlane() [2/4]

void ofDrawPlane ( float  width,
float  height 
)

Draw a plane with the current renderer at the origin.

Parameters
widthThe width of the plane.
heightThe height of the plane.

◆ ofDrawPlane() [3/4]

void ofDrawPlane ( float  x,
float  y,
float  width,
float  height 
)

Draw a plane with the current renderer.

Planes are drawn with their x, y, and z coordinates specifying the center of the plane. This function draws the plane with a default origin z value of 0.

Parameters
xThe x coordinate of the plane's centroid.
yThe y coordinate of the plane's centroid.
widthThe width of the plane.
heightThe height of the plane.

◆ ofDrawPlane() [4/4]

void ofDrawPlane ( float  x,
float  y,
float  z,
float  width,
float  height 
)

Draw a plane with the current renderer.

Planes are drawn with their x, y, and z coordinates specifying the center of the plane.

Parameters
xThe x coordinate of the plane's centroid.
yThe y coordinate of the plane's centroid.
zThe z coordinate of the plane's centroid.
widthThe width of the plane.
heightThe height of the plane.

◆ ofDrawSphere() [1/4]

void ofDrawSphere ( const glm::vec3 &  position,
float  radius 
)

Draw a sphere with the current renderer.

Spheres are drawn with their position representing the center of the sphere.

Parameters
positionA 3D point specifying the sphere's centroid.
radiusThe radius of the sphere.

◆ ofDrawSphere() [2/4]

void ofDrawSphere ( float  radius)

Draw a sphere with the current renderer at the coordinate system's origin.

Spheres are drawn with their position representing the center of the sphere. This function draws a sphere at the coordinate system origin of 0, 0, 0.

Parameters
radiusThe radius of the sphere.

◆ ofDrawSphere() [3/4]

void ofDrawSphere ( float  x,
float  y,
float  radius 
)

Draw a sphere with the current renderer.

Spheres are drawn with x, y, and z coordinates representing the center of the sphere. This function draws the sphere with a default origin z value of 0.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ ofDrawSphere() [4/4]

void ofDrawSphere ( float  x,
float  y,
float  z,
float  radius 
)

Draw a sphere with the current renderer.

Spheres are drawn with their x, y, and z coordinates representing the center of the sphere.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
zThe z coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ ofGetBoxResolution()

glm::vec3 ofGetBoxResolution ( )

Get the current renderer's box resolution as a 3D vector.

The returned vector's x, y, and z properties represent the current renderer's resolution width, resolution height, and resolution depth respectively.

Returns
This renderer's current box resolution as a 3D vector.

◆ ofGetConeResolution()

glm::vec3 ofGetConeResolution ( )

Get the current cone resolution.

Allows you to fetch the resolution with which cones are polygonized. Returns a glm::vec3 containing the following data: Encoded as "x": radiusSegments, the number of facets (subdivisions) around the cone's circular footprint. Encoded as "y": heightSegments, the number of subdivisions from the cone's top to bottom. Encoded as "z": capSegments, the number of annular (ring-shaped) subdivisions of the cone's endcap.

Returns
A 3D vector containing radiusSegments, heightSegments, capSegments for cone polygonization as x, y, and z properties respectively.

◆ ofGetCylinderResolution()

glm::vec3 ofGetCylinderResolution ( )

Get the current renderer's cylinder resolution as a 3D vector.

The resulting vector's x, y, and z properties correspond to the radius segments, height segments, and cap segments of the current renderer's cylinder resolution respectively.

Returns
A 3D vector representing the current renderer's cylinder resolution.

◆ ofGetIcoSphereResolution()

int ofGetIcoSphereResolution ( )

Get the icosphere resolution used by the current renderer.

Returns
The icosphere resolution used by the current renderer.

◆ ofGetPlaneResolution()

glm::vec2 ofGetPlaneResolution ( )

Get the current renderer's plane resolution as a vector.

Returns
A vector whose x property describes column resolution and y property describes row resolution.
See also
ofDrawPlane()

◆ ofGetSphereResolution()

int ofGetSphereResolution ( )

Get the sphere resolution used by the current renderer.

Returns
The sphere resolution used by the current renderer.

◆ ofSetBoxResolution() [1/2]

void ofSetBoxResolution ( int  res)

Set the resolution the current renderer uses when drawing boxes.

Boxes

Parameters
resThe number of subdivisions to use for box widths, heights, and depths.

◆ ofSetBoxResolution() [2/2]

void ofSetBoxResolution ( int  resWidth,
int  resHeight,
int  resDepth 
)

Set the current box resolution.

Parameters
resWidthThe number of subdivisions to use when drawing box widths.
resHeightThe number of subdivisions to use when drawing box heights.
resDepthThe number of subdivisions to use when drawing box depths.

◆ ofSetConeResolution()

void ofSetConeResolution ( int  radiusSegments,
int  heightSegments,
int  capSegments = 2 
)

Set the cone resolution for the current renderer.

Cones

Allows you to set the polygonization resolution of any cones you subsequently draw with ofDrawCone().

Parameters
radiusSegmentsThe number of facets (subdivisions) around the cone's circular footprint.
heightSegmentsThe number of subdivisions from the cone's top to bottom.
capSegmentsThe number of annular (ring-shaped) subdivisions of the cone's endcap. Defaults to 2.

◆ ofSetCylinderResolution()

void ofSetCylinderResolution ( int  radiusSegments,
int  heightSegments,
int  capSegments = 2 
)

Set the cylinder resolution for the current renderer.

Cylinders

Parameters
radiusSegmentsThe number of facets (subdivisions) around the cylinder's circular footprint. A larger number yields a higher resolution.
heightSegmentsThe number of horizontal subdivisions from the cylinder's top to bottom.
capSegmentsThe number of annular (ring-shaped) subdivisions of the cylinder's endcap. Defaults to 2.

◆ ofSetIcoSphereResolution()

void ofSetIcoSphereResolution ( int  res)

Set the icosphere resolution for the current renderer.

A higher resolution will produce a smoother looking sphere at the cost of using more vertices to do so.

Parameters
resThe resolution to use when drawing icospheres.
See also
ofDrawIcoSphere()

◆ ofSetPlaneResolution()

void ofSetPlaneResolution ( int  columns,
int  rows 
)

Set the resolution to use when drawing planes.

Planes

Parameters
columnsThe number of columns to use when drawing planes with the current renderer.
rowsThe number of rows to use when drawing planes with the current renderer.
See also
ofDrawPlane()

◆ ofSetSphereResolution()

void ofSetSphereResolution ( int  res)

Set the sphere resolution for the current renderer.

Spheres

The sphere resolution describes how many facets (cross-sections) will be used when drawing spheres. A higher resolution will produce a smoother looking sphere at the cost of using more vertices to do so.

Parameters
resThe resolution to use when drawing spheres.
See also
ofDrawSphere()

◆ ofSphere() [1/4]

void ofSphere ( const glm::vec3 &  position,
float  radius 
)

◆ ofSphere() [2/4]

void ofSphere ( float  radius)

◆ ofSphere() [3/4]

void ofSphere ( float  x,
float  y,
float  radius 
)

◆ ofSphere() [4/4]

void ofSphere ( float  x,
float  y,
float  z,
float  radius 
)