class methods
- of3dGraphics()
- drawArrow()
- drawAxis()
- drawBox()
- drawCone()
- drawCylinder()
- drawGrid()
- drawGridPlane()
- drawIcoSphere()
- drawPlane()
- drawRotationAxes()
- drawSphere()
- getBoxResolution()
- getConeResolution()
- getCylinderResolution()
- getIcoSphereResolution()
- getPlaneResolution()
- getSphereResolution()
- setBoxResolution()
- setConeResolution()
- setCylinderResolution()
- setIcoSphereResolution()
- setPlaneResolution()
- setSphereResolution()
global functions
- ofDrawBox()
- ofDrawCone()
- ofDrawCylinder()
- ofDrawIcoSphere()
- ofDrawPlane()
- ofDrawSphere()
- ofGetBoxResolution()
- ofGetConeResolution()
- ofGetCylinderResolution()
- ofGetIcoSphereResolution()
- ofGetPlaneResolution()
- ofGetSphereResolution()
- ofSetBoxResolution()
- ofSetConeResolution()
- ofSetCylinderResolution()
- ofSetIcoSphereResolution()
- ofSetPlaneResolution()
- ofSetSphereResolution()
drawArrow(...)
void of3dGraphics::drawArrow(const glm::vec3 &start, const glm::vec3 &end, float headSize)
drawBox(...)
void of3dGraphics::drawBox(const glm::vec3 &position, float size)
Documentation from code comments
Draws a cube with the specified size, starting from the specified position.
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:
position an glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner.
size The size of the cube.
drawBox(...)
void of3dGraphics::drawBox(const glm::vec3 &position, float width, float height, float depth)
Documentation from code comments
Draws a rectangular box with the specified dimensions, starting from the specified position.
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:
position an glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner.
width The width of the box.
height The height of the box.
depth The depth of the box.
drawBox(...)
void of3dGraphics::drawBox(float size)
Documentation from code comments
Draws a cube with the specified size, 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:
size The size of the cube.
drawBox(...)
void of3dGraphics::drawBox(float width, float height, float depth)
Documentation from code comments
Draws a rectangular box with the specified dimensions, 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:
width The width of the box.
height The height of the box.
depth The depth of the box.
drawBox(...)
void of3dGraphics::drawBox(float x, float y, float z, float size)
Documentation from code comments
Draws a cube with the specified size, starting from the specified coordinates.
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:
x The x-coordinate of the cube's origin.
y The y-coordinate of the cube's origin.
z The z-coordinate of the cube's origin.
size The size of the cube.
drawBox(...)
void of3dGraphics::drawBox(float x, float y, float z, float width, float height, float depth)
Documentation from code comments
Draws a rectangular box with the specified dimensions, starting from the specified coordinates.
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:
x The x-coordinate of the box's origin.
y The y-coordinate of the box's origin.
z The z-coordinate of the box's origin.
width The width of the box.
height The height of the box.
depth The depth of the box.
drawCylinder(...)
void of3dGraphics::drawCylinder(const glm::vec3 &position, float radius, float height)
drawCylinder(...)
void of3dGraphics::drawCylinder(float x, float y, float z, float radius, float height)
drawGrid(...)
void of3dGraphics::drawGrid(float stepSize, size_t numberOfSteps, bool labels, bool x, bool y, bool z)
drawGridPlane(...)
void of3dGraphics::drawGridPlane(float stepSize, size_t numberOfSteps, bool labels)
drawRotationAxes(...)
void of3dGraphics::drawRotationAxes(float radius, float stripWidth, int circleRes)
getConeResolution()
glm::vec3 of3dGraphics::getConeResolution()
Documentation from code comments
Retrieve a data structure describing the resolution with which cones are polygonized.
Allows you to fetch the resolution with which cones are polygonized. Returns an ofVec3f 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: An ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization.
setBoxResolution(...)
void of3dGraphics::setBoxResolution(int resWidth, int resHeight, int resDepth)
setConeResolution(...)
void of3dGraphics::setConeResolution(int radiusSegments, int heightSegments, int capSegments=2)
Documentation from code comments
Set the resolution of a polygonized cone.
Allows you to set the polygonization resolution of any cones you subsequently draw with ofDrawCone().
Parameters:
radiusSegments The number of facets (subdivisions) around the cone's circular footprint.
heightSegments The number of subdivisions from the cone's top to bottom.
capSegments The number of annular (ring-shaped) subdivisions of the cone's endcap.
setCylinderResolution(...)
void of3dGraphics::setCylinderResolution(int radiusSegments, int heightSegments, int capSegments=2)
ofDrawBox(...)
void ofDrawBox(const glm::vec3 &position, float size)
Draws a rectangular box with the specified dimensions, starting from the specified position.
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();
void ofApp::draw(){
// Draw a green rectangular cuboid slightly off the center of the canvas so to see the 3d shape.
ofSetColor(0, 255, 0);
ofFill();
ofDrawBox(ofPoint(ofGetWidth() * .5, ofGetHeight() * .7, 0), 100, 200,300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a cube with the specified size, starting from the specified position.
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:
position an glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner.
size The size of the cube.
ofDrawBox(...)
void ofDrawBox(const glm::vec3 &position, float width, float height, float depth)
Draws a cube with the specified size, starting from the specified position.
A cube is drawn starting from a 3D reference position, with the specified size. The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a yellow cube slightly off the center of the canvas so to see the 3d shape.
//(note that you cannot draw a rectangular cuboid with this function ... only a cube)
ofSetColor(255, 0, 0);
ofFill();
ofDrawBox(ofPoint(ofGetWidth() * .5, ofGetHeight() * .5, 0), 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a rectangular box with the specified dimensions, starting from the specified position.
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:
position an glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner.
width The width of the box.
height The height of the box.
depth The depth of the box.
ofDrawBox(...)
void ofDrawBox(float size)
Draws a cube with the specified size, starting from the origin. The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cube
//(note that you cannot draw a rectangular cuboid with this function ... only a cube)
ofSetColor(255, 0, 0);
ofFill();
ofDrawBox(500);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a cube with the specified size, 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:
size The size of the cube.
ofDrawBox(...)
void ofDrawBox(float width, float height, float depth)
Draws a rectangular box with the specified dimensions, 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();
void ofApp::draw(){
// Draw a red cuboid
ofSetColor(255, 0, 0);
ofFill();
ofDrawBox(500, 400, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a rectangular box with the specified dimensions, 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:
width The width of the box.
height The height of the box.
depth The depth of the box.
ofDrawBox(...)
void ofDrawBox(float x, float y, float z, float size)
Draws a cube with the specified size, starting from the specified coordinates.
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();
void ofApp::draw(){
// Draw a blue cube slightly off the center of the canvas so to see the 3d shape.
//(note that you cannot draw a rectangular cuboid with this function ... only a cube)
ofSetColor(0, 0, 255);
ofFill();
ofDrawBox(ofGetWidth() * .5, ofGetHeight() * .7, 0, 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a cube with the specified size, starting from the specified coordinates.
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:
x The x-coordinate of the cube's origin.
y The y-coordinate of the cube's origin.
z The z-coordinate of the cube's origin.
size The size of the cube.
ofDrawBox(...)
void ofDrawBox(float x, float y, float z, float width, float height, float depth)
Draws a rectangular box with the specified dimensions, starting from the specified coordinates. 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();
void ofApp::draw(){
// Draw a red cuboid slightly off the center of the canvas so to see the 3d shape.
ofSetColor(255, 0, 0);
ofFill();
ofDrawBox(ofGetWidth() * .5, ofGetHeight() * .7, 0, 200, 100, 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Draws a rectangular box with the specified dimensions, starting from the specified coordinates.
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:
x The x-coordinate of the box's origin.
y The y-coordinate of the box's origin.
z The z-coordinate of the box's origin.
width The width of the box.
height The height of the box.
depth The depth of the box.
ofDrawCone(...)
void ofDrawCone(const glm::vec3 &position, float radius, float height)
Draws a cone with specified radius and height starting from the specified position ( ofPoint(x,y,z) or ofPoint(x,y) ). The cone is drawn with the current color, e.g. set with ofSetColor(). The cone is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cone at the center of the canvas.
ofSetColor(255, 0, 0);
ofFill();
ofDrawCone(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 200, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCone(...)
void ofDrawCone(float radius, float height)
Draws a cone with specified radius and height starting from the origin. The cone is drawn with the current color, e.g. set with ofSetColor(). The cone is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cone
ofSetColor(255, 0, 0);
ofFill();
ofDrawCone(200, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCone(...)
void ofDrawCone(float x, float y, float radius, float height)
Draws a cone with specified radius and height starting from the specified position (x and y coordinates). The cone is drawn with the current color, e.g. set with ofSetColor(). The cone is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cone at the center of the canvas.
ofSetColor(255, 0, 0);
ofFill();
ofDrawCone(ofGetWidth() * .5, ofGetHeight()* .5, 200, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCone(...)
void ofDrawCone(float x, float y, float z, float radius, float height)
Draws a cone with specified radius and height starting from the specified position (x, y and z coordinates). The cone is drawn with the current color, e.g. set with ofSetColor(). The cone is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cone at the center of the canvas.
ofSetColor(255, 0, 0);
ofFill();
ofDrawCone(ofGetWidth() * .5, ofGetHeight()* .5, 0, 200, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCylinder(...)
void ofDrawCylinder(const glm::vec3 &position, float radius, float height)
Draws a cylinder with specified radius and height starting from the specified position ( ofPoint(x,y,z) or ofPoint(x,y,) ). The cylinder is drawn with the current color, e.g. set with ofSetColor(). The cylinder is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green cylinder at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawCylinder(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 50, 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCylinder(...)
void ofDrawCylinder(float radius, float height)
Draws a cylinder with specified radius and height starting from the origin. The cylinder is drawn with the current color, e.g. set with ofSetColor(). The cylinder is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cylinder
ofSetColor(255, 0, 0);
ofFill();
ofDrawCylinder(50, 300);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCylinder(...)
void ofDrawCylinder(float x, float y, float radius, float height)
Draws a cylinder with specified radius and height starting from the specified position (x and y coordinates). The cylinder is drawn with the current color, e.g. set with ofSetColor(). The cylinder is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cylinder at the center of the canvas.
ofSetColor(255, 0, 0);
ofFill();
ofDrawCylinder(ofGetWidth() * .5, ofGetHeight()* .5, 50, 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawCylinder(...)
void ofDrawCylinder(float x, float y, float z, float radius, float height)
Draws a cylinder with specified radius and height starting from the specified position (x, y and z coordinates). The cylinder is drawn with the current color, e.g. set with ofSetColor(). The cylinder is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a red cylinder at the center of the canvas.
ofSetColor(255, 0, 0);
ofFill();
ofDrawCylinder(ofGetWidth() * .5, ofGetHeight()* .5, 100, 50, 200);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawIcoSphere(...)
void ofDrawIcoSphere(const glm::vec3 &position, float radius)
Draws an icosphere (i.e. a sphere based on faces as opposed to UV map) with specified radius starting from specified position ( ofPoint(x,y,z) or ofPoint(x,y) ). The icosphere is drawn with the current color, e.g. set with ofSetColor(). The icosphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a blue icosphere at the center of the canvas.
ofSetColor(0, 0, 255);
ofFill();
ofDrawIcoSphere(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawIcoSphere(...)
void ofDrawIcoSphere(float radius)
Draws an icosphere (i.e. a sphere based on faces as opposed to UV map) starting from the origin. The icosphere is drawn with the current color, e.g. set with ofSetColor(). The icosphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a blue icosphere
ofSetColor(0, 0, 255);
ofFill();
ofDrawIcoSphere(100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawIcoSphere(...)
void ofDrawIcoSphere(float x, float y, float radius)
Draws an icosphere (i.e. a sphere based on faces as opposed to UV map) with specified radius starting from specified position (x and y coordinates). The icosphere is drawn with the current color, e.g. set with ofSetColor(). The icosphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a blue icosphere at the center of the canvas.
ofSetColor(0, 0, 255);
ofFill();
ofDrawIcoSphere(ofGetWidth() * .5, ofGetHeight()* .5, 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawIcoSphere(...)
void ofDrawIcoSphere(float x, float y, float z, float radius)
Draws an icosphere (i.e. a sphere based on faces as opposed to UV map) with specified radius starting from specified position (x,y and z coordinates). The icosphere is drawn with the current color, e.g. set with ofSetColor(). The icosphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a blue icosphere at the center of the canvas.
ofSetColor(0, 0, 255);
ofFill();
ofDrawIcoSphere(ofGetWidth() * .5, ofGetHeight()* .5, 0, 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawPlane(...)
void ofDrawPlane(glm::vec3 &position, float width, float height)
Draws a plane with specified width and height starting from the specified position ( ofPoint(x,y,z) or ofPoint(x,y) ). The plane is drawn with the current color, e.g. set with ofSetColor(). The plane is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green plane at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawPlane(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 100, 200);
}
ofDrawPlane(...)
void ofDrawPlane(float width, float height)
Draws a plane with specified width and height starting from the origin. The plane is drawn with the current color, e.g. set with ofSetColor(). The plane is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green plane
ofSetColor(0, 255, 0);
ofFill();
ofDrawPlane(100, 200);
}
ofDrawPlane(...)
void ofDrawPlane(float x, float y, float width, float height)
Draws a plane with specified width and height starting from the specified position (x and y coordinates). The plane is drawn with the current color, e.g. set with ofSetColor(). The plane is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green plane at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawPlane(ofGetWidth() * .5, ofGetHeight()* .5, 100, 200);
}
ofDrawPlane(...)
void ofDrawPlane(float x, float y, float z, float width, float height)
Draws a plane with specified width and height starting from the specified position (x, y and z coordinates). The plane is drawn with the current color, e.g. set with ofSetColor(). The plane is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green plane at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawPlane(ofGetWidth() * .5, ofGetHeight()* .5, 0, 100, 200);
}
ofDrawSphere(...)
void ofDrawSphere(const glm::vec3 &position, float radius)
Draws a UV sphere with specified radius starting from the specified position (ofPoint(x, y, z) or ofPoint(x,y) ). The sphere is drawn with the current color, e.g. set with ofSetColor(). The sphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green sphere at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawSphere(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawSphere(...)
void ofDrawSphere(float radius)
Draws a UV sphere with specified radius starting from the origin. The sphere is drawn with the current color, e.g. set with ofSetColor(). The sphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green sphere
ofSetColor(0, 255, 0);
ofFill();
ofDrawSphere(100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawSphere(...)
void ofDrawSphere(float x, float y, float radius)
Draws a UV sphere with specified radius starting from the specified position (x and y coordinates).The sphere is drawn with the current color, e.g. set with ofSetColor(). The sphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green sphere at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawSphere(ofGetWidth() * .5, ofGetHeight()* .5, 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofDrawSphere(...)
void ofDrawSphere(float x, float y, float z, float radius)
Draws a UV sphere with specified radius starting from the specified position (x, y and z coordinates). The sphere is drawn with the current color, e.g. set with ofSetColor(). The sphere is drawn filled by default; change this with ofFill();
void ofApp::draw(){
// Draw a green sphere at the center of the canvas.
ofSetColor(0, 255, 0);
ofFill();
ofDrawSphere(ofGetWidth() * .5, ofGetHeight()* .5, 0, 100);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofGetBoxResolution()
glm::vec3 ofGetBoxResolution()
Gets the resolution of the ofDrawBox object you created. Resolution is given for width, height and depth. Only 0 and 1 values make sense signifying ‘see/not see’ faces.
void ofApp::draw(){
// Draw a red cuboid
ofSetColor(255, 0, 0);
ofFill();
ofDrawBox(400, 350, 10, 200, 100, 200);
string boxres = ofToString(ofGetBoxResolution());
ofDrawBitmapString("Box Resolution: " + boxres, 30, 30);
}
ofGetConeResolution()
glm::vec3 ofGetConeResolution()
Allows you to fetch the resolution with which cones are polygonized. Returns an ofVec3f 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.
In short, it returns an ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization.
void ofApp::draw(){
// Draw a red cone
ofSetColor(255, 0, 0);
ofFill();
ofDrawCone(ofGetWidth() * .5, ofGetHeight()* .5, 200, 300);
string coneres = ofToString(ofGetConeResolution());
ofDrawBitmapString("Cone Resolution: " + coneres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
Documentation from code comments
Retrieve a data structure describing the resolution with which cones are polygonized.
Allows you to fetch the resolution with which cones are polygonized. Returns an ofVec3f 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: An ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization.
ofGetCylinderResolution()
glm::vec3 ofGetCylinderResolution()
Allows you to fetch the resolution with which cylinder are polygonized. Returns an ofVec3f containing the following data: Encoded as "x": radiusSegments, the number of facets (subdivisions) around the cylinder’s circular footprint. Encoded as "y": heightSegments, the number of subdivisions from the cylinder’s top to bottom. Encoded as "z": capSegments, the number of annular (ring-shaped) subdivisions of the cylinder’s endcap.
In short, it returns an ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization.
void ofApp::draw(){
// Draw a green cylinder
ofSetColor(0, 255, 0);
ofFill();
ofDrawCylinder(ofPoint(ofGetWidth() * .5, ofGetHeight()* .5), 50, 200);
string cylres = ofToString(ofGetCylinderResolution());
ofDrawBitmapString("Cylinder Resolution: " + cylres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofGetIcoSphereResolution()
int ofGetIcoSphereResolution()
Allows you to fetch the resolution with which IcoSphere is drawn (i.e. number of faces). Default value is 2.
void ofApp::draw(){
// Draw a green icosphere
ofSetColor(0, 255, 0);
ofFill();
ofDrawIcoSphere(ofPoint(ofGetWidth() * .5, ofGetHeight() * .5), 200);
string icores = ofToString(ofGetIcoSphereResolution());
ofDrawBitmapString("Icosphere Resolution: " + icores, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
ofGetPlaneResolution()
glm::vec2 ofGetPlaneResolution()
Allows you to fetch the resolution with which Plane is drawn. Returns columns across x axis and rows across y axis to draw the plane. Default is (6,4)
void ofApp::draw(){
// Draw a green plane (no fill)
ofSetColor(0, 255, 0);
ofNoFill();
ofDrawPlane(ofGetWidth() * .5, ofGetHeight() * .5, 400, 200);
string planeres = ofToString(ofGetPlaneResolution());
ofDrawBitmapString("Plane Resolution: " + planeres, 30, 30);
}
ofGetSphereResolution()
int ofGetSphereResolution()
Allows you to fetch the resolution with which a UV sphere is drawn. Default is 20.
void ofApp::draw(){
// Draw a green UV sphere (no fill)
ofSetColor(0, 255, 0);
ofNoFill();
ofDrawSphere(ofGetWidth() * .5, ofGetHeight() * .5, 200);
string sphereres = ofToString(ofGetSphereResolution());
ofDrawBitmapString("Sphere Resolution: " + sphereres, 30, 30);
}
ofSetBoxResolution(...)
void ofSetBoxResolution(int res)
Sets the resolution of the box. Only values of 0 and 1 seem legitimate and produce visible effect only when ‘ofFill’ is used.
int res;
void ofApp::setup(){
res = 1;
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetBoxResolution(res);
ofDrawBox(ofGetWidth() * .5, ofGetHeight() * .5, 0, 100, 200, 300);
string boxres = ofToString(ofGetBoxResolution());
ofDrawBitmapString("Box Resolution: " + boxres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
res--;
break;
case 'w':
res++;
break;
default:
break;
}
}
ofSetBoxResolution(...)
void ofSetBoxResolution(int resWidth, int resHeight, int resDepth)
Sets the resolution of the box. Only values of 0 and 1 seem legitimate and produce visible effect only when ‘ofFill’ is used. However, in this case you can switch faces on/off.
int resw, resh, resd;
void ofApp::setup(){
resw = 1;
resh = 1;
resd = 1;
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetBoxResolution(resw, resh, resd);
ofDrawBox(ofGetWidth() * .5, ofGetHeight() * .5, 0, 100, 200, 300);
string boxres = ofToString(ofGetBoxResolution());
ofDrawBitmapString("Box Resolution: " + boxres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
resw--;
break;
case 'w':
resw++;
break;
case 'a':
resh--;
break;
case 's':
resh++;
break;
case 'z':
resd--;
break;
case 'x':
resd++;
break;
default:
break;
}
}
ofSetConeResolution(...)
void ofSetConeResolution(int radiusSegments, int heightSegments, int capSegments=2)
Set the resolution of a polygonized cone. Allows you to set the polygonization resolution of any cones you subsequently draw with ofDrawCone().
radiusSegments: The number of facets (subdivisions) around the cone's circular footprint.
heightSegments: The number of subdivisions from the cone's top to bottom.
capSegments The number of annular (ring-shaped) subdivisions of the cone's endcap
int resr, resh, resc;
void ofApp::setup(){
resr = 9;
resh = 3;
resc = 2;
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetConeResolution(resr, resh, resc);
ofDrawCone(ofGetWidth() * .5, ofGetHeight() * .5, 0, 100, 200);
string coneres = ofToString(ofGetConeResolution());
ofDrawBitmapString("Cone Resolution: " + coneres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
resr--;
break;
case 'w':
resr++;
break;
case 'a':
resh--;
break;
case 's':
resh++;
break;
case 'z':
resc--;
break;
case 'x':
resc++;
break;
default:
break;
}
}
Documentation from code comments
Set the resolution of a polygonized cone.
Allows you to set the polygonization resolution of any cones you subsequently draw with ofDrawCone().
Parameters:
radiusSegments The number of facets (subdivisions) around the cone's circular footprint.
heightSegments The number of subdivisions from the cone's top to bottom.
capSegments The number of annular (ring-shaped) subdivisions of the cone's endcap.
ofSetCylinderResolution(...)
void ofSetCylinderResolution(int radiusSegments, int heightSegments, int capSegments=2)
Set the resolution of a polygonized cylinder. Allows you to set the polygonization resolution of any cylinder you subsequently draw with ofDrawCone().
radiusSegments: The number of facets (subdivisions) around the cylinder’s circular footprint.
heightSegments: The number of subdivisions from the cylinder’s top to bottom.
capSegments The number of annular (ring-shaped) subdivisions of the cylinder’s endcap
int resr, resh, resc;
void ofApp::setup(){
resr = 8;
resh = 2;
resc = 1;
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetCylinderResolution(resr, resh, resc);
ofDrawCylinder(ofGetWidth() * .5, ofGetHeight() * .5, 0, 100, 300);
string coneres = ofToString(ofGetCylinderResolution());
ofDrawBitmapString("Cone Resolution: " + coneres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
resr--;
break;
case 'w':
resr++;
break;
case 'a':
resh--;
break;
case 's':
resh++;
break;
case 'z':
resc--;
break;
case 'x':
resc++;
break;
default:
break;
}
}
ofSetIcoSphereResolution(...)
void ofSetIcoSphereResolution(int res)
Sets the resolution with which IcoSphere is drawn (i.e. number of faces). Default value is 2.
int res;
void ofApp::setup(){
res = 1;
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetIcoSphereResolution(res);
ofDrawIcoSphere(ofGetWidth() * .5, ofGetHeight() * .5, 100);
string icores = ofToString(ofGetIcoSphereResolution());
ofDrawBitmapString("IcoSphere Resolution: " + icores, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
res--;
break;
case 'w':
res++;
break;
default:
break;
}
}
ofSetPlaneResolution(...)
void ofSetPlaneResolution(int columns, int rows)
Sets the resolution with which Plane is drawn. Sets columns across x axis and rows across y axis to draw the plane. Default is (6,4)
int resx, resy;
void ofApp::setup(){
resx = 3;
resy = 2;
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetPlaneResolution(resx, resy);
ofDrawPlane(ofGetWidth() * .5, ofGetHeight() * .5, 100, 200);
string planeres = ofToString(ofGetPlaneResolution());
ofDrawBitmapString("Plane Resolution: " + planeres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
resx--;
break;
case 'w':
resx++;
break;
case 'a':
resy--;
break;
case 's':
resy++;
break;
default:
break;
}
}
ofSetSphereResolution(...)
void ofSetSphereResolution(int res)
Sets the resolution with which a UV sphere is drawn. Default is 20.
int res;
void ofApp::setup(){
res = 5;
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(0, 255, 0);
ofFill();
ofSetSphereResolution(res);
ofDrawSphere(ofGetWidth() * .5, ofGetHeight() * .5, 100);
string sphereres = ofToString(ofGetSphereResolution());
ofDrawBitmapString("Sphere Resolution: " + sphereres, 30, 30);
//NOTE: to better see the 3D shape you need to create a light spot...
//check `ofLight' documentation
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'q':
res--;
break;
case 'w':
res++;
break;
default:
break;
}
}
Last updated 화요일, 19 11월 2024 17:24:04 UTC - 2537ee49f6d46d5fe98e408849448314fd1f180e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue