50 #if defined( CINDER_WINRT )
58 class Camera;
class TriMesh2d;
class TriMesh;
class Sphere;
66 class AppImplMswRendererDx;
70 namespace cinder {
namespace dx {
119 void setMatricesWindowPersp(
int screenWidth,
int screenHeight,
float fovDegrees = 60.0
f,
float nearPlane = 1.0
f,
float farPlane = 1000.0
f,
bool originUpperLeft =
true );
121 inline void setMatricesWindowPersp(
const Vec2i &screenSize,
float fovDegrees = 60.0
f,
float nearPlane = 1.0
f,
float farPlane = 1000.0
f,
bool originUpperLeft =
true )
124 void setMatricesWindow(
int screenWidth,
int screenHeight,
bool originUpperLeft =
true );
158 #if ! defined( CINDER_GLES )
170 void vertex(
float x,
float y,
float z );
179 #endif // ! defined( CINDER_GLES )
180 void color(
float r,
float g,
float b );
183 void color(
float r,
float g,
float b,
float a );
193 void normal(
float x,
float y,
float z );
215 #if ! defined( CINDER_GLES )
220 #endif // ! defined( CINDER_GLES )
250 void drawSphere(
const Vec3f ¢er,
float radius,
int segments = 12 );
252 void draw(
const class Sphere &sphere,
int segments = 12 );
283 void drawTorus(
float outterRadius,
float innerRadius,
int longitudeSegments = 12,
int latitudeSegments = 12 );
285 void drawCylinder(
float baseRadius,
float topRadius,
float height,
int slices = 12,
int stacks = 1 );
291 void draw(
const class Path2d &path2d,
float approximationScale = 1.0
f );
293 void draw(
const class Shape2d &shape2d,
float approximationScale = 1.0
f );
296 void drawSolid(
const class Path2d &path2d,
float approximationScale = 1.0
f );
309 void drawRange(
const TriMesh &mesh,
size_t startTriangle,
size_t triangleCount );
312 void draw(
const VboMesh &vbo );
314 void drawRange(
const VboMesh &vbo,
size_t startIndex,
size_t indexCount,
int vertexStart = -1,
int vertexEnd = -1 );
329 void draw(
const TextureRef &
texture,
const std::vector<float> &verts,
const std::vector<float> &texCoords,
const std::vector<ColorA8u> &vertColors,
const std::vector<uint32_t> &
indices );
350 virtual const char *
what()
const {
return "Drawing more vertices than the vertex buffer supports"; }
void drawStrokedTriangle(const Vec2f &pt1, const Vec2f &pt2, const Vec2f &pt3)
Renders a stroked triangle.
Definition: dx.cpp:1812
GLdouble GLdouble GLdouble r
Definition: GLee.h:1474
void enableDepthRead(bool enable=true)
Enables reading from the depth buffer when enable, enabling z-testing.
Definition: dx.cpp:974
GLenum GLint GLint y
Definition: GLee.h:987
GLenum mode
Definition: GLee.h:3042
void drawCube(const Vec3f ¢er, const Vec3f &size)
Renders a solid cube centered at center of size size. Normals and created texture coordinates are gen...
Definition: dx.cpp:1209
void drawColorCube(const Vec3f ¢er, const Vec3f &size)
Renders a solid cube centered at center of size size. Each face is assigned a unique color...
Definition: dx.cpp:1214
void drawSphere(const Vec3f ¢er, float radius, int segments=12)
Renders a solid sphere centered at center of radius radius. segments defines how many segments the sp...
Definition: dx.cpp:1242
void enable(GLenum state)
Enables the OpenGL State state. Equivalent to calling to glEnable( state );.
Definition: dx.h:198
void drawTorus(float outterRadius, float innerRadius, int longitudeSegments=12, int latitudeSegments=12)
Draws a torus at the origin, with an outter radius outterRadius and an inner radius innerRadius...
Definition: dx.cpp:2064
GLuint start
Definition: GLee.h:963
void setMatrices(const Camera &cam)
Sets the MODELVIEW and PROJECTION matrices to reflect the values of cam. Leaves the MatrixMode as MOD...
Definition: dx.cpp:315
void drawSolidRect(const Rectf &rect, bool textureRectangle=false)
Renders a solid rectangle. Texture coordinates in the range [0,1] are generated unless textureRectang...
Definition: dx.cpp:1532
void batchTextureEnd()
Draws all the batched textures.
Definition: dx.cpp:2967
void disableAlphaTest()
Disables alpha testing.
Definition: dx.cpp:914
Vec2< float > Vec2f
Definition: Vector.h:1314
GLenum GLenum GLuint texture
Definition: GLee.h:5383
GLsizei const GLchar ** string
Definition: GLee.h:2427
app::AppImplMswRendererDx * getDxRenderer()
Definition: dx.cpp:80
void drawVector(const Vec3f &start, const Vec3f &end, float headLength=0.2f, float headRadius=0.05f)
Draws a vector starting at start and ending at end. An arrowhead is drawn at the end of radius headRa...
Definition: dx.cpp:1866
void multProjection(const Matrix44f &mtx)
Multiplies the current PROJECTION matrix with mtx. Leaves the MatrixMode as MODELVIEW.
Definition: dx.cpp:400
#define GL_GREATER
Definition: gldx.h:79
void disableVerticalSync()
Disables wait for vertical sync.
Definition: dx.h:85
void pushModelView()
Pushes the MODELVIEW matrix onto its stack, preserving the current values. Leaves the MatrixMode as M...
Definition: dx.cpp:321
void drawCylinder(float baseRadius, float topRadius, float height, int slices=12, int stacks=1)
Draws a open-ended cylinder, with base radius baseRadius and top radius topRadius, with height height, subdivided into slices and stacks. Normals and texture coordinates in the range [0,1] are generated.
Definition: dx.cpp:2153
T x
Definition: Vector.h:71
void scale(const Vec3f &scl)
Produces a scale by scale in the current matrix.
Definition: dx.cpp:556
std::shared_ptr< Texture > TextureRef
Definition: dx.h:61
void drawRange(const TriMesh2d &mesh, size_t startTriangle, size_t triangleCount)
Draws a range of triangles starting with triangle # startTriangle and a count of triangleCount from c...
Definition: dx.cpp:2450
void normal(float x, float y, float z)
Sets the current normal.
Definition: dx.cpp:848
void drawString(const std::string &str, const Vec2f &pos, const ColorA &color=ColorA(1, 1, 1, 1), Font font=Font())
Draws a string str with its lower left corner located at pos. Optional font and color affect the styl...
Definition: dx.cpp:3024
void vertex(const Vec2f &v)
Definition: dx.cpp:749
void clear(const ColorA &color=ColorA::black(), bool clearDepthBuffer=true)
Clears the OpenGL color buffer using color and optionally clears the depth buffer when clearDepthBuff...
Definition: dx.cpp:202
void drawStringCentered(const std::string &str, const Vec2f &pos, const ColorA &color=ColorA(1, 1, 1, 1), Font font=Font())
Draws a string str with the horizontal center of its baseline located at pos. Optional font and color...
Definition: dx.cpp:3029
void drawStrokedRect(const Rectf &rect)
Renders a stroked rectangle.
Definition: dx.cpp:1572
void enableDepthWrite(bool enable=true)
Enables writing to the depth buffer when enable.
Definition: dx.cpp:989
void enableLighting()
Enables lighting.
Definition: dx.cpp:1009
Area getViewport()
Returns the current OpenGL Viewport as an Area.
Definition: dx.cpp:512
void drawStrokedCircle(const Vec2f ¢er, float radius, int numSegments=0)
Renders a stroked circle using a line loop. The default value of zero for numSegments automatically d...
Definition: dx.cpp:1395
void drawStrokedEllipse(const Vec2f ¢er, float radiusX, float radiusY, int numSegments=0)
Renders a stroked circle using a line loop. The default value of zero for numSegments automatically d...
Definition: dx.cpp:1490
Vec3< float > Vec3f
Definition: Vector.h:1317
void setMatricesWindowPersp(int screenWidth, int screenHeight, float fovDegrees=60.0f, float nearPlane=1.0f, float farPlane=1000.0f, bool originUpperLeft=true)
Sets the viepwort and MODELVIEW and PROJECTION matrices to be a perspective projection with the upper...
Definition: dx.cpp:432
void drawArrays(const VboMesh &vbo, GLint first, GLsizei count)
Draws a range of elements from a cinder::gl::VboMesh vbo.
Definition: dx.cpp:2764
void enableAdditiveBlending()
Enables alpha blending and selects a BlendFunc for additive blending.
Definition: dx.cpp:888
ColorAT< float > ColorA
Definition: Color.h:408
Vec3f getCenter() const
Definition: AxisAlignedBox.h:39
GLint * first
Definition: GLee.h:1725
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: GLee.h:963
GLboolean GLboolean g
Definition: GLee.h:2964
GLenum GLsizei GLsizei height
Definition: GLee.h:1029
Vec3f getSize() const
Definition: AxisAlignedBox.h:40
Represents an instance of a font at a point size. Implicitly shared object.
Definition: Font.h:63
void drawSolidRoundedRect(const Rectf &r, float cornerRadius, int numSegmentsPerCorner=0)
Definition: dx.cpp:1603
void multModelView(const Matrix44f &mtx)
Multiplies the current MODELVIEW matrix with mtx. Leaves the MatrixMode as MODELVIEW.
Definition: dx.cpp:390
GLenum GLint x
Definition: GLee.h:987
Matrix44f getProjection()
Returns the value of the current PROJECTION matrix as a Matrix44f.
Definition: dx.cpp:421
GLuint GLuint GLsizei count
Definition: GLee.h:963
void enableWireframe()
Definition: dx.cpp:923
void enableAlphaBlending(bool premultiplied=false)
Enables alpha blending. Selects a BlendFunc that is appropriate for premultiplied-alpha when premulti...
Definition: dx.cpp:858
int GLsizei
Definition: gldx.h:52
Represents an OpenGL Texture. Implicitly shared object.
Definition: DxTexture.h:59
void pushMatrices()
Pushes the MODELVIEW and PROJECTION matrices onto their stacks, preserving the current values...
Definition: dx.cpp:364
void drawFrustum(const Camera &cam)
Draws a wireframe representation of the frustum defined by cam.
Definition: dx.cpp:1962
const GLdouble * v
Definition: GLee.h:1384
void disableDepthRead()
Disables reading from the depth buffer, disabling z-testing.
Definition: dx.cpp:964
void drawStringRight(const std::string &str, const Vec2f &pos, const ColorA &color=ColorA(1, 1, 1, 1), Font font=Font())
Draws a right-justified string str with the center of its located at pos. Optional font and color aff...
Definition: dx.cpp:3034
GLdouble GLdouble z
Definition: GLee.h:1911
GLboolean GLboolean GLboolean b
Definition: GLee.h:2964
void batchTextureBegin()
Sets the render state to batch texture draw calls until the end for optimal performance.
Definition: dx.cpp:2962
void drawSolid(const class Path2d &path2d, float approximationScale=1.0f)
Draws a solid (filled) Path2d path2d using approximation scale approximationScale. 1.0 corresponds to screenspace, 2.0 is double screen resolution, etc. Performance warning: This routine tesselates the polygon into triangles. Consider using Triangulator directly.
T y
Definition: Vector.h:71
GLsizei const GLfloat * value
Definition: GLee.h:2487
GLuint GLuint end
Definition: GLee.h:963
void begin(GLenum mode)
Definition: dx.cpp:588
void rotate(const Vec3f &xyz)
Produces a rotation around the X-axis by xyz.x degrees, the Y-axis by xyz.y degrees and the Z-axis by...
Definition: dx.cpp:563
void popMatrices()
Pops the MODELVIEW and PROJECTION matrices off their stacks, restoring the values saved with the prev...
Definition: dx.cpp:377
void draw(const class Sphere &sphere, int segments=12)
Renders a solid sphere. segments defines how many segments the sphere is subdivided into...
Definition: dx.cpp:1340
void color(float r, float g, float b)
Sets the current color and the alpha value to 1.0.
Definition: dx.cpp:810
const GLubyte * c
Definition: GLee.h:8491
bool isVerticalSyncEnabled()
Returns whether vertical sync is enabled for the current context.
Definition: dx.cpp:243
void disableWireframe()
Definition: dx.cpp:943
void drawBillboard(const Vec3f &pos, const Vec2f &scale, float rotationDegrees, const Vec3f &bbRight, const Vec3f &bbUp)
Draws a textured quad of size scale that is aligned with the vectors bbRight and bbUp at pos...
Definition: dx.cpp:2824
void setMatricesWindow(int screenWidth, int screenHeight, bool originUpperLeft=true)
Sets the viewport and MODELVIEW and PROJECTION matrices to orthographic with the upper-left corner at...
Definition: dx.cpp:469
GLboolean GLboolean GLboolean GLboolean a
Definition: GLee.h:2964
int int int * dx
Definition: GLee.h:17162
void enableVerticalSync(bool enable=true)
Enables or disables wait for vertical sync.
Definition: dx.cpp:223
void setModelView(const Camera &cam)
Sets the MODELVIEW matrix to reflect the values of cam. Leaves the MatrixMode as MODELVIEW.
Definition: dx.cpp:267
void disableAlphaBlending()
Disables alpha blending.
Definition: dx.cpp:876
int GLint
Definition: gldx.h:51
bool isExtensionAvailable(const std::string &extName)
Returns whether a particular OpenGL extension is available. Caches results.
Definition: gl.cpp:192
void popModelView()
Pops the MODELVIEW matrix off of its stack, restoring the values saved with the previous push...
Definition: dx.cpp:331
Definition: Exception.h:32
void setProjection(const Camera &cam)
Sets the PROJECTION matrix to reflect the values of cam. Leaves the MatrixMode as PROJECTION...
Definition: dx.cpp:287
void enableAlphaTest(float value=0.5f, int func=GL_GREATER)
Enables alpha testing and sets the AlphaFunc to test for values which are func than value...
Definition: dx.cpp:903
void setViewport(const Area &area)
Sets the current OpenGL Viewport to area.
Definition: dx.cpp:532
void drawSolidEllipse(const Vec2f ¢er, float radiusX, float radiusY, int numSegments=0)
Renders a solid ellipse using triangle fans. The default value of zero for numSegments automatically ...
Definition: dx.cpp:1439
const GLfloat * m
Definition: GLee.h:13493
static ColorAT< float > black()
Definition: Color.h:351
Definition: AxisAlignedBox.h:31
GLenum GLenum GLenum GLenum GLenum scale
Definition: GLee.h:8937
void end()
Definition: dx.cpp:596
Definition: TriMesh.h:167
void drawSolidCircle(const Vec2f ¢er, float radius, int numSegments=0)
Renders a solid circle using triangle fans. The default value of zero for numSegments automatically d...
Definition: dx.cpp:1345
void drawLine(const Vec2f &start, const Vec2f &end)
Draws a line from start to end.
Definition: dx.cpp:1050
void translate(const Vec2f &pos)
Produces a translation by pos in the current matrix.
Definition: dx.cpp:542
void disable(GLenum state)
Disables the OpenGL State state. Equivalent to calling to glDisable( state );.
Definition: dx.h:200
Matrix44f getModelView()
Returns the value of the current MODELVIEW matrix as a Matrix44f.
Definition: dx.cpp:410
GLclampf f
Definition: GLee.h:15307
virtual const char * what() const
Definition: dx.h:350
GLsizeiptr size
Definition: GLee.h:2089
void disableLighting()
Disables lighting.
Definition: dx.cpp:1014
void texCoord(float x, float y)
Definition: dx.cpp:782
void drawSolidTriangle(const Vec2f &pt1, const Vec2f &pt2, const Vec2f &pt3)
Definition: dx.cpp:1752
unsigned int GLenum
Definition: gldx.h:46
void pushProjection(const Camera &cam)
Pushes the PROJECTION matrix onto its stack, preserving the current values, and then sets the matrix ...
Definition: dx.cpp:353
void drawStrokedCube(const Vec3f ¢er, const Vec3f &size)
Renders a stroked cube centered at center of size size.
Definition: dx.cpp:1219
void drawCoordinateFrame(float axisLength=1.0f, float headLength=0.2f, float headRadius=0.05f)
Definition: dx.cpp:1841
void drawStrokedRoundedRect(const Rectf &r, float cornerRadius, int numSegmentsPerCorner=0)
Definition: dx.cpp:1692
void setLight(const Light &light)
Sets a light internally using the properties of light. Up to eight unique lights may exist in this mo...
Definition: dx.cpp:1019
void disableDepthWrite()
Disables writing to the depth buffer.
Definition: dx.cpp:999
GLuint color
Definition: GLee.h:3198