reference

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

ofGraphics.cpp File Reference
#include "ofGraphics.h"
#include "ofRendererCollection.h"
#include "ofGLRenderer.h"

Macros

#define CALLBACK
 

Functions

void ofSetCurrentRenderer (shared_ptr< ofBaseRenderer > renderer, bool setDefaults)
 
void ofPushView ()
 Stores the current viewport and matrix settings.
 
void ofPopView ()
 Restores the viewport and matrix settings set by ofPushView()
 
void ofViewport (ofRectangle viewport)
 Setup the drawing viewport.
 
void ofViewport (float x, float y, float width, float height, bool invertY)
 Setup the drawing viewport.
 
ofRectangle ofGetCurrentViewport ()
 Get the position and size of the current viewport.
 
ofRectangle ofGetNativeViewport ()
 Get the position and size of the native viewport.
 
int ofGetViewportWidth ()
 Get the width of the current viewport.
 
int ofGetViewportHeight ()
 Get the height of the current viewport.
 
int ofOrientationToDegrees (ofOrientation orientation)
 
bool ofIsVFlipped ()
 Get if view is flipped vertically.
 
void ofSetCoordHandedness (ofHandednessType handedness)
 
ofHandednessType ofGetCoordHandedness ()
 
void ofSetupScreenPerspective (float width, float height, float fov, float nearDist, float farDist)
 
void ofSetupScreenOrtho (float width, float height, float nearDist, float farDist)
 
void ofSetupGraphicDefaults ()
 Resets openGL screen coordinates and values back to OF defaults.
 
void ofSetupScreen ()
 
void ofPushMatrix ()
 Saves the current coordinate system allowing users to develop specific movements in some graphic objects. ofPopMatrix needs to be called after.
 
void ofPopMatrix ()
 Restores the prior coordinate system.
 
glm::mat4 ofGetCurrentMatrix (ofMatrixMode matrixMode_)
 Queries the current OpenGL matrix state @detail Returns the specified matrix as held by the renderer's current matrix stack.
 
glm::mat4 ofGetCurrentOrientationMatrix ()
 Query the current (oF internal) Orientation Matrix state.
 
glm::mat4 ofGetCurrentNormalMatrix ()
 Query the current (oF internal) Normal Matrix state.
 
void ofTranslate (const glm::vec3 &p)
 
void ofTranslate (const glm::vec2 &p)
 
void ofTranslate (float x, float y, float z)
 Translate by (x,y,z) vector of our coordinate system. The call of ofTranslate() modifies graphics positions.
 
void ofScale (float xAmnt, float yAmnt, float zAmnt)
 
void ofScale (float amount)
 Scale along the X, Y and Z axis with the same amount.
 
void ofScale (const glm::vec3 &p)
 
void ofRotate (float degrees)
 
void ofRotate (float degrees, float vecX, float vecY, float vecZ)
 
void ofRotateX (float degrees)
 
void ofRotateY (float degrees)
 
void ofRotateZ (float degrees)
 
void ofRotateDeg (float degrees)
 Rotate around the z-axis.
 
void ofRotateDeg (float degrees, float vecX, float vecY, float vecZ)
 Produces a rotation around the vector (vecX,vecY,vecZ).
 
void ofRotateXDeg (float degrees)
 Produces a rotation around the X-axis of our coordinate system represented by the vector (1,0,0).
 
void ofRotateYDeg (float degrees)
 Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,1,0).
 
void ofRotateZDeg (float degrees)
 Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,0,1).
 
void ofRotateRad (float radians)
 Rotate around the z-axis.
 
void ofRotateRad (float radians, float vecX, float vecY, float vecZ)
 Produces a rotation around the vector (vecX,vecY,vecZ).
 
void ofRotateXRad (float radians)
 Produces a rotation around the X-axis of our coordinate system represented by the vector (1,0,0).
 
void ofRotateYRad (float radians)
 Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,1,0).
 
void ofRotateZRad (float radians)
 Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,0,1).
 
void ofLoadIdentityMatrix (void)
 
void ofLoadMatrix (const glm::mat4 &m)
 
void ofLoadMatrix (const float *m)
 
void ofMultMatrix (const glm::mat4 &m)
 
void ofMultMatrix (const float *m)
 
void ofSetMatrixMode (ofMatrixMode matrixMode)
 
void ofLoadViewMatrix (const glm::mat4 &m)
 
void ofMultViewMatrix (const glm::mat4 &m)
 
glm::mat4 ofGetCurrentViewMatrix ()
 
void ofClear (float r, float g, float b, float a)
 Clears the color and depth bits of current renderer and replaces it with an RGB color.
 
void ofClear (float brightness, float a)
 Clears the color and depth bits of current renderer and replaces it with a grayscale value.
 
void ofClear (const ofColor &c)
 Clears the color and depth bits of current renderer and replaces it with an ofColor.
 
void ofClearAlpha ()
 
void ofSetBackgroundAuto (bool bAuto)
 Sets the background clearing function to be auto (default) or not. If non- auto, then background clearing will not occur per frame (at the start of draw) but rather, whenever ofBackground is called.
 
bool ofGetBackgroundAuto ()
 
bool ofbClearBg ()
 
ofColor ofGetBackground ()
 
ofColor ofGetBackgroundColor ()
 Returns the current background color as an ofColor.
 
void ofBackground (int brightness, int alpha)
 
void ofBackground (const ofColor &c)
 
void ofBackgroundHex (int hexColor, int alpha)
 Sets the background color using a hex color value.
 
void ofBackground (int r, int g, int b, int a)
 Sets the background color.
 
void ofBackgroundGradient (const ofColor &start, const ofColor &end, ofGradientMode mode)
 Sets the background color to a gradient.
 
void ofSetBackgroundColor (int brightness, int alpha)
 
void ofSetBackgroundColorHex (int hexColor, int alpha)
 Sets the background color using a hex color value.
 
void ofSetBackgroundColor (int r, int g, int b, int a)
 Sets the background color. It takes as input r,g,b (0-255). The background is cleared automatically, just before the draw() command, so if the background color is not changing, you could call this inside setup() (once, at the start of the application). If the background color is changing, you can call this inside update().
 
void ofSetBackgroundColor (const ofColor &c)
 
void ofSetRectMode (ofRectMode mode)
 Sets the mode for drawing rectangles and other rectangular objects, if they are corner aligned, or drawn so that the x,y position is the center of the rectangle. possible options are OF_RECTMODE_CENTER and OF_RECTMODE_CORNER. This affects not only how ofDrawRectangle() objects are drawn, but also ofTexture (and therefore ofImage) objects.
 
ofRectMode ofGetRectMode ()
 Tells you if rectangle drawing mode is set to drawn from the center or drawn from the top left corner, as set with the ofSetRectMode() function.
 
void ofNoFill ()
 Draw shapes as outlines with the current draw color.
 
void ofFill ()
 Draw shapes filled with the current draw color.
 
ofFillFlag ofGetFill ()
 
void ofSetLineWidth (float lineWidth)
 Sets the width of the ofDrawLine() called after.
 
void ofSetDepthTest (bool depthTest)
 Set depth testing on or off to either sort by z-depth (true) or draw order (false).
 
void ofEnableDepthTest ()
 Turns on depth testing so rendering happens according to z-depth rather than draw order.
 
void ofDisableDepthTest ()
 Turn off depth testing so rendering happens in draw order rather than by z-depth.
 
void ofSetCurveResolution (int res)
 
void ofSetCircleResolution (int res)
 Sets the resolution for the ofDrawCircle command. By default, the circle is 22 points, but if you need to draw larger circles, you can adjust the resolution using this command. All circles are cached in openGL using a display list for optimization purposes.
 
void ofSetColor (const ofColor &color)
 
void ofSetColor (const ofColor &color, int _a)
 
void ofSetColor (int r, int g, int b)
 Sets the draw color with r,g,b, 0-255. For example, red would be: ofSetColor(255,0,0). This affects not only the color of shapes drawn with ofDrawRectangle(), ofDrawCircle(), etc, but also the tint of images and textures.
 
void ofSetColor (int r, int g, int b, int a)
 Sets the draw color with r,g,b,a 0-255.
 
void ofSetColor (int gray)
 
void ofSetHexColor (int hexColor)
 
void ofEnableBlendMode (ofBlendMode blendMode)
 Sets and enables the blend mode for drawing. The options are:
 
void ofEnablePointSprites ()
 Turn on point sprite.
 
void ofDisablePointSprites ()
 Turn off point sprites.
 
void ofDisableBlendMode ()
 Disable the current blend mode.
 
void ofEnableAlphaBlending ()
 Turns on alpha blending (which is on by default since OF version 0.8.0). It simply wraps opengl commands that enable blending, and turn on a common blend mode.
 
void ofDisableAlphaBlending ()
 Turn off alpha blending.
 
void ofEnableSmoothing ()
 
void ofDisableSmoothing ()
 Turn off smoothing. Currently, this only works for lines. You can draw a filled object, and then draw the outline with smoothing enabled to get smoothing effects on filled shapes.
 
void ofSetPolyMode (ofPolyWindingMode mode)
 Sets the drawing behavior for overlapping parts of the same polygon.
 
void ofEnableAntiAliasing ()
 Enables anti-aliasing (smoothing) for lines.
 
void ofDisableAntiAliasing ()
 Turns off anti-aliasing (smoothing).
 
void ofSetDrawBitmapMode (ofDrawBitmapMode mode)
 Set the bitmap drawing mode.
 
void ofSetStyle (ofStyle style)
 Set the current style of the ofGraphics.
 
ofStyle ofGetStyle ()
 
void ofPushStyle ()
 Saves the current style settings for the ofGraphics after its call. Usage of ofPushStyle and ofPopStyle allow users to have more control of certain graphics elements. All the style that applies to certain elements is controled using ofStyle class. See ofStyle type.
 
void ofPopStyle ()
 Restores the prior style settings. It needs to be called after ofPushStyle.
 
void ofDrawTriangle (const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec3 &p3)
 
void ofDrawTriangle (const glm::vec2 &p1, const glm::vec2 &p2, const glm::vec2 &p3)
 
void ofDrawTriangle (float x1, float y1, float x2, float y2, float x3, float y3)
 Draws a triangle, with the three points: (x1,y1),(x2, y2),(x3, y3).
 
void ofDrawTriangle (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofDrawCircle (const glm::vec3 &p, float radius)
 
void ofDrawCircle (const glm::vec2 &p, float radius)
 
void ofDrawCircle (float x, float y, float radius)
 Draws a circle, centered at x,y, with a given radius.
 
void ofDrawCircle (float x, float y, float z, float radius)
 
void ofDrawEllipse (const glm::vec3 &p, float width, float height)
 
void ofDrawEllipse (const glm::vec2 &p, float width, float height)
 
void ofDrawEllipse (float x, float y, float width, float height)
 Draws an ellipse from point (x,y) with a given width (w) and height (h).
 
void ofDrawEllipse (float x, float y, float z, float width, float height)
 
void ofDrawLine (const glm::vec3 &p1, const glm::vec3 &p2)
 
void ofDrawLine (const glm::vec2 &p1, const glm::vec2 &p2)
 
void ofDrawLine (float x1, float y1, float x2, float y2)
 
void ofDrawLine (float x1, float y1, float z1, float x2, float y2, float z2)
 
void ofDrawRectangle (const ofRectangle &r)
 Draws an rectangle from the given rectangle.
 
void ofDrawRectangle (const glm::vec3 &p, float w, float h)
 Draws an rectangle from point p, with a given width and height.
 
void ofDrawRectangle (const glm::vec2 &p, float w, float h)
 
void ofDrawRectangle (float x, float y, float w, float h)
 Draws a rectangle from point x,y with a given width and height.
 
void ofDrawRectangle (float x, float y, float z, float w, float h)
 
void ofDrawRectRounded (const ofRectangle &b, float r)
 Draws a rounded rectangle from the given rectangle using given radius.
 
void ofDrawRectRounded (const glm::vec3 &p, float w, float h, float r)
 Draws a rectangle from point p with a given width, height and radius of rounded corners.
 
void ofDrawRectRounded (const glm::vec2 &p, float w, float h, float r)
 
void ofDrawRectRounded (float x, float y, float w, float h, float r)
 Draws a rectangle from point X, Y with a given width, height and radius of rounded corners.
 
void ofDrawRectRounded (float x, float y, float z, float w, float h, float r)
 Draws a rectangle from point X, Y, at depth Z with a given width, height and radius of rounded corners.
 
void ofDrawRectRounded (const glm::vec3 &p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 Draws a rounded rectangle from point X, Y, at depth Z with a given width, height and radius of rounded corners.
 
void ofDrawRectRounded (const glm::vec2 &p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 
void ofDrawRectRounded (const ofRectangle &b, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 Draws a rounded rectangle from the given rectangle using different given radius for each of the corners.
 
void ofDrawRectRounded (float x, float y, float z, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 Draws a rounded rectangle from point X, Y, at depth Z with a given width, height and different radius for each rounded corner.
 
void ofDrawCurve (float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
 Draws a curve from point (x1, y1) to point (x2, y2). The curve is shaped by the two control points (x0,y0) and (x3,y3).
 
void ofDrawCurve (float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 Draws a 3-dimensional curve from point (x1, y1, z1) to point (x2, y2, z2). The curve is shaped by the two control points (x0, y0, z0) and (x3, y3, z3).
 
void ofDrawBezier (float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
 
void ofDrawBezier (float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofTriangle (const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec3 &p3)
 
void ofTriangle (float x1, float y1, float x2, float y2, float x3, float y3)
 
void ofTriangle (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofCircle (const glm::vec3 &p, float radius)
 
void ofCircle (float x, float y, float radius)
 
void ofCircle (float x, float y, float z, float radius)
 
void ofEllipse (const glm::vec3 &p, float width, float height)
 
void ofEllipse (float x, float y, float width, float height)
 
void ofEllipse (float x, float y, float z, float width, float height)
 
void ofLine (const glm::vec3 &p1, const glm::vec3 &p2)
 
void ofLine (float x1, float y1, float x2, float y2)
 
void ofLine (float x1, float y1, float z1, float x2, float y2, float z2)
 
void ofRect (const ofRectangle &r)
 
void ofRect (const glm::vec3 &p, float w, float h)
 
void ofRect (float x, float y, float w, float h)
 
void ofRect (float x, float y, float z, float w, float h)
 
void ofRectRounded (const ofRectangle &b, float r)
 
void ofRectRounded (const glm::vec3 &p, float w, float h, float r)
 
void ofRectRounded (float x, float y, float w, float h, float r)
 
void ofRectRounded (float x, float y, float z, float w, float h, float r)
 
void ofRectRounded (const glm::vec3 &p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 
void ofRectRounded (const ofRectangle &b, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 
void ofRectRounded (float x, float y, float z, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)
 
void ofCurve (float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
 
void ofCurve (float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofBezier (float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
 
void ofBezier (float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofBeginShape ()
 Start drawing a new shape. Needs to be followed by a list of vertex points and lastly a call to ofEndShape().
 
void ofVertex (float x, float y)
 Specifies a single point of a shape. To be called between ofBeginShape() and ofEndShape().
 
void ofVertex (float x, float y, float z)
 
void ofVertex (const glm::vec3 &p)
 
void ofVertex (const glm::vec2 &p)
 
void ofVertices (const vector< glm::vec3 > &polyPoints)
 
void ofVertices (const vector< glm::vec2 > &polyPoints)
 
void ofVertices (const vector< ofVec3f > &polyPoints)
 
void ofVertices (const vector< ofVec2f > &polyPoints)
 
void ofCurveVertex (float x, float y)
 Specifies a single point of a shape. The difference from ofVertex is that the line describing the edge of the shape between two points will be a curve as opposed to a straight line. The curve is automatically generated using the catmull from formula.
 
void ofCurveVertex (float x, float y, float z)
 
void ofCurveVertices (const vector< glm::vec3 > &curvePoints)
 
void ofCurveVertices (const vector< glm::vec2 > &curvePoints)
 
void ofCurveVertices (const vector< ofVec3f > &curvePoints)
 
void ofCurveVertices (const vector< ofVec2f > &curvePoints)
 
void ofCurveVertex (const glm::vec3 &p)
 
void ofCurveVertex (const glm::vec2 &p)
 
void ofBezierVertex (float x1, float y1, float x2, float y2, float x3, float y3)
 Describes a bezier curve through three points of a shape. To be called between ofBeginShape() and ofEndShape().
 
void ofBezierVertex (const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec3 &p3)
 
void ofBezierVertex (const glm::vec2 &p1, const glm::vec2 &p2, const glm::vec2 &p3)
 
void ofBezierVertex (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
 
void ofNextContour (bool bClose)
 Allows you to draw multiple contours within one shape. Call this between ofBeginShape() and ofEndShape() to create a new contour for your shape.
 
void ofEndShape (bool bClose)
 This tells the program that your shape is finished and that it should now draw it to the screen.
 
template<>
void ofDrawBitmapString (const string &textString, float x, float y, float z)
 
template<>
void ofDrawBitmapString (const std::string &textString, const glm::vec3 &p)
 
template<>
void ofDrawBitmapString (const std::string &textString, const glm::vec2 &p)
 
void ofDrawBitmapStringHighlight (string text, const glm::vec3 &position, const ofColor &background, const ofColor &foreground)
 
void ofDrawBitmapStringHighlight (string text, const glm::vec2 &position, const ofColor &background, const ofColor &foreground)
 
void ofDrawBitmapStringHighlight (string text, int x, int y, const ofColor &background, const ofColor &foreground)
 

Macro Definition Documentation

◆ CALLBACK

#define CALLBACK

Function Documentation

◆ ofBackground() [1/3]

void ofBackground ( const ofColor c)

◆ ofBackground() [2/3]

void ofBackground ( int  brightness,
int  alpha 
)

◆ ofBackground() [3/3]

void ofBackground ( int  r,
int  g,
int  b,
int  a = 255 
)

Sets the background color.

It takes as input r,g,b (0-255). The background is cleared automatically, just before the draw() command, so if the background color is not changing, you could call this inside of setup() (once, at the start of the application). If the background color is changing, you can call this inside of update().

void ofApp::setup(){
ofBackground(255,0,0); // Sets the background color to red
}
void ofBackground(int brightness, int alpha)
Definition ofGraphics.cpp:362

◆ ofBackgroundGradient()

void ofBackgroundGradient ( const ofColor start,
const ofColor end,
ofGradientMode  mode = OF_GRADIENT_CIRCULAR 
)

Sets the background color to a gradient.

It takes as input 2 ofColor() objects and a Gradient Mode. Must be called in the draw() function.

Accepted modes are:

  • Circular: OF_GRADIENT_CIRCULAR
  • Linear: OF_GRADIENT_LINEAR
  • Bar: OF_GRADIENT_BAR

Background Gradient: Circular: Background Gradient Circular

void ofApp::draw(){
ofColor colorOne(255, 0, 0);
ofColor colorTwo(0, 0, 0);
// Sets the background to a circular gradient
}
void ofBackgroundGradient(const ofColor &start, const ofColor &end, ofGradientMode mode)
Sets the background color to a gradient.
Definition ofGraphics.cpp:382
@ OF_GRADIENT_CIRCULAR
Represents a circular gradient beginning at the screen's center.
Definition ofGraphicsConstants.h:78

Background Gradient: Linear: Background Gradient Linear

void ofApp::draw(){
ofColor colorOne(255, 0, 0);
ofColor colorTwo(0, 0, 0);
// Sets the background to a linear gradient
}
@ OF_GRADIENT_LINEAR
Represents a top-to-bottom linear gradient.
Definition ofGraphicsConstants.h:76

Background Gradient: Bar: Background Gradient Bar

void ofApp::draw(){
ofColor colorOne(255, 0, 0);
ofColor colorTwo(0, 0, 0);
ofBackgroundGradient(colorOne, colorTwo, OF_GRADIENT_BAR);
// Sets the background to a bar gradient
}
@ OF_GRADIENT_BAR
Represents a horizontal bar gradient.
Definition ofGraphicsConstants.h:83

TODO: revert to glm::vec2!!

◆ ofBackgroundHex()

void ofBackgroundHex ( int  hexColor,
int  alpha = 255 
)

Sets the background color using a hex color value.

void ofApp::setup(){
ofBackgroundHex(0xff0000); // Sets the background color to red
}
void ofBackgroundHex(int hexColor, int alpha)
Sets the background color using a hex color value.
Definition ofGraphics.cpp:372

◆ ofbClearBg()

bool ofbClearBg ( )

◆ ofBeginShape()

void ofBeginShape ( )

Start drawing a new shape. Needs to be followed by a list of vertex points and lastly a call to ofEndShape().

//draws a star
ofVertex(400,135);
ofVertex(215,135);
ofVertex(365,25);
ofVertex(305,200);
ofVertex(250,25);
void ofBeginShape()
Start drawing a new shape. Needs to be followed by a list of vertex points and lastly a call to ofEnd...
Definition ofGraphics.cpp:1030
void ofEndShape(bool bClose)
This tells the program that your shape is finished and that it should now draw it to the screen.
Definition ofGraphics.cpp:1160
void ofVertex(float x, float y)
Specifies a single point of a shape. To be called between ofBeginShape() and ofEndShape().
Definition ofGraphics.cpp:1035
void ofSetPolyMode(ofPolyWindingMode mode)
Sets the drawing behavior for overlapping parts of the same polygon.
Definition ofGraphics.cpp:615
@ OF_POLY_WINDING_NONZERO
Fill all non-zero winding numbers.
Definition ofGraphicsConstants.h:101
See also
ofEndShape()

◆ ofBezier() [1/2]

void ofBezier ( float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

◆ ofBezier() [2/2]

void ofBezier ( float  x0,
float  y0,
float  z0,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofBezierVertex() [1/4]

void ofBezierVertex ( const glm::vec2 &  p1,
const glm::vec2 &  p2,
const glm::vec2 &  p3 
)

◆ ofBezierVertex() [2/4]

void ofBezierVertex ( const glm::vec3 &  p1,
const glm::vec3 &  p2,
const glm::vec3 &  p3 
)

◆ ofBezierVertex() [3/4]

void ofBezierVertex ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

Describes a bezier curve through three points of a shape. To be called between ofBeginShape() and ofEndShape().

◆ ofBezierVertex() [4/4]

void ofBezierVertex ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofCircle() [1/3]

void ofCircle ( const glm::vec3 &  p,
float  radius 
)

◆ ofCircle() [2/3]

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

◆ ofCircle() [3/3]

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

◆ ofClear() [1/3]

void ofClear ( const ofColor c)

Clears the color and depth bits of current renderer and replaces it with an ofColor.

void ofApp::draw(){
ofColor myColor(0, 0, 255);
ofClear(myColor);
// Clears current screen and replaces it with myColor.
}
void ofClear(float r, float g, float b, float a)
Clears the color and depth bits of current renderer and replaces it with an RGB color.
Definition ofGraphics.cpp:318

◆ ofClear() [2/3]

void ofClear ( float  brightness,
float  a = 0 
)

Clears the color and depth bits of current renderer and replaces it with a grayscale value.

void ofApp::draw(){
ofClear(128);
// Clears current screen and replaces it with a grayscale value.
}

◆ ofClear() [3/3]

void ofClear ( float  r,
float  g,
float  b,
float  a = 0 
)

Clears the color and depth bits of current renderer and replaces it with an RGB color.

When drawing to the screen, ofClear() will clear the screen entirely.

void ofApp::draw() {
ofClear(255, 0, 0);
// Clears current screen and replaces it with red.
// Screen will render as a flat color.
}

When using the openGL renderer and drawing into an FBO, ofClear() will clear that buffer rather than the main screen.

void ofApp::draw() {
ofFbo myFbo;
myFbo.allocate(300, 300);
myFbo.begin();
ofClear(255, 0, 0);
// Clears FBO buffer and replaces it with red.
// No effect in current drawing screen.
myFbo.end();
}
Definition ofFbo.h:46
void allocate(int width, int height, int internalformat=GL_RGBA, int numSamples=0)
Definition ofFbo.cpp:525
void begin(ofFboMode mode=OF_FBOMODE_PERSPECTIVE|OF_FBOMODE_MATRIXFLIP) const
Definition ofFbo.cpp:835
void end() const
Ends the current framebuffer render context.
Definition ofFbo.cpp:888

ofClear() is based on glClear.

◆ ofClearAlpha()

void ofClearAlpha ( )

◆ ofCurve() [1/2]

void ofCurve ( float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

◆ ofCurve() [2/2]

void ofCurve ( float  x0,
float  y0,
float  z0,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofCurveVertex() [1/4]

void ofCurveVertex ( const glm::vec2 &  p)

◆ ofCurveVertex() [2/4]

void ofCurveVertex ( const glm::vec3 &  p)

◆ ofCurveVertex() [3/4]

void ofCurveVertex ( float  x,
float  y 
)

Specifies a single point of a shape. The difference from ofVertex is that the line describing the edge of the shape between two points will be a curve as opposed to a straight line. The curve is automatically generated using the catmull from formula.

This function has to be called between ofBeginShape() and ofEndShape().

◆ ofCurveVertex() [4/4]

void ofCurveVertex ( float  x,
float  y,
float  z 
)

◆ ofCurveVertices() [1/4]

void ofCurveVertices ( const vector< glm::vec2 > &  curvePoints)

◆ ofCurveVertices() [2/4]

void ofCurveVertices ( const vector< glm::vec3 > &  curvePoints)

◆ ofCurveVertices() [3/4]

void ofCurveVertices ( const vector< ofVec2f > &  curvePoints)

◆ ofCurveVertices() [4/4]

void ofCurveVertices ( const vector< ofVec3f > &  curvePoints)

◆ ofDisableAlphaBlending()

void ofDisableAlphaBlending ( )

Turn off alpha blending.

void ofApp::draw(){
ofEnableAlphaBlending(); // turn on alpha blending
ofSetColor(255,0,0,127); // red, 50% transparent
ofDrawRectangle(20,20,100,100); // draws the rect with alpha
ofDisableAlphaBlending(); // turn off alpha
ofDrawRectangle(120,20,100,100); // draws the rect without alpha
}
void ofEnableAlphaBlending()
Turns on alpha blending (which is on by default since OF version 0.8.0). It simply wraps opengl comma...
Definition ofGraphics.cpp:593
void ofDisableAlphaBlending()
Turn off alpha blending.
Definition ofGraphics.cpp:598
void ofDrawRectangle(const ofRectangle &r)
Draws an rectangle from the given rectangle.
Definition ofGraphics.cpp:746
void ofSetColor(const ofColor &color)
Definition ofGraphics.cpp:531
See also
ofEnableAlphaBlending()

◆ ofDisableAntiAliasing()

void ofDisableAntiAliasing ( )

Turns off anti-aliasing (smoothing).

◆ ofDisableBlendMode()

void ofDisableBlendMode ( )

Disable the current blend mode.

◆ ofDisableDepthTest()

void ofDisableDepthTest ( )

Turn off depth testing so rendering happens in draw order rather than by z-depth.

Turning off depth test is useful for combining 3d scenes with 2d overlays such as a control panel.

void ofApp::draw(){
ofSetColor(255);
ofDrawSphere(0,0,100,60);
ofSetColor(255,0,255);
ofDrawSphere(50,0,50,100);
ofDrawRectangle(75,75,120,30);
ofSetColor(255);
ofDrawBitmapString("Some bubbles.",85,90);
}
void ofDrawSphere(float x, float y, float radius)
Draw a sphere with the current renderer.
Definition of3dGraphics.cpp:579
int ofGetWidth()
Definition ofAppRunner.cpp:405
int ofGetHeight()
Definition ofAppRunner.cpp:409
void ofPushMatrix()
Saves the current coordinate system allowing users to develop specific movements in some graphic obje...
Definition ofGraphics.cpp:125
void ofPopMatrix()
Restores the prior coordinate system.
Definition ofGraphics.cpp:130
void ofDrawBitmapString(const string &textString, float x, float y, float z)
Definition ofGraphics.cpp:1177
void ofDisableDepthTest()
Turn off depth testing so rendering happens in draw order rather than by z-depth.
Definition ofGraphics.cpp:516
void ofTranslate(const glm::vec3 &p)
Definition ofGraphics.cpp:162
void ofEnableDepthTest()
Turns on depth testing so rendering happens according to z-depth rather than draw order.
Definition ofGraphics.cpp:511
See also
ofEnableDepthTest()

◆ ofDisablePointSprites()

void ofDisablePointSprites ( )

Turn off point sprites.

◆ ofDisableSmoothing()

void ofDisableSmoothing ( )

Turn off smoothing. Currently, this only works for lines. You can draw a filled object, and then draw the outline with smoothing enabled to get smoothing effects on filled shapes.

◆ ofDrawBezier() [1/2]

void ofDrawBezier ( float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

◆ ofDrawBezier() [2/2]

void ofDrawBezier ( float  x0,
float  y0,
float  z0,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofDrawBitmapString() [1/3]

template<>
void ofDrawBitmapString ( const std::string &  textString,
const glm::vec2 &  p 
)

◆ ofDrawBitmapString() [2/3]

template<>
void ofDrawBitmapString ( const std::string &  textString,
const glm::vec3 &  p 
)

◆ ofDrawBitmapString() [3/3]

template<>
void ofDrawBitmapString ( const string &  textString,
float  x,
float  y,
float  z 
)

◆ ofDrawBitmapStringHighlight() [1/3]

void ofDrawBitmapStringHighlight ( string  text,
const glm::vec2 &  position,
const ofColor background,
const ofColor foreground 
)

◆ ofDrawBitmapStringHighlight() [2/3]

void ofDrawBitmapStringHighlight ( string  text,
const glm::vec3 &  position,
const ofColor background,
const ofColor foreground 
)

◆ ofDrawBitmapStringHighlight() [3/3]

void ofDrawBitmapStringHighlight ( string  text,
int  x,
int  y,
const ofColor background,
const ofColor foreground 
)

◆ ofDrawCircle() [1/4]

void ofDrawCircle ( const glm::vec2 &  p,
float  radius 
)

◆ ofDrawCircle() [2/4]

void ofDrawCircle ( const glm::vec3 &  p,
float  radius 
)

◆ ofDrawCircle() [3/4]

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

Draws a circle, centered at x,y, with a given radius.

void ofApp::draw(){
ofDrawCircle(150,150,100);
}
void ofDrawCircle(const glm::vec3 &p, float radius)
Definition ofGraphics.cpp:686

Please keep in mind that drawing circle with different outline color and fill requires calling ofNoFill and ofSetColor for drawing stroke and ofFill and again ofSetColor for filled solid color circle.

◆ ofDrawCircle() [4/4]

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

◆ ofDrawCurve() [1/2]

void ofDrawCurve ( float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

Draws a curve from point (x1, y1) to point (x2, y2). The curve is shaped by the two control points (x0,y0) and (x3,y3).

◆ ofDrawCurve() [2/2]

void ofDrawCurve ( float  x0,
float  y0,
float  z0,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

Draws a 3-dimensional curve from point (x1, y1, z1) to point (x2, y2, z2). The curve is shaped by the two control points (x0, y0, z0) and (x3, y3, z3).

◆ ofDrawEllipse() [1/4]

void ofDrawEllipse ( const glm::vec2 &  p,
float  width,
float  height 
)

◆ ofDrawEllipse() [2/4]

void ofDrawEllipse ( const glm::vec3 &  p,
float  width,
float  height 
)

◆ ofDrawEllipse() [3/4]

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

Draws an ellipse from point (x,y) with a given width (w) and height (h).

void ofApp::draw(){
ofDrawEllipse(10,10,50,30);
}
void ofDrawEllipse(const glm::vec3 &p, float width, float height)
Definition ofGraphics.cpp:706

◆ ofDrawEllipse() [4/4]

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

◆ ofDrawLine() [1/4]

void ofDrawLine ( const glm::vec2 &  p1,
const glm::vec2 &  p2 
)

◆ ofDrawLine() [2/4]

void ofDrawLine ( const glm::vec3 &  p1,
const glm::vec3 &  p2 
)

◆ ofDrawLine() [3/4]

void ofDrawLine ( float  x1,
float  y1,
float  x2,
float  y2 
)

Draws a line between two points: (x1,y1),(x2,y2).

void ofApp::draw(){
ofDrawLine(10,10,100,100);
}
void ofDrawLine(const glm::vec3 &p1, const glm::vec3 &p2)
Definition ofGraphics.cpp:726

◆ ofDrawLine() [4/4]

void ofDrawLine ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

◆ ofDrawRectangle() [1/5]

void ofDrawRectangle ( const glm::vec2 &  p,
float  w,
float  h 
)

◆ ofDrawRectangle() [2/5]

void ofDrawRectangle ( const glm::vec3 &  p,
float  w,
float  h 
)

Draws an rectangle from point p, with a given width and height.

void ofApp::draw(){
glm::vec3 p; // create a point P
p.x = 10; // set the x of the point
p.y = 10; // set the y of the point
ofDrawRectangle(p, 80, 80); // Draw the rectangle
}

◆ ofDrawRectangle() [3/5]

void ofDrawRectangle ( const ofRectangle r)

Draws an rectangle from the given rectangle.

void ofApp::draw(){
rect.x = 10;
rect.y = 10;
rect.width = 100;
rect.height = 100;
}
A class representing a 2D rectangle.
Definition ofRectangle.h:87
float & y
The y position of the ofRectangle.
Definition ofRectangle.h:929
float & x
The x position of the ofRectangle.
Definition ofRectangle.h:926
float width
The width of the ofRectangle.
Definition ofRectangle.h:932
float height
The height of the ofRectangle.
Definition ofRectangle.h:935

◆ ofDrawRectangle() [4/5]

void ofDrawRectangle ( float  x1,
float  y1,
float  w,
float  h 
)

Draws a rectangle from point x,y with a given width and height.

void ofApp::draw(){
ofDrawRect(10,10,100,100);
}

◆ ofDrawRectangle() [5/5]

void ofDrawRectangle ( float  x,
float  y,
float  z,
float  w,
float  h 
)

Draws an rectangle from point X, Y at depth Z with a given width and height.

void ofApp::draw(){
ofDrawRectangle(10,10,-100, 80, 80); // Draw a rectangle at 100 pixels in depth
}

◆ ofDrawRectRounded() [1/9]

void ofDrawRectRounded ( const glm::vec2 &  p,
float  w,
float  h,
float  r 
)

◆ ofDrawRectRounded() [2/9]

void ofDrawRectRounded ( const glm::vec2 &  p,
float  w,
float  h,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

◆ ofDrawRectRounded() [3/9]

void ofDrawRectRounded ( const glm::vec3 &  p,
float  w,
float  h,
float  r 
)

Draws a rectangle from point p with a given width, height and radius of rounded corners.

void ofApp::draw(){
p.set ( 10, 10 );
ofDrawRectRounded( p, 100, 100, 10 );
}
ofVec3f is a class for storing a three dimensional vector.
Definition ofVec3f.h:79
void set(float x, float y, float z=0)
Set 'x', 'y' and 'z' components of this vector with just one function call. 'z' is optional,...
void ofDrawRectRounded(const ofRectangle &b, float r)
Draws a rounded rectangle from the given rectangle using given radius.
Definition ofGraphics.cpp:771

◆ ofDrawRectRounded() [4/9]

void ofDrawRectRounded ( const glm::vec3 &  p,
float  w,
float  h,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

Draws a rounded rectangle from point X, Y, at depth Z with a given width, height and radius of rounded corners.

void ofApp::draw(){
ofDrawRectRounded(10, 10, 10, 100, 100, 10);
}

◆ ofDrawRectRounded() [5/9]

void ofDrawRectRounded ( const ofRectangle b,
float  r 
)

Draws a rounded rectangle from the given rectangle using given radius.

void ofApp::draw(){
ofRectangle myRect;
myRect.x = 10;
myRect.y = 10;
myRect.width = 100;
myRect.height = 100;
ofDrawRectRounded(myRect, 10);
}

◆ ofDrawRectRounded() [6/9]

void ofDrawRectRounded ( const ofRectangle b,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

Draws a rounded rectangle from the given rectangle using different given radius for each of the corners.

void ofApp::draw(){
ofRectangle myRect;
myRect.x = 10;
myRect.y = 10;
myRect.width = 100;
myRect.height = 100;
ofDrawRectRounded( myRect, 10, 20, 30, 40 );
}

◆ ofDrawRectRounded() [7/9]

void ofDrawRectRounded ( float  x,
float  y,
float  w,
float  h,
float  r 
)

Draws a rectangle from point X, Y with a given width, height and radius of rounded corners.

void ofApp::draw(){
ofDrawRectRounded(10, 10, 100, 100, 10);
}

◆ ofDrawRectRounded() [8/9]

void ofDrawRectRounded ( float  x,
float  y,
float  z,
float  w,
float  h,
float  r 
)

Draws a rectangle from point X, Y, at depth Z with a given width, height and radius of rounded corners.

void ofApp::draw(){
ofDrawRectRounded(10, 10, 10, 100, 100, 10);
}

◆ ofDrawRectRounded() [9/9]

void ofDrawRectRounded ( float  x,
float  y,
float  z,
float  w,
float  h,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

Draws a rounded rectangle from point X, Y, at depth Z with a given width, height and different radius for each rounded corner.

void ofApp::draw(){
ofDrawRectRounded(10, 10, 10, 100, 100, 10, 20, 30, 40);
}

◆ ofDrawTriangle() [1/4]

void ofDrawTriangle ( const glm::vec2 &  p1,
const glm::vec2 &  p2,
const glm::vec2 &  p3 
)

◆ ofDrawTriangle() [2/4]

void ofDrawTriangle ( const glm::vec3 &  p1,
const glm::vec3 &  p2,
const glm::vec3 &  p3 
)

◆ ofDrawTriangle() [3/4]

void ofDrawTriangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

Draws a triangle, with the three points: (x1,y1),(x2, y2),(x3, y3).

void ofApp::draw(){
ofDrawTriangle(50,10,10,40,90,40);
}
void ofDrawTriangle(const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec3 &p3)
Definition ofGraphics.cpp:666

◆ ofDrawTriangle() [4/4]

void ofDrawTriangle ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofEllipse() [1/3]

void ofEllipse ( const glm::vec3 &  p,
float  width,
float  height 
)

◆ ofEllipse() [2/3]

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

◆ ofEllipse() [3/3]

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

◆ ofEnableAlphaBlending()

void ofEnableAlphaBlending ( )

Turns on alpha blending (which is on by default since OF version 0.8.0). It simply wraps opengl commands that enable blending, and turn on a common blend mode.

void ofApp::draw(){
ofEnableAlphaBlending(); // turn on alpha blending
ofSetColor(255,0,0,127); // red, 50% transparent
ofDrawRectangle(20,20,100,100); // draws the rect with alpha
ofDisableAlphaBlending(); // turn off alpha
ofDrawRectangle(120,20,100,100); // draws the rect without alpha
}

◆ ofEnableAntiAliasing()

void ofEnableAntiAliasing ( )

Enables anti-aliasing (smoothing) for lines.

◆ ofEnableBlendMode()

void ofEnableBlendMode ( ofBlendMode  blendMode)

Sets and enables the blend mode for drawing. The options are:

OF_BLENDMODE_DISABLED
OF_BLENDMODE_ALPHA
OF_BLENDMODE_ADD
OF_BLENDMODE_SUBTRACT
OF_BLENDMODE_MULTIPLY
OF_BLENDMODE_SCREEN

There is a blendingExample in the openFrameworks examples > graphics

◆ ofEnableDepthTest()

void ofEnableDepthTest ( )

Turns on depth testing so rendering happens according to z-depth rather than draw order.

See also
ofDisableDepthTest()

◆ ofEnablePointSprites()

void ofEnablePointSprites ( )

Turn on point sprite.

Textures can be mapped onto points. By default, point size is 1pt. So texture is not shown correctly. You can change point size by `glPointSize(GLfloat size).

◆ ofEnableSmoothing()

void ofEnableSmoothing ( )

◆ ofEndShape()

void ofEndShape ( bool  bClose = false)

This tells the program that your shape is finished and that it should now draw it to the screen.

This function must be called otherwise you will not see your shape.

Parameters
bCloseIf you set it to true it will automatically close your shape for you. Default false.

◆ ofFill()

void ofFill ( )

Draw shapes filled with the current draw color.

void ofApp::draw(){
ofSetColor(0,0,255);
ofFill();
ofDrawRect(10,10,100,100); //draws the rectangle filled in blue
}
void ofFill()
Draw shapes filled with the current draw color.
Definition ofGraphics.cpp:490

◆ ofGetBackground()

ofColor ofGetBackground ( )

◆ ofGetBackgroundAuto()

bool ofGetBackgroundAuto ( )

◆ ofGetBackgroundColor()

ofColor ofGetBackgroundColor ( )

Returns the current background color as an ofColor.

◆ ofGetCoordHandedness()

ofHandednessType ofGetCoordHandedness ( )

◆ ofGetCurrentMatrix()

glm::mat4 ofGetCurrentMatrix ( ofMatrixMode  matrixMode_)

Queries the current OpenGL matrix state @detail Returns the specified matrix as held by the renderer's current matrix stack.

Query the current (oF internal) Transformation Matrix state.

    You can query one of the following:

    [OF_MATRIX_MODELVIEW | OF_MATRIX_PROJECTION | OF_MATRIX_TEXTURE]

    Each query will return the state of the matrix
    as it was uploaded to the shader currently bound.
Parameters
matrixMode_Which matrix mode to query

◆ ofGetCurrentNormalMatrix()

glm::mat4 ofGetCurrentNormalMatrix ( )

Query the current (oF internal) Normal Matrix state.

Note
The matrix returned is the transposed of the inverse of the view matrix

Currently, only GL Programmable Renderer and GL Renderer implement ofGetCurrentNormalMatrix.

◆ ofGetCurrentOrientationMatrix()

glm::mat4 ofGetCurrentOrientationMatrix ( )

Query the current (oF internal) Orientation Matrix state.

Note
The matrix returned is the matrix openFrameworks uses internally to calculate the (final, oriented) projection matrix as it is passed on to the GPU.

Currently, only GL Programmable Renderer and GL Renderer implement ofGetCurrentOrientationMatrix.

◆ ofGetCurrentViewMatrix()

glm::mat4 ofGetCurrentViewMatrix ( )

◆ ofGetCurrentViewport()

ofRectangle ofGetCurrentViewport ( )

Get the position and size of the current viewport.

Returns
A rectangle describing the viewport

◆ ofGetFill()

ofFillFlag ofGetFill ( )

◆ ofGetNativeViewport()

ofRectangle ofGetNativeViewport ( )

Get the position and size of the native viewport.

Returns
A rectangle describing the viewport

◆ ofGetRectMode()

ofRectMode ofGetRectMode ( )

Tells you if rectangle drawing mode is set to drawn from the center or drawn from the top left corner, as set with the ofSetRectMode() function.

Default is OF_RECTMODE_CORNER

void ofApp::draw(){
ofDrawRectangle(10,10,80,80);
}
else {
ofDrawRectangle(50,50,80,80);
}
}
ofRectMode ofGetRectMode()
Tells you if rectangle drawing mode is set to drawn from the center or drawn from the top left corner...
Definition ofGraphics.cpp:480
@ OF_RECTMODE_CORNER
Represents the mode where rectangles draw from the top left.
Definition ofGraphicsConstants.h:141
See also
ofSetRectMode()

◆ ofGetStyle()

ofStyle ofGetStyle ( )

◆ ofGetViewportHeight()

int ofGetViewportHeight ( )

Get the height of the current viewport.

Returns
A height in pixels

◆ ofGetViewportWidth()

int ofGetViewportWidth ( )

Get the width of the current viewport.

Returns
A width in pixels

◆ ofIsVFlipped()

bool ofIsVFlipped ( )

Get if view is flipped vertically.

◆ ofLine() [1/3]

void ofLine ( const glm::vec3 &  p1,
const glm::vec3 &  p2 
)

◆ ofLine() [2/3]

void ofLine ( float  x1,
float  y1,
float  x2,
float  y2 
)

◆ ofLine() [3/3]

void ofLine ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

◆ ofLoadIdentityMatrix()

void ofLoadIdentityMatrix ( void  )

◆ ofLoadMatrix() [1/2]

void ofLoadMatrix ( const float *  m)

◆ ofLoadMatrix() [2/2]

void ofLoadMatrix ( const glm::mat4 &  m)

◆ ofLoadViewMatrix()

void ofLoadViewMatrix ( const glm::mat4 &  m)

◆ ofMultMatrix() [1/2]

void ofMultMatrix ( const float *  m)

◆ ofMultMatrix() [2/2]

void ofMultMatrix ( const glm::mat4 &  m)

◆ ofMultViewMatrix()

void ofMultViewMatrix ( const glm::mat4 &  m)

◆ ofNextContour()

void ofNextContour ( bool  bClose = false)

Allows you to draw multiple contours within one shape. Call this between ofBeginShape() and ofEndShape() to create a new contour for your shape.

Parameters
bCloseIf set to true then the previous contour will be automatically closed. Default false

◆ ofNoFill()

void ofNoFill ( )

Draw shapes as outlines with the current draw color.

void ofApp::draw(){
ofSetColor(0,0,255);
ofDrawRectangle(10,10,100,100); //draws only the outline in blue
}
void ofNoFill()
Draw shapes as outlines with the current draw color.
Definition ofGraphics.cpp:485

◆ ofOrientationToDegrees()

int ofOrientationToDegrees ( ofOrientation  orientation)

◆ ofPopMatrix()

void ofPopMatrix ( )

Restores the prior coordinate system.

See also
ofPushMatrix()

◆ ofPopStyle()

void ofPopStyle ( )

Restores the prior style settings. It needs to be called after ofPushStyle.

See also
ofPushStyle()

◆ ofPopView()

void ofPopView ( )

Restores the viewport and matrix settings set by ofPushView()

◆ ofPushMatrix()

void ofPushMatrix ( )

Saves the current coordinate system allowing users to develop specific movements in some graphic objects. ofPopMatrix needs to be called after.

In the following example we only rotate the square.

void ofApp::draw(){
ofPushMatrix(); // push the current coordinate position
ofRotateX(90); // change the coordinate system
ofDrawRectangle(10,10,40,40); // draw a rect
ofPopMatrix() // recall the pushed coordinate position
ofDrawCircle(10, 10, 5); // draw a circle
}
void ofRotateX(float degrees)
Definition ofGraphics.cpp:202

◆ ofPushStyle()

void ofPushStyle ( )

Saves the current style settings for the ofGraphics after its call. Usage of ofPushStyle and ofPopStyle allow users to have more control of certain graphics elements. All the style that applies to certain elements is controled using ofStyle class. See ofStyle type.

In the following example the properties of being red and filled only applies to the ellipse:

void ofApp::draw(){
ofPushStyle(); // push the current style for use later
ofFill();
ofSetColor(255,0,0);
ofDrawEllipse(30,10,40,40);
ofPopStyle(); // recall the pushed style
ofDrawCircle(10,10,5);
}
void ofPushStyle()
Saves the current style settings for the ofGraphics after its call. Usage of ofPushStyle and ofPopSty...
Definition ofGraphics.cpp:645
void ofPopStyle()
Restores the prior style settings. It needs to be called after ofPushStyle.
Definition ofGraphics.cpp:650

sa ofPopStyle()

◆ ofPushView()

void ofPushView ( )

Stores the current viewport and matrix settings.

◆ ofRect() [1/4]

void ofRect ( const glm::vec3 &  p,
float  w,
float  h 
)

◆ ofRect() [2/4]

void ofRect ( const ofRectangle r)

◆ ofRect() [3/4]

void ofRect ( float  x,
float  y,
float  w,
float  h 
)

◆ ofRect() [4/4]

void ofRect ( float  x,
float  y,
float  z,
float  w,
float  h 
)

◆ ofRectRounded() [1/7]

void ofRectRounded ( const glm::vec3 &  p,
float  w,
float  h,
float  r 
)

◆ ofRectRounded() [2/7]

void ofRectRounded ( const glm::vec3 &  p,
float  w,
float  h,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

◆ ofRectRounded() [3/7]

void ofRectRounded ( const ofRectangle b,
float  r 
)

◆ ofRectRounded() [4/7]

void ofRectRounded ( const ofRectangle b,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

◆ ofRectRounded() [5/7]

void ofRectRounded ( float  x,
float  y,
float  w,
float  h,
float  r 
)

◆ ofRectRounded() [6/7]

void ofRectRounded ( float  x,
float  y,
float  z,
float  w,
float  h,
float  r 
)

◆ ofRectRounded() [7/7]

void ofRectRounded ( float  x,
float  y,
float  z,
float  w,
float  h,
float  topLeftRadius,
float  topRightRadius,
float  bottomRightRadius,
float  bottomLeftRadius 
)

◆ ofRotate() [1/2]

void ofRotate ( float  degrees)

◆ ofRotate() [2/2]

void ofRotate ( float  degrees,
float  vecX,
float  vecY,
float  vecZ 
)

◆ ofRotateDeg() [1/2]

void ofRotateDeg ( float  degrees)

Rotate around the z-axis.

◆ ofRotateDeg() [2/2]

void ofRotateDeg ( float  degrees,
float  vecX,
float  vecY,
float  vecZ 
)

Produces a rotation around the vector (vecX,vecY,vecZ).

All graphics drawn after ofRotate is called are rotated. Use ofPushMatrix() and ofPopMatrix() to save and restore the unrotated coordinate system.

void ofApp::draw(){
ofRotateDeg(50, 1, 0.5, 0); //rotates the coordinate system 50 degrees along the x-axis and 25 degrees on the y-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateDeg(float degrees)
Rotate around the z-axis.
Definition ofGraphics.cpp:218
Parameters
degreesSpecifies the angle of rotation, in degrees.
vecXspecifies the x coordinates of a vector
vecYspecifies the y coordinates of a vector
vecZspecifies the z coordinates of a vector

◆ ofRotateRad() [1/2]

void ofRotateRad ( float  radians)

Rotate around the z-axis.

◆ ofRotateRad() [2/2]

void ofRotateRad ( float  radians,
float  vecX,
float  vecY,
float  vecZ 
)

Produces a rotation around the vector (vecX,vecY,vecZ).

All graphics drawn after ofRotate is called are rotated. Use ofPushMatrix() and ofPopMatrix() to save and restore the unrotated coordinate system.

void ofApp::draw(){
ofRotateRad(M_PI / 2.0f, 1, 0.5, 0); //rotates the coordinate system M_PI / 2.0f radians along the x-axis and M_PI / 4.0f degrees on the y-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateRad(float radians)
Rotate around the z-axis.
Definition ofGraphics.cpp:244
Parameters
radiansSpecifies the angle of rotation, in radians.
vecXspecifies the x coordinates of a vector
vecYspecifies the y coordinates of a vector
vecZspecifies the z coordinates of a vector

◆ ofRotateX()

void ofRotateX ( float  degrees)

◆ ofRotateXDeg()

void ofRotateXDeg ( float  degrees)

Produces a rotation around the X-axis of our coordinate system represented by the vector (1,0,0).

void ofApp::draw(){
ofRotateXDeg(45); //rotates the coordinate system 45 degrees around the x-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateXDeg(float degrees)
Produces a rotation around the X-axis of our coordinate system represented by the vector (1,...
Definition ofGraphics.cpp:228
Parameters
degreesSpecifies the angle of rotation, in degrees.

◆ ofRotateXRad()

void ofRotateXRad ( float  radians)

Produces a rotation around the X-axis of our coordinate system represented by the vector (1,0,0).

void ofApp::draw(){
ofRotateXRad(M_PI / 4.0f); //rotates the coordinate system M_PI / 4.0f radians around the x-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateXRad(float radians)
Produces a rotation around the X-axis of our coordinate system represented by the vector (1,...
Definition ofGraphics.cpp:254
Parameters
degreesSpecifies the angle of rotation, in radians.

◆ ofRotateY()

void ofRotateY ( float  degrees)

◆ ofRotateYDeg()

void ofRotateYDeg ( float  degrees)

Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,1,0).

void ofApp::draw(){
ofRotateYDeg(45); //rotates the coordinate system 45 degrees around the y-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateYDeg(float degrees)
Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,...
Definition ofGraphics.cpp:233
Parameters
degreesSpecifies the angle of rotation, in degrees.

◆ ofRotateYRad()

void ofRotateYRad ( float  radians)

Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,1,0).

void ofApp::draw(){
ofRotateYRad(M_PI / 4.0f); //rotates the coordinate system M_PI / 4.0f radians around the y-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateYRad(float radians)
Produces a rotation around the Y-axis of our coordinate system represented by the vector (0,...
Definition ofGraphics.cpp:259
Parameters
degreesSpecifies the angle of rotation, in radians.

◆ ofRotateZ()

void ofRotateZ ( float  degrees)

◆ ofRotateZDeg()

void ofRotateZDeg ( float  degrees)

Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,0,1).

void ofApp::draw(){
ofRotateZDeg(45); //rotates the coordinate system 45 degrees around the z-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateZDeg(float degrees)
Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,...
Definition ofGraphics.cpp:238
Parameters
degreesSpecifies the angle of rotation, in degrees.

◆ ofRotateZRad()

void ofRotateZRad ( float  radians)

Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,0,1).

void ofApp::draw(){
ofRotateZRad(M_PI / 4.0f); //rotates the coordinate system M_PI / 4.0f radians degrees around the z-axis
ofDrawRectangle(20,20,100,100);
}
void ofRotateZRad(float radians)
Produces a rotation around the Z-axis of our coordinate system represented by the vector (0,...
Definition ofGraphics.cpp:264
Parameters
degreesSpecifies the angle of rotation, in radians.

◆ ofScale() [1/3]

void ofScale ( const glm::vec3 &  p)

◆ ofScale() [2/3]

void ofScale ( float  amount)

Scale along the X, Y and Z axis with the same amount.

◆ ofScale() [3/3]

void ofScale ( float  xAmnt,
float  yAmnt,
float  zAmnt 
)

◆ ofSetBackgroundAuto()

void ofSetBackgroundAuto ( bool  bManual)

Sets the background clearing function to be auto (default) or not. If non- auto, then background clearing will not occur per frame (at the start of draw) but rather, whenever ofBackground is called.

void ofApp::setup(){
ofSetBackgroundAuto(false); //disable automatic background redraw
}
void ofApp::draw(){
if(ofGetFrameNum() % 10 == 0){
// draws a black background every 10 frames
}
}
uint64_t ofGetFrameNum()
Definition ofEvents.cpp:50
void ofSetBackgroundColor(int brightness, int alpha)
Definition ofGraphics.cpp:446
void ofSetBackgroundAuto(bool bAuto)
Sets the background clearing function to be auto (default) or not. If non- auto, then background clea...
Definition ofGraphics.cpp:338

◆ ofSetBackgroundColor() [1/3]

void ofSetBackgroundColor ( const ofColor c)

◆ ofSetBackgroundColor() [2/3]

void ofSetBackgroundColor ( int  brightness,
int  alpha 
)

◆ ofSetBackgroundColor() [3/3]

void ofSetBackgroundColor ( int  r,
int  g,
int  b,
int  a = 255 
)

Sets the background color. It takes as input r,g,b (0-255). The background is cleared automatically, just before the draw() command, so if the background color is not changing, you could call this inside setup() (once, at the start of the application). If the background color is changing, you can call this inside update().

void ofApp::setup(){
ofSetBackgroundColor(255,0,0); // Sets the background color to red
}

◆ ofSetBackgroundColorHex()

void ofSetBackgroundColorHex ( int  hexColor,
int  alpha = 255 
)

Sets the background color using a hex color value.

void ofApp::setup(){
ofSetBackgroundColorHex(0xff0000); // Sets the background color to red
}
void ofSetBackgroundColorHex(int hexColor, int alpha)
Sets the background color using a hex color value.
Definition ofGraphics.cpp:451

◆ ofSetCircleResolution()

void ofSetCircleResolution ( int  res)

Sets the resolution for the ofDrawCircle command. By default, the circle is 22 points, but if you need to draw larger circles, you can adjust the resolution using this command. All circles are cached in openGL using a display list for optimization purposes.

void ofApp::draw(){
ofDrawCircle(150,150,100); //draws a rough circle
ofDrawCircle(450,150,100); //draws a fine circle
}
void ofSetCircleResolution(int res)
Sets the resolution for the ofDrawCircle command. By default, the circle is 22 points,...
Definition ofGraphics.cpp:526

◆ ofSetColor() [1/5]

void ofSetColor ( const ofColor color)

◆ ofSetColor() [2/5]

void ofSetColor ( const ofColor color,
int  _a 
)

◆ ofSetColor() [3/5]

void ofSetColor ( int  gray)

◆ ofSetColor() [4/5]

void ofSetColor ( int  r,
int  g,
int  b 
)

Sets the draw color with r,g,b, 0-255. For example, red would be: ofSetColor(255,0,0). This affects not only the color of shapes drawn with ofDrawRectangle(), ofDrawCircle(), etc, but also the tint of images and textures.

void ofApp::draw(){
ofSetColor(0,0,255); //set the color to blue
ofDrawRectangle(10,10,100,100);
}

◆ ofSetColor() [5/5]

void ofSetColor ( int  r,
int  g,
int  b,
int  a 
)

Sets the draw color with r,g,b,a 0-255.

For alpha (transparency), you must first enable transparent blending (turned off by default for performance reasons) with ofEnableAlphaBlending()

void ofApp::draw(){
ofEnableAlphaBlending(); // turn on alpha blending
ofSetColor(255,0,0,127); // red, 50% transparent
ofDrawRectangle(20,20,100,100);
ofDisableAlphaBlending(); // turn it back off, if you don't need it
}

◆ ofSetCoordHandedness()

void ofSetCoordHandedness ( ofHandednessType  handedness)

◆ ofSetCurrentRenderer()

void ofSetCurrentRenderer ( shared_ptr< ofBaseRenderer renderer,
bool  setDefaults 
)

◆ ofSetCurveResolution()

void ofSetCurveResolution ( int  res)

◆ ofSetDepthTest()

void ofSetDepthTest ( bool  depthTest)

Set depth testing on or off to either sort by z-depth (true) or draw order (false).

◆ ofSetDrawBitmapMode()

void ofSetDrawBitmapMode ( ofDrawBitmapMode  mode)

Set the bitmap drawing mode.

Valid modes:

OF_BITMAPMODE_SCREEN: this is the default mode. It projects the 3d prosition onto the screen so the letters always look the same size but can be positioned in any 3d coordinate.

OF_BITMAPMODE_VIEWPORT: does the same as screen but uses the current viewport instead of the full window if it's different.

OF_BITMAPMODE_MODEL: uses real 3d coordinates so the text will look scaled if it's not in z=0

OF_BITMAPMODE_MODEL_BILLBOARD: uses real 3d coordinates but the text always faces the camera.

OF_BITMAPMODE_SIMPLE: only does 2d and the z coordinate is just disacarded, so if z is not 0 the position in which it'll be drawn will be wrong.

◆ ofSetHexColor()

void ofSetHexColor ( int  hexColor)

Sets the draw color with r,g,b, passed in as a hex. Hex is a conventient way to write colors.

void ofApp::draw(){
ofSetColor(0xffffff); // white (255,255,255)
ofSetColor(0x000000); // black (0,0,0);
ofSetColor(0x00ff00); // green (0,255,0);
}

◆ ofSetLineWidth()

void ofSetLineWidth ( float  lineWidth)

Sets the width of the ofDrawLine() called after.

void ofApp::draw(){
ofSetLineWidth(1); // set line width to 1
ofDrawLine(10,10,100,100); // draw thin line
ofSetLineWidth(10); // set line width to 10
ofDrawLine(10,100,100,10); // draw fat line
}
void ofSetLineWidth(float lineWidth)
Sets the width of the ofDrawLine() called after.
Definition ofGraphics.cpp:501

◆ ofSetMatrixMode()

void ofSetMatrixMode ( ofMatrixMode  matrixMode)

◆ ofSetPolyMode()

void ofSetPolyMode ( ofPolyWindingMode  mode)

Sets the drawing behavior for overlapping parts of the same polygon.

Possible modes are:

OF_POLY_WINDING_ODD
OF_POLY_WINDING_NONZERO
OF_POLY_WINDING_POSITIVE
OF_POLY_WINDING_NEGATIVE
OF_POLY_WINDING_ABS_GEQ_TWO 

◆ ofSetRectMode()

void ofSetRectMode ( ofRectMode  mode)

Sets the mode for drawing rectangles and other rectangular objects, if they are corner aligned, or drawn so that the x,y position is the center of the rectangle. possible options are OF_RECTMODE_CENTER and OF_RECTMODE_CORNER. This affects not only how ofDrawRectangle() objects are drawn, but also ofTexture (and therefore ofImage) objects.

void ofApp::draw(){
ofSetRectMode(OF_RECTMODE_CORNER); //set rectangle mode to the corner
ofDrawRectangle(10,10,80,80);
ofSetRectMode(OF_RECTMODE_CENTER); //set rectangle mode to the center
ofDrawRectangle(50,50,80,80);
// both rectangles are drawn at the same place
}
void ofSetRectMode(ofRectMode mode)
Sets the mode for drawing rectangles and other rectangular objects, if they are corner aligned,...
Definition ofGraphics.cpp:475
@ OF_RECTMODE_CENTER
Represents the mode where rectangles draw from the center.
Definition ofGraphicsConstants.h:143

◆ ofSetStyle()

void ofSetStyle ( ofStyle  style)

Set the current style of the ofGraphics.

Parameters
stylecontains information of the graphics style such as ofColor, ofFill, polyMode and others.
See also
See ofStyle for more details.

◆ ofSetupGraphicDefaults()

void ofSetupGraphicDefaults ( )

Resets openGL screen coordinates and values back to OF defaults.

◆ ofSetupScreen()

void ofSetupScreen ( )

◆ ofSetupScreenOrtho()

void ofSetupScreenOrtho ( float  width,
float  height,
float  nearDist,
float  farDist 
)

◆ ofSetupScreenPerspective()

void ofSetupScreenPerspective ( float  width,
float  height,
float  fov,
float  nearDist,
float  farDist 
)

◆ ofTranslate() [1/3]

void ofTranslate ( const glm::vec2 &  p)

◆ ofTranslate() [2/3]

void ofTranslate ( const glm::vec3 &  p)

◆ ofTranslate() [3/3]

void ofTranslate ( float  x,
float  y,
float  z = 0 
)

Translate by (x,y,z) vector of our coordinate system. The call of ofTranslate() modifies graphics positions.

Use ofPushMatrix() and ofPopMatrix() to save and restore the untranslated coordinate system.

void ofApp::draw(){
ofTranslate(100, 100, 0); // move the coordinate system to position x 100 and y 100 and make that zero.
ofDrawRectangle(0, 0, 10, 10); // draw a rect at that position
}

◆ ofTriangle() [1/3]

void ofTriangle ( const glm::vec3 &  p1,
const glm::vec3 &  p2,
const glm::vec3 &  p3 
)

◆ ofTriangle() [2/3]

void ofTriangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)

◆ ofTriangle() [3/3]

void ofTriangle ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float  x3,
float  y3,
float  z3 
)

◆ ofVertex() [1/4]

void ofVertex ( const glm::vec2 &  p)

◆ ofVertex() [2/4]

void ofVertex ( const glm::vec3 &  p)

◆ ofVertex() [3/4]

void ofVertex ( float  x,
float  y 
)

Specifies a single point of a shape. To be called between ofBeginShape() and ofEndShape().

◆ ofVertex() [4/4]

void ofVertex ( float  x,
float  y,
float  z 
)

◆ ofVertices() [1/4]

void ofVertices ( const vector< glm::vec2 > &  polyPoints)

◆ ofVertices() [2/4]

void ofVertices ( const vector< glm::vec3 > &  polyPoints)

◆ ofVertices() [3/4]

void ofVertices ( const vector< ofVec2f > &  polyPoints)

◆ ofVertices() [4/4]

void ofVertices ( const vector< ofVec3f > &  polyPoints)

◆ ofViewport() [1/2]

void ofViewport ( float  x = 0,
float  y = 0,
float  width = -1,
float  height = -1,
bool  vflip = ofIsVFlipped() 
)

Setup the drawing viewport.

Parameters
xThe x position of the viewport
yThe y position of the viewport
widthThe width of the viewport, defaults to ofGetWidth()
heightThe height of the viewport, defaults to ofGetHeight()

◆ ofViewport() [2/2]

void ofViewport ( ofRectangle  viewport)

Setup the drawing viewport.

Parameters
viewportA rectangle describing the size and position of the viewport. If the width or height are set to 0, it will assume the size to be the window size (ofGetWidth(), ofGetHeight())