reference

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

ofRendererCollection.h
Go to the documentation of this file.
1#pragma once
2
4#include "of3dGraphics.h"
5#include "ofPath.h"
6
8public:
11
12 static const std::string TYPE;
13 const std::string & getType(){ return TYPE; }
14
15 std::shared_ptr<ofBaseGLRenderer> getGLRenderer();
16
18
19 void startRender();
20
21 void finishRender();
22
23
25
26 void draw(const ofPolyline & poly) const;
27 void draw(const ofPath & shape) const;
28
29 void draw(const ofMesh & vertexData, ofPolyRenderMode mode, bool useColors, bool useTextures, bool useNormals) const;
30
31 void draw(const of3dPrimitive& model, ofPolyRenderMode renderType ) const ;
32
33 void draw(const ofNode& node) const ;
34
35 void draw(const ofImage & img, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const;
36
37 void draw(const ofFloatImage & img, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const;
38
39 void draw(const ofShortImage & img, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const;
40
41 void draw(const ofBaseVideoDraws & video, float x, float y, float w, float h) const;
42
43 /*void bind(const ofBaseVideoDraws & video) const{
44 for(int i=0;i<(int)renderers.size();i++){
45 renderers[i]->bind(video);
46 }
47 }
48
49 void unbind(const ofBaseVideoDraws & video) const{
50 for(int i=0;i<(int)renderers.size();i++){
51 renderers[i]->unbind(video);
52 }
53 }*/
54
55
56 glm::mat4 getCurrentMatrix(ofMatrixMode matrixMode_) const;
57
58
59 glm::mat4 getCurrentOrientationMatrix() const;
60
61 glm::mat4 getCurrentNormalMatrix() const;
62
63 //--------------------------------------------
64 // transformations
65 void pushView();
66
67 void popView();
68 // setup matrices and viewport (upto you to push and pop view before and after)
69 // if width or height are 0, assume windows dimensions (ofGetWidth(), ofGetHeight())
70 // if nearDist or farDist are 0 assume defaults (calculated based on width / height)
72
73 void viewport(float x = 0, float y = 0, float width = -1, float height = -1, bool vflip=true);
74
75 void setupScreenPerspective(float width = -1, float height = -1, float fov = 60, float nearDist = 0, float farDist = 0);
76
77 void setupScreenOrtho(float width = -1, float height = -1, float nearDist = -1, float farDist = 1);
78
80
82
83 int getViewportWidth() const;
84 int getViewportHeight() const;
85
86 void setCoordHandedness(ofHandednessType handedness);
88
89 //our openGL wrappers
90 void pushMatrix();
91 void popMatrix();
92 void translate(float x, float y, float z = 0);
93 void translate(const glm::vec3 & p);
94 void scale(float xAmnt, float yAmnt, float zAmnt = 1);
95
96 void rotateDeg(float degrees, float vecX, float vecY, float vecZ);
97 void rotateXDeg(float degrees);
98 void rotateYDeg(float degrees);
99 void rotateZDeg(float degrees);
100 void rotateDeg(float degrees);
101
102 void rotateRad(float radians, float vecX, float vecY, float vecZ);
103 void rotateXRad(float radians);
104 void rotateYRad(float radians);
105 void rotateZRad(float radians);
106 void rotateRad(float radians);
107 void loadIdentityMatrix (void);
108
109 void loadMatrix (const glm::mat4 & m);
110
111 void loadMatrix (const float * m);
112
113 void multMatrix (const glm::mat4 & m);
114
115 void multMatrix (const float * m);
116
117 void setOrientation(ofOrientation orientation, bool vflip);
118
119 bool isVFlipped() const;
120
121 void matrixMode(ofMatrixMode mode);
122
123 void loadViewMatrix(const glm::mat4& m);
124
125 void multViewMatrix(const glm::mat4& m);
126
127 glm::mat4 getCurrentViewMatrix() const;
128
129
130 // screen coordinate things / default gl values
132
133 void setupScreen();
134
135 // color options
136 void setColor(int r, int g, int b);
137
138 void setColor(int r, int g, int b, int a);
139
140 void setColor(const ofColor & color);
141
142 void setColor(const ofColor & color, int _a);
143
144 void setColor(int gray);
145
146 void setHexColor( int hexColor );
147
148 // bg color
150
151 void setBackgroundColor(const ofColor & color);
152
153 bool getBackgroundAuto();
154
155 void background(const ofColor & c);
156
157 void background(float brightness);
158
159 void background(int hexColor, float _a=255.0f);
160
161 void background(int r, int g, int b, int a=255);
162
163 void setBackgroundAuto(bool bManual);
164
165 void clear();
166
167 void clear(float r, float g, float b, float a=0);
168
169 void clear(float brightness, float a=0);
170
171 void clearAlpha();
172
173 // drawing modes
174 void setRectMode(ofRectMode mode);
175
177
178 void setFillMode(ofFillFlag fill);
179
181
182 void setLineWidth(float lineWidth);
183
184 void setDepthTest(bool depthTest);
185
186 void setBlendMode(ofBlendMode blendMode);
187 void setLineSmoothing(bool smooth);
188 void setCircleResolution(int res);
189 void enablePointSprites();
190 void disablePointSprites();
191
192 void enableAntiAliasing();
193
194 void disableAntiAliasing();
195
197
198 ofStyle getStyle() const;
199
200 void pushStyle();
201
202 void popStyle();
203
204 void setStyle(const ofStyle & style);
205
206 void setCurveResolution(int res);
207
209
210 // drawing
211 void drawLine(float x1, float y1, float z1, float x2, float y2, float z2) const;
212
213 void drawRectangle(float x, float y, float z, float w, float h) const;
214
215 void drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) const;
216
217 void drawCircle(float x, float y, float z, float radius) const;
218
219 void drawEllipse(float x, float y, float z, float width, float height) const;
220
221 void drawString(std::string text, float x, float y, float z) const;
222
223 void drawString(const ofTrueTypeFont & font, std::string text, float x, float y) const;
224
225 virtual void bind(const ofCamera & camera, const ofRectangle & viewport);
226 virtual void unbind(const ofCamera & camera);
227
228 const of3dGraphics & get3dGraphics() const;
229
231
232 ofPath & getPath();
233
234 std::vector<std::shared_ptr<ofBaseRenderer> > renderers;
237};
Definition of3dGraphics.h:445
A class representing a 3d primitive.
Definition of3dPrimitives.h:12
The base renderer interface.
Definition ofGraphicsBaseTypes.h:279
virtual void draw(const ofPolyline &poly) const =0
Draw a polyline with this renderer.
A base class representing a drawable video source.
Definition ofVideoBaseTypes.h:103
A basic camera object for interacting with objects in 3D space.
Definition ofCamera.h:13
A generic 3d object in space with transformation (position, rotation, scale).
Definition ofNode.h:14
ofPath is a way to create a path or multiple paths consisting of points. It allows you to combine mul...
Definition ofPath.h:38
A class representing a 2D rectangle.
Definition ofRectangle.h:87
Definition ofRendererCollection.h:7
ofRectangle getCurrentViewport() const
Get this renderer's current viewport.
Definition ofRendererCollection.cpp:177
void setLineWidth(float lineWidth)
Set the line width this renderer should use when drawing lines.
Definition ofRendererCollection.cpp:538
void setupScreen()
setup the default screen settings for this renderer.
Definition ofRendererCollection.cpp:382
const of3dGraphics & get3dGraphics() const
Get a const reference of this renderer's 3D graphics object.
Definition ofRendererCollection.cpp:695
void pushMatrix()
Pushes this renderer's matrix stack down by one.
Definition ofRendererCollection.cpp:222
void rotateZRad(float radians)
Rotate this renderer's current matrix by degrees about the z axis.
Definition ofRendererCollection.cpp:289
bool rendersPathPrimitives()
Definition ofRendererCollection.cpp:27
void drawEllipse(float x, float y, float z, float width, float height) const
Draw an ellipse using a 3D point, width, and height.
Definition ofRendererCollection.cpp:666
void setBackgroundColor(const ofColor &color)
Set this renderer's background color.
Definition ofRendererCollection.cpp:434
void scale(float xAmnt, float yAmnt, float zAmnt=1)
Scale this renderer's current matrix by xAmnt, yAmnt, and zAmnt.
Definition ofRendererCollection.cpp:242
void setStyle(const ofStyle &style)
Set this renderer's current style object.
Definition ofRendererCollection.cpp:621
void setBitmapTextMode(ofDrawBitmapMode mode)
Set this renderer's bitmap text mode.
Definition ofRendererCollection.cpp:595
void clear()
Clear this renderer's current color and bit depths.
Definition ofRendererCollection.cpp:478
void rotateXDeg(float degrees)
Rotate this renderer's current matrix by degrees about the x axis.
Definition ofRendererCollection.cpp:253
void setCoordHandedness(ofHandednessType handedness)
Set the coordinate handidness of this renderer.
Definition ofRendererCollection.cpp:208
void setLineSmoothing(bool smooth)
Enable/disable line smoothing for this renderer if it's supported.
Definition ofRendererCollection.cpp:558
glm::mat4 getCurrentMatrix(ofMatrixMode matrixMode_) const
Get this renderer's current matrix for particular a matrix mode.
Definition ofRendererCollection.cpp:107
glm::mat4 getCurrentOrientationMatrix() const
Get this renderer's current orientation matrix.
Definition ofRendererCollection.cpp:117
void setupScreenOrtho(float width=-1, float height=-1, float nearDist=-1, float farDist=1)
Setup the renderer to use an orthographic matrix.
Definition ofRendererCollection.cpp:171
ofRectMode getRectMode()
Get this renderer's current rect mode.
Definition ofRendererCollection.cpp:509
void disablePointSprites()
Definition ofRendererCollection.cpp:575
ofFillFlag getFillMode()
Get this renderer's current fill flag.
Definition ofRendererCollection.cpp:530
ofRendererCollection()
Definition ofRendererCollection.h:9
void draw(const ofPolyline &poly) const
Draw a polyline with this renderer.
Definition ofRendererCollection.cpp:41
glm::mat4 getCurrentNormalMatrix() const
Get this renderer's current normal matrix.
Definition ofRendererCollection.cpp:127
void disableAntiAliasing()
Disable this renderer from using anti-aliasing.
Definition ofRendererCollection.cpp:589
int getViewportWidth() const
Get the renderer's current viewport width.
Definition ofRendererCollection.cpp:193
ofStyle getStyle() const
Get this renderer's current style object.
Definition ofRendererCollection.cpp:601
void drawString(std::string text, float x, float y, float z) const
Draw text with this renderer using the current bitmap text mode.
Definition ofRendererCollection.cpp:672
void multViewMatrix(const glm::mat4 &m)
Multiply this renderer's view matrix by m.
Definition ofRendererCollection.cpp:357
void setupScreenPerspective(float width=-1, float height=-1, float fov=60, float nearDist=0, float farDist=0)
Setup the renderer to use a perspective matrix.
Definition ofRendererCollection.cpp:165
ofColor getBackgroundColor()
Get this renderer's current background color.
Definition ofRendererCollection.cpp:426
void setCurveResolution(int res)
Set the resolution used when drawing curves with this renderer.
Definition ofRendererCollection.cpp:627
void setPolyMode(ofPolyWindingMode mode)
Set this renderer's poly winding mode.
Definition ofRendererCollection.cpp:634
void clearAlpha()
Restore the alpha color to its full opacity value.
Definition ofRendererCollection.cpp:496
ofPath path
Definition ofRendererCollection.h:236
void matrixMode(ofMatrixMode mode)
Sets this renderer's current matrix mode.
Definition ofRendererCollection.cpp:345
void rotateXRad(float radians)
Rotate this renderer's current matrix by degrees about the x axis.
Definition ofRendererCollection.cpp:279
void finishRender()
Stop using this renderer as the rendering surface.
Definition ofRendererCollection.cpp:35
void loadMatrix(const glm::mat4 &m)
Load a matrix as this renderer's current matrix.
Definition ofRendererCollection.cpp:306
void setColor(int r, int g, int b)
Set the global color this renderer will use when drawing.
Definition ofRendererCollection.cpp:389
void rotateRad(float radians, float vecX, float vecY, float vecZ)
Rotate this renderer's current matrix by degrees about a euler.
Definition ofRendererCollection.cpp:274
void popStyle()
Pop this renderer's current style from its internal style stack.
Definition ofRendererCollection.cpp:615
void rotateYDeg(float degrees)
Rotate this renderer's current matrix by degrees about the y axis.
Definition ofRendererCollection.cpp:258
ofHandednessType getCoordHandedness() const
Get the coordinate handidness of this renderer.
Definition ofRendererCollection.cpp:213
void background(const ofColor &c)
Immediately paint a background color to the screen.
Definition ofRendererCollection.cpp:448
void rotateYRad(float radians)
Rotate this renderer's current matrix by degrees about the y axis.
Definition ofRendererCollection.cpp:284
of3dGraphics graphics3d
Definition ofRendererCollection.h:235
void loadIdentityMatrix(void)
Load this renderer's identity matrix.
Definition ofRendererCollection.cpp:300
virtual void unbind(const ofCamera &camera)
Unbind the camera from this renderer.
Definition ofRendererCollection.cpp:689
void rotateZDeg(float degrees)
Rotate this renderer's current matrix by degrees about the z axis.
Definition ofRendererCollection.cpp:263
bool getBackgroundAuto()
Get the current auto redraw background setting for this renderer.
Definition ofRendererCollection.cpp:440
virtual void bind(const ofCamera &camera, const ofRectangle &viewport)
Bind camera's matrices to this renderer's matrix stack.
Definition ofRendererCollection.cpp:684
glm::mat4 getCurrentViewMatrix() const
Get this renderer's current view matrix.
Definition ofRendererCollection.cpp:363
void translate(float x, float y, float z=0)
Translate this renderer's current matrix by x, y, and z.
Definition ofRendererCollection.cpp:232
const std::string & getType()
Get the string representation of the renderer type.
Definition ofRendererCollection.h:13
void setBackgroundAuto(bool bManual)
Enable/disable automatic redrawing of the background each frame.
Definition ofRendererCollection.cpp:472
void setFillMode(ofFillFlag fill)
set this renderer's fill flag.
Definition ofRendererCollection.cpp:517
std::shared_ptr< ofBaseGLRenderer > getGLRenderer()
Definition ofRendererCollection.cpp:14
void viewport(ofRectangle viewport)
Set this renderer's viewport using a rectangle.
Definition ofRendererCollection.cpp:153
void loadViewMatrix(const glm::mat4 &m)
Load m into this renderer's matrix stack as a view matrix.
Definition ofRendererCollection.cpp:351
void setHexColor(int hexColor)
Set the global color this renderer will use when drawing.
void setRectMode(ofRectMode mode)
Set this renderer's rect mode.
Definition ofRendererCollection.cpp:503
~ofRendererCollection()
Definition ofRendererCollection.h:10
void multMatrix(const glm::mat4 &m)
Multiply this renderer's current matrix by m.
Definition ofRendererCollection.cpp:318
void drawCircle(float x, float y, float z, float radius) const
Draw a circle using a 3D point and a radius.
Definition ofRendererCollection.cpp:660
ofPath & getPath()
Get a reference to the path used internally by this renderer.
Definition ofRendererCollection.cpp:703
void pushView()
Push the current viewport into the renderer's viewport stack.
Definition ofRendererCollection.cpp:138
void drawLine(float x1, float y1, float z1, float x2, float y2, float z2) const
Draw a line between two 3D points.
Definition ofRendererCollection.cpp:642
void drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) const
Draw a triangle using three 3D points.
Definition ofRendererCollection.cpp:654
void enableAntiAliasing()
Enable this renderer to use anti-aliasing if it is supported.
Definition ofRendererCollection.cpp:583
void popView()
Pop the current viewport from the renderer's view stack.
Definition ofRendererCollection.cpp:144
void startRender()
Starts using this renderer as the rendering surface.
Definition ofRendererCollection.cpp:29
void drawRectangle(float x, float y, float z, float w, float h) const
Draw a rectangle using a 3D point and a width and height.
Definition ofRendererCollection.cpp:648
void setBlendMode(ofBlendMode blendMode)
Set this renderer's current blend mode.
Definition ofRendererCollection.cpp:553
void setupGraphicDefaults()
setup the default graphics settings for this renderer.
Definition ofRendererCollection.cpp:374
void rotateDeg(float degrees, float vecX, float vecY, float vecZ)
Rotate this renderer's current matrix by degrees about a euler.
Definition ofRendererCollection.cpp:248
void setDepthTest(bool depthTest)
Enable/disable depth testing with this renderer.
Definition ofRendererCollection.cpp:547
bool isVFlipped() const
Returns true if the renderer's current viewport is vertically flipped.
Definition ofRendererCollection.cpp:336
void popMatrix()
Pops this renderer's current matrix stack.
Definition ofRendererCollection.cpp:227
static const std::string TYPE
Definition ofRendererCollection.h:12
void pushStyle()
Push this renderer's current style into its internal style stack.
Definition ofRendererCollection.cpp:609
void enablePointSprites()
Definition ofRendererCollection.cpp:568
ofRectangle getNativeViewport() const
Get this renderer's current native viewport.
Definition ofRendererCollection.cpp:185
int getViewportHeight() const
Get the renderer's current viewport width.
Definition ofRendererCollection.cpp:200
void setOrientation(ofOrientation orientation, bool vflip)
set this renderer's orientation.
Definition ofRendererCollection.cpp:330
std::vector< std::shared_ptr< ofBaseRenderer > > renderers
Definition ofRendererCollection.h:234
void setCircleResolution(int res)
Set the resolution to use when drawing ellipses with this renderer.
Definition ofRendererCollection.cpp:563
Contains general information about the style of ofGraphics elements such as color,...
Definition ofGraphicsBaseTypes.h:51
Definition ofTrueTypeFont.h:164
unsigned int height
Definition ofAppEGLWindow.cpp:125
unsigned int width
Definition ofAppEGLWindow.cpp:124
ofDrawBitmapMode
Sets the bitmap drawing mode for text.
Definition ofGraphicsConstants.h:125
ofMatrixMode
represents the available matrix types used internally in ofMatrixStack.
Definition ofGraphicsConstants.h:119
ofHandednessType
represents the available matrix coordinate system handednesses.
Definition ofGraphicsConstants.h:116
ofRectMode
Used to represent the available rectangle drawing modes.
Definition ofGraphicsConstants.h:139
ofBlendMode
Used to represent the available blending modes for drawing.
Definition ofGraphicsConstants.h:57
ofPolyRenderMode
Definition ofGraphicsConstants.h:13
ofPolyWindingMode
represents the available polygon winding modes.
Definition ofGraphicsConstants.h:97
ofFillFlag
Used to represent the available fill modes.
Definition ofGraphicsConstants.h:41
#define a
#define c
#define b
ofOrientation
Used to represent the available screen orientations.
Definition ofWindowSettings.h:25