![]() |
Cinder
0.9.1
|
#include <Context.h>
Classes | |
struct | PlatformData |
Public Member Functions | |
~Context () | |
const std::shared_ptr< PlatformData > | getPlatformData () const |
void | makeCurrent (bool force=false) const |
std::vector< mat4 > & | getModelMatrixStack () |
const std::vector< mat4 > & | getModelMatrixStack () const |
std::vector< mat4 > & | getViewMatrixStack () |
const std::vector< mat4 > & | getViewMatrixStack () const |
std::vector< mat4 > & | getProjectionMatrixStack () |
const std::vector< mat4 > & | getProjectionMatrixStack () const |
void | bindVao (Vao *vao) |
void | bindVao (VaoRef &vao) |
void | pushVao (Vao *vao) |
void | pushVao (const VaoRef &vao) |
void | pushVao () |
void | popVao () |
Vao * | getVao () |
void | restoreInvalidatedVao () |
void | vaoCreated (const Vao *vao) |
void | vaoDeleted (const Vao *vao) |
void | viewport (const std::pair< ivec2, ivec2 > &viewport) |
void | pushViewport (const std::pair< ivec2, ivec2 > &viewport) |
void | pushViewport () |
void | popViewport (bool forceRestore=false) |
std::pair< ivec2, ivec2 > | getViewport () |
void | setScissor (const std::pair< ivec2, ivec2 > &scissor) |
void | pushScissor (const std::pair< ivec2, ivec2 > &scissor) |
void | pushScissor () |
void | popScissor (bool forceRestore=false) |
std::pair< ivec2, ivec2 > | getScissor () |
void | cullFace (GLenum face) |
void | pushCullFace (GLenum face) |
void | pushCullFace () |
void | popCullFace (bool forceRestore=false) |
GLenum | getCullFace () |
void | frontFace (GLenum mode) |
void | pushFrontFace (GLenum mode) |
void | pushFrontFace () |
void | popFrontFace (bool forceRestore=false) |
GLenum | getFrontFace () |
void | logicOp (GLenum mode) |
void | pushLogicOp (GLenum mode) |
void | popLogicOp (bool forceRestore=false) |
GLenum | getLogicOp () |
void | bindBuffer (GLenum target, GLuint id) |
void | pushBufferBinding (GLenum target, GLuint id) |
void | pushBufferBinding (GLenum target) |
void | popBufferBinding (GLenum target) |
GLuint | getBufferBinding (GLenum target) |
void | reflectBufferBinding (GLenum target, GLuint id) |
void | bufferCreated (const BufferObj *buffer) |
void | bufferDeleted (const BufferObj *buffer) |
void | invalidateBufferBindingCache (GLenum target) |
void | restoreInvalidatedBufferBinding (GLenum target) |
void | bindRenderbuffer (GLenum target, GLuint id) |
void | pushRenderbufferBinding (GLenum target, GLuint id) |
void | pushRenderbufferBinding (GLenum target) |
void | popRenderbufferBinding (GLenum target) |
GLuint | getRenderbufferBinding (GLenum target) |
void | renderbufferDeleted (const Renderbuffer *buffer) |
void | bindGlslProg (const GlslProg *prog) |
void | bindGlslProg (GlslProgRef &prog) |
void | pushGlslProg (const GlslProg *prog) |
void | pushGlslProg (GlslProgRef &prog) |
void | pushGlslProg () |
void | popGlslProg (bool forceRestore=false) |
const GlslProg * | getGlslProg () |
void | glslProgCreated (const GlslProg *glslProg) |
void | glslProgDeleted (const GlslProg *glslProg) |
void | bindBufferBase (GLenum target, GLuint index, const BufferObjRef &buffer) |
void | bindBufferBase (GLenum target, GLuint index, GLuint id) |
void | bindBufferRange (GLenum target, GLuint index, const BufferObjRef &buffer, GLintptr offset, GLsizeiptr size) |
void | bindTexture (GLenum target, GLuint textureId) |
void | bindTexture (GLenum target, GLuint textureId, uint8_t textureUnit) |
void | pushTextureBinding (GLenum target, uint8_t textureUnit) |
void | pushTextureBinding (GLenum target, GLuint textureId, uint8_t textureUnit) |
void | popTextureBinding (GLenum target, uint8_t textureUnit, bool forceRestore=false) |
GLuint | getTextureBinding (GLenum target) |
GLuint | getTextureBinding (GLenum target, uint8_t textureUnit) |
void | textureCreated (const TextureBase *texture) |
void | textureDeleted (const TextureBase *texture) |
void | setActiveTexture (uint8_t textureUnit) |
void | pushActiveTexture (uint8_t textureUnit) |
void | pushActiveTexture () |
void | popActiveTexture (bool forceRestore=false) |
uint8_t | getActiveTexture () |
void | bindFramebuffer (const FboRef &fbo, GLenum target=GL_FRAMEBUFFER) |
void | bindFramebuffer (GLenum target, GLuint framebuffer) |
void | pushFramebuffer (const FboRef &fbo, GLenum target=GL_FRAMEBUFFER) |
void | pushFramebuffer (GLenum target, GLuint framebuffer=GL_FRAMEBUFFER) |
void | pushFramebuffer (GLenum target=GL_FRAMEBUFFER) |
void | popFramebuffer (GLuint framebuffer=GL_FRAMEBUFFER) |
void | unbindFramebuffer () |
GLuint | getFramebuffer (GLenum target=GL_FRAMEBUFFER) |
void | framebufferCreated (const Fbo *fbo) |
void | framebufferDeleted (const Fbo *fbo) |
void | setBoolState (GLenum cap, GLboolean value) |
void | pushBoolState (GLenum cap, GLboolean value) |
void | pushBoolState (GLenum cap) |
void | popBoolState (GLenum cap, bool forceRestore=false) |
void | enable (GLenum cap, GLboolean value=true) |
GLboolean | getBoolState (GLenum cap) |
void | setBoolState (GLenum cap, GLboolean value, const std::function< void(GLboolean)> &setter) |
void | blendFunc (GLenum sfactor, GLenum dfactor) |
void | blendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
void | pushBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
void | pushBlendFuncSeparate () |
void | popBlendFuncSeparate (bool forceRestore=false) |
void | getBlendFuncSeparate (GLenum *resultSrcRGB, GLenum *resultDstRGB, GLenum *resultSrcAlpha, GLenum *resultDstAlpha) |
void | lineWidth (float lineWidth) |
void | pushLineWidth (float lineWidth) |
void | pushLineWidth () |
void | popLineWidth (bool forceRestore=false) |
float | getLineWidth () |
void | depthMask (GLboolean enable) |
void | pushDepthMask (GLboolean enable) |
void | pushDepthMask () |
void | popDepthMask (bool forceRestore=false) |
GLboolean | getDepthMask () |
void | depthFunc (GLenum func) |
void | pushDepthFunc (GLenum func) |
void | pushDepthFunc () |
void | popDepthFunc (bool forceRestore=false) |
GLenum | getDepthFunc () |
void | polygonMode (GLenum face, GLenum mode) |
void | pushPolygonMode (GLenum face, GLenum mode) |
void | pushPolygonMode (GLenum face) |
void | popPolygonMode (GLenum face, bool forceRestore=false) |
GLenum | getPolygonMode (GLenum face) |
void | sanityCheck () |
void | printState (std::ostream &os) const |
const std::set< const TextureBase * > & | getLiveTextures () const |
const std::set< const BufferObj * > & | getLiveBuffers () const |
const std::set< const GlslProg * > & | getLiveGlslProgs () const |
const std::set< const Vao * > & | getLiveVaos () const |
const std::set< const Fbo * > & | getLiveFbos () const |
void | enableVertexAttribArray (GLuint index) |
void | disableVertexAttribArray (GLuint index) |
void | vertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) |
void | vertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) |
void | vertexAttribDivisor (GLuint index, GLuint divisor) |
void | vertexAttrib1f (GLuint index, float v0) |
void | vertexAttrib2f (GLuint index, float v0, float v1) |
void | vertexAttrib3f (GLuint index, float v0, float v1, float v2) |
void | vertexAttrib4f (GLuint index, float v0, float v1, float v2, float v3) |
void | drawArrays (GLenum mode, GLint first, GLsizei count) |
void | drawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) |
const ColorAf & | getCurrentColor () const |
void | setCurrentColor (const ColorAf &color) |
GlslProgRef & | getStockShader (const ShaderDef &shaderDef) |
void | setDefaultShaderVars () |
VboRef | getDefaultArrayVbo (size_t requiredSize=0) |
VboRef | getDefaultElementVbo (size_t requiredSize=0) |
Vao * | getDefaultVao () |
VboRef | getDrawTextureVbo () |
Vao * | getDrawTextureVao () |
VertBatch & | immediate () |
Static Public Member Functions | |
static ContextRef | create (const Context *sharedContext) |
static ContextRef | createFromExisting (const std::shared_ptr< PlatformData > &platformData) |
static Context * | getCurrent () |
static void | reflectCurrent (Context *context) |
Protected Member Functions | |
template<typename T > | |
bool | pushStackState (std::vector< T > &stack, T value) |
template<typename T > | |
bool | popStackState (std::vector< T > &stack) |
template<typename T > | |
bool | setStackState (std::vector< T > &stack, T value) |
template<typename T > | |
bool | getStackState (std::vector< T > &stack, T *result) |
void | allocateDefaultVboAndVao () |
Protected Attributes | |
std::map< ShaderDef, GlslProgRef > | mStockShaders |
std::map< GLenum, std::vector< int > > | mBufferBindingStack |
std::map< GLenum, std::vector< int > > | mRenderbufferBindingStack |
std::vector< const GlslProg * > | mGlslProgStack |
std::vector< Vao * > | mVaoStack |
std::vector< GLint > | mBlendSrcRgbStack |
std::vector< GLint > | mBlendDstRgbStack |
std::vector< GLint > | mBlendSrcAlphaStack |
std::vector< GLint > | mBlendDstAlphaStack |
std::vector< GLint > | mReadFramebufferStack |
std::vector< GLint > | mDrawFramebufferStack |
std::vector< GLenum > | mCullFaceStack |
std::vector< GLenum > | mFrontFaceStack |
std::vector< GLenum > | mLogicOpStack |
std::vector< GLenum > | mPolygonModeStack |
std::vector< GLboolean > | mDepthMaskStack |
std::vector< GLenum > | mDepthFuncStack |
std::map< GLenum, std::vector< GLboolean > > | mBoolStateStack |
std::map< uint8_t, std::map< GLenum, std::vector< GLint > > > | mTextureBindingStack |
std::vector< uint8_t > | mActiveTextureStack |
VaoRef | mDefaultVao |
VboRef | mDefaultArrayVbo [4] |
VboRef | mDefaultElementVbo |
uint8_t | mDefaultArrayVboIdx |
VertBatchRef | mImmediateMode |
VaoRef | mDrawTextureVao |
VboRef | mDrawTextureVbo |
Friends | |
class | Environment |
class | Texture2d |
cinder::gl::Context::~Context | ( | ) |
|
static |
Creates a new OpenGL context, sharing resources and pixel format with sharedContext. This (essentially) must be done from the primary thread on MSW. ANGLE doesn't support multithreaded use. Destroys the platform Context on destruction.
|
static |
Creates based on an existing platform-specific GL context. platformContext is CGLContextObj on Mac OS X, EAGLContext on iOS, HGLRC on MSW. platformContext is an HDC on MSW and ignored elsewhere. Does not assume ownership of the platform's context.
const std::shared_ptr<PlatformData> cinder::gl::Context::getPlatformData | ( | ) | const |
Returns the platform-specific OpenGL Context. CGLContextObj on Mac OS X, EAGLContext on iOS.
void cinder::gl::Context::makeCurrent | ( | bool | force = false | ) | const |
|
static |
Returns the thread's currently active OpenGL Context.
|
static |
Set thread's local storage to reflect context as the active Context.
std::vector<mat4>& cinder::gl::Context::getModelMatrixStack | ( | ) |
Returns a reference to the stack of Model matrices.
const std::vector<mat4>& cinder::gl::Context::getModelMatrixStack | ( | ) | const |
Returns a const reference to the stack of Model matrices.
std::vector<mat4>& cinder::gl::Context::getViewMatrixStack | ( | ) |
Returns a reference to the stack of View matrices.
const std::vector<mat4>& cinder::gl::Context::getViewMatrixStack | ( | ) | const |
Returns a const reference to the stack of Model matrices.
std::vector<mat4>& cinder::gl::Context::getProjectionMatrixStack | ( | ) |
Returns a reference to the stack of Projection matrices.
const std::vector<mat4>& cinder::gl::Context::getProjectionMatrixStack | ( | ) | const |
Returns a const reference to the stack of Projection matrices.
void cinder::gl::Context::pushVao | ( | Vao * | vao | ) |
Pushes and binds the VAO vao.
void cinder::gl::Context::pushVao | ( | const VaoRef & | vao | ) |
Pushes and binds the VAO vao.
void cinder::gl::Context::pushVao | ( | ) |
Duplicates and pushes the current VAO binding.
void cinder::gl::Context::popVao | ( | ) |
Pops the current VAO binding.
Vao * cinder::gl::Context::getVao | ( | ) |
Returns the currently bound VAO.
void cinder::gl::Context::restoreInvalidatedVao | ( | ) |
Restores the VAO binding when code that is not caching aware has invalidated it. Not typically necessary.
void cinder::gl::Context::vaoCreated | ( | const Vao * | vao | ) |
Used by object tracking.
void cinder::gl::Context::vaoDeleted | ( | const Vao * | vao | ) |
Used by object tracking.
void cinder::gl::Context::viewport | ( | const std::pair< ivec2, ivec2 > & | viewport | ) |
Analogous to glViewport(). Sets the viewport based on a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively.
void cinder::gl::Context::pushViewport | ( | const std::pair< ivec2, ivec2 > & | viewport | ) |
Pushes the viewport based on a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively.
void cinder::gl::Context::pushViewport | ( | ) |
Duplicates and pushes the top of the Viewport stack.
void cinder::gl::Context::popViewport | ( | bool | forceRestore = false | ) |
Pops the viewport. If forceRestore then redundancy checks are skipped and the hardware state is always set.
std::pair< ivec2, ivec2 > cinder::gl::Context::getViewport | ( | ) |
Returns a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively of the viewport.
void cinder::gl::Context::setScissor | ( | const std::pair< ivec2, ivec2 > & | scissor | ) |
Sets the scissor box based on a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively.
void cinder::gl::Context::pushScissor | ( | const std::pair< ivec2, ivec2 > & | scissor | ) |
Pushes the scissor box based on a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively.
void cinder::gl::Context::pushScissor | ( | ) |
Duplicates and pushes the top of the Scissor box stack.
void cinder::gl::Context::popScissor | ( | bool | forceRestore = false | ) |
Pushes the scissor box based on a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively. If forceRestore then redundancy checks are skipped and the hardware state is always set.
std::pair< ivec2, ivec2 > cinder::gl::Context::getScissor | ( | ) |
Returns a pair<ivec2,ivec2> representing the position of the lower-left corner and the size, respectively of the scissor box.
void cinder::gl::Context::cullFace | ( | GLenum | face | ) |
Analogous to glCullFace( face ). Valid arguments are GL_FRONT
and GL_BACK
.
void cinder::gl::Context::pushCullFace | ( | GLenum | face | ) |
Pushes the cull face face. Valid arguments are GL_FRONT
and GL_BACK
.
void cinder::gl::Context::pushCullFace | ( | ) |
Duplicates and pushes the top of the Cull Face stack.
void cinder::gl::Context::popCullFace | ( | bool | forceRestore = false | ) |
Pops the top of the Cull Face stack. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLenum cinder::gl::Context::getCullFace | ( | ) |
Returns a GLenum representing the current cull face. Either GL_FRONT
or GL_BACK
.
void cinder::gl::Context::frontFace | ( | GLenum | mode | ) |
Set the winding order defining front-facing polygons. Valid arguments are GL_CW
and GL_CCW
. Default is GL_CCW
.
void cinder::gl::Context::pushFrontFace | ( | GLenum | mode | ) |
Push the winding order defining front-facing polygons. Valid arguments are GL_CW
and GL_CCW
. Default is GL_CCW
.
void cinder::gl::Context::pushFrontFace | ( | ) |
Push the winding order defining front-facing polygons.
void cinder::gl::Context::popFrontFace | ( | bool | forceRestore = false | ) |
Pops the winding order defining front-facing polygons. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLenum cinder::gl::Context::getFrontFace | ( | ) |
Returns the winding order defining front-facing polygons, either GL_CW
or GL_CCW
(the default).
void cinder::gl::Context::logicOp | ( | GLenum | mode | ) |
Analogous to glLogicOp( mode ). Valid arguments are GL_CLEAR
, GL_SET
, GL_COPY
, GL_COPY_INVERTED
, GL_NOOP
, GL_INVERT
, GL_AND
, GL_NAND
, GL_OR
, GL_NOR
, GL_XOR
, GL_EQUIV
, GL_AND_REVERSE
, GL_AND_INVERTED
, GL_OR_REVERSE
, or GL_OR_INVERTED
.
void cinder::gl::Context::pushLogicOp | ( | GLenum | mode | ) |
Pushes the logical operation mode. Valid arguments are GL_CLEAR
, GL_SET
, GL_COPY
, GL_COPY_INVERTED
, GL_NOOP
, GL_INVERT
, GL_AND
, GL_NAND
, GL_OR
, GL_NOR
, GL_XOR
, GL_EQUIV
, GL_AND_REVERSE
, GL_AND_INVERTED
, GL_OR_REVERSE
, or GL_OR_INVERTED
.
void cinder::gl::Context::popLogicOp | ( | bool | forceRestore = false | ) |
Pops the top of the Logic Op stack. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLenum cinder::gl::Context::getLogicOp | ( | ) |
Returns a GLenum representing the current logical operation.
void cinder::gl::Context::bindBuffer | ( | GLenum | target, |
GLuint | id | ||
) |
Analogous to glBindBuffer( target, id )
void cinder::gl::Context::pushBufferBinding | ( | GLenum | target, |
GLuint | id | ||
) |
Pushes and binds buffer object id for the target target.
void cinder::gl::Context::pushBufferBinding | ( | GLenum | target | ) |
Duplicates and pushes the buffer binding for the target target.
void cinder::gl::Context::popBufferBinding | ( | GLenum | target | ) |
Pops the buffer binding for the target target.
GLuint cinder::gl::Context::getBufferBinding | ( | GLenum | target | ) |
Returns the current object binding for target. If not cached, queries the GL for the current value (and caches it).
void cinder::gl::Context::reflectBufferBinding | ( | GLenum | target, |
GLuint | id | ||
) |
Updates the binding stack without rebinding. Not generally necessary to call directly.
void cinder::gl::Context::bufferCreated | ( | const BufferObj * | buffer | ) |
Used by object tracking.
void cinder::gl::Context::bufferDeleted | ( | const BufferObj * | buffer | ) |
No-op if BufferObj wasn't bound, otherwise reflects the binding as 0 (in accordance with what GL has done automatically). Also used by object tracking.
void cinder::gl::Context::invalidateBufferBindingCache | ( | GLenum | target | ) |
Marks the cache of target's buffer binding as invalid. Typically called when a VAO is unbound, against GL_ELEMENT_ARRAY_BUFFER.
void cinder::gl::Context::restoreInvalidatedBufferBinding | ( | GLenum | target | ) |
Restores a buffer binding when code that is not caching aware has invalidated it. Not typically necessary.
void cinder::gl::Context::bindRenderbuffer | ( | GLenum | target, |
GLuint | id | ||
) |
Analogous to glBindRenderbuffer( target, id )
void cinder::gl::Context::pushRenderbufferBinding | ( | GLenum | target, |
GLuint | id | ||
) |
Pushes and binds renderbuffer object id for the target target.
void cinder::gl::Context::pushRenderbufferBinding | ( | GLenum | target | ) |
Duplicates and pushes the renderbuffer binding for the target target.
void cinder::gl::Context::popRenderbufferBinding | ( | GLenum | target | ) |
Pops the renderbuffer binding for the target target.
GLuint cinder::gl::Context::getRenderbufferBinding | ( | GLenum | target | ) |
Returns the current renderbuffer binding for target. If not cached, queries the GL for the current value (and caches it).
void cinder::gl::Context::renderbufferDeleted | ( | const Renderbuffer * | buffer | ) |
No-op if Renderbuffer wasn't bound, otherwise reflects the binding as 0 (in accordance with what GL has done automatically).
void cinder::gl::Context::bindGlslProg | ( | const GlslProg * | prog | ) |
Binds GLSL program prog. Analogous to glUseProgram()
void cinder::gl::Context::bindGlslProg | ( | GlslProgRef & | prog | ) |
void cinder::gl::Context::pushGlslProg | ( | const GlslProg * | prog | ) |
Pushes and binds GLSL program prog.
void cinder::gl::Context::pushGlslProg | ( | GlslProgRef & | prog | ) |
void cinder::gl::Context::pushGlslProg | ( | ) |
Duplicates and pushes the top of the GlslProg stack.
void cinder::gl::Context::popGlslProg | ( | bool | forceRestore = false | ) |
Pops the GlslProg stack. If forceRestore then redundancy checks are skipped and the hardware state is always set.
void cinder::gl::Context::glslProgCreated | ( | const GlslProg * | glslProg | ) |
Used by object tracking.
void cinder::gl::Context::glslProgDeleted | ( | const GlslProg * | glslProg | ) |
Used by object tracking.
void cinder::gl::Context::bindBufferBase | ( | GLenum | target, |
GLuint | index, | ||
const BufferObjRef & | buffer | ||
) |
Binds ref to the specific index within target. Analogous to glBindBufferBase()
Binds ref to the specific index within target. Analogous to glBindBufferBase()
void cinder::gl::Context::bindBufferRange | ( | GLenum | target, |
GLuint | index, | ||
const BufferObjRef & | buffer, | ||
GLintptr | offset, | ||
GLsizeiptr | size | ||
) |
Analogous to glBindBufferRange()
void cinder::gl::Context::bindTexture | ( | GLenum | target, |
GLuint | textureId | ||
) |
Analogous to glBindTexture( target, textureId ) for the active texture unit.
void cinder::gl::Context::bindTexture | ( | GLenum | target, |
GLuint | textureId, | ||
uint8_t | textureUnit | ||
) |
Analogous to glBindTexture( target, textureId ) for texture unit textureUnit.
void cinder::gl::Context::pushTextureBinding | ( | GLenum | target, |
uint8_t | textureUnit | ||
) |
Duplicates and pushes the binding for the target target for texture unit textureUnit.
void cinder::gl::Context::pushTextureBinding | ( | GLenum | target, |
GLuint | textureId, | ||
uint8_t | textureUnit | ||
) |
Pushes and binds textureId for the target target for texture unit textureUnit.
void cinder::gl::Context::popTextureBinding | ( | GLenum | target, |
uint8_t | textureUnit, | ||
bool | forceRestore = false |
||
) |
Pops the texture binding for the target target for texture unit textureUnit. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLuint cinder::gl::Context::getTextureBinding | ( | GLenum | target | ) |
Returns the current texture binding for target for the active texture unit. If not cached, queries the GL for the current value (and caches it).
GLuint cinder::gl::Context::getTextureBinding | ( | GLenum | target, |
uint8_t | textureUnit | ||
) |
Returns the current texture binding for target for texture unit textureUnit. If not cached, queries the GL for the current value (and caches it).
void cinder::gl::Context::textureCreated | ( | const TextureBase * | texture | ) |
Used by object tracking.
void cinder::gl::Context::textureDeleted | ( | const TextureBase * | texture | ) |
No-op if texture wasn't bound, otherwise reflects the texture unit's binding as 0 (in accordance with what GL has done automatically). Also used by object tracking.
void cinder::gl::Context::setActiveTexture | ( | uint8_t | textureUnit | ) |
Sets the active texture unit; expects values relative to 0
, not GL_TEXTURE0.
void cinder::gl::Context::pushActiveTexture | ( | uint8_t | textureUnit | ) |
Pushes and sets the active texture unit; expects values relative to 0
, not GL_TEXTURE0.
void cinder::gl::Context::pushActiveTexture | ( | ) |
Duplicates and pushes the active texture unit.
void cinder::gl::Context::popActiveTexture | ( | bool | forceRestore = false | ) |
Sets the active texture unit; expects values relative to 0
, not GL_TEXTURE0. If forceRestore then redundancy checks are skipped and the hardware state is always set.
Sets the active texture unit; expects values relative to 0
, not GL_TEXTURE0.
uint8_t cinder::gl::Context::getActiveTexture | ( | ) |
Returns the active texture unit with values relative to 0
, not GL_TEXTURE0.
void cinder::gl::Context::bindFramebuffer | ( | const FboRef & | fbo, |
GLenum | target = GL_FRAMEBUFFER |
||
) |
Analogous to glBindFramebuffer()
void cinder::gl::Context::bindFramebuffer | ( | GLenum | target, |
GLuint | framebuffer | ||
) |
Analogous to glBindFramebuffer(). Prefer the FboRef variant when possible. This does not allow gl::Fbo to mark itself as needing multisample resolution.
void cinder::gl::Context::pushFramebuffer | ( | const FboRef & | fbo, |
GLenum | target = GL_FRAMEBUFFER |
||
) |
Pushes and sets the active framebuffer.
void cinder::gl::Context::pushFramebuffer | ( | GLenum | target, |
GLuint | framebuffer = GL_FRAMEBUFFER |
||
) |
Pushes and sets the active framebuffer. Prefer the FboRef variant when possible. This does not allow gl::Fbo to mark itself as needing multisample resolution.
void cinder::gl::Context::pushFramebuffer | ( | GLenum | target = GL_FRAMEBUFFER | ) |
Duplicates and pushes the active framebuffer.
void cinder::gl::Context::popFramebuffer | ( | GLuint | framebuffer = GL_FRAMEBUFFER | ) |
Pops the active framebuffer.
void cinder::gl::Context::unbindFramebuffer | ( | ) |
Unbinds the current FBO (binding the default (screen) framebuffer)
GLuint cinder::gl::Context::getFramebuffer | ( | GLenum | target = GL_FRAMEBUFFER | ) |
Returns the ID of the framebuffer currently bound to target.
void cinder::gl::Context::framebufferCreated | ( | const Fbo * | fbo | ) |
Used by object tracking.
void cinder::gl::Context::framebufferDeleted | ( | const Fbo * | fbo | ) |
Used by object tracking.
void cinder::gl::Context::setBoolState | ( | GLenum | cap, |
GLboolean | value | ||
) |
Analogous to glEnable() or glDisable(). Enables or disables OpenGL capability cap.
void cinder::gl::Context::pushBoolState | ( | GLenum | cap, |
GLboolean | value | ||
) |
Pushes and sets the state stack for OpenGL capability cap to value.
void cinder::gl::Context::pushBoolState | ( | GLenum | cap | ) |
Duplicates and pushes the state stack for OpenGL capability cap.
void cinder::gl::Context::popBoolState | ( | GLenum | cap, |
bool | forceRestore = false |
||
) |
Pops the state stack for OpenGL capability cap. If forceRestore then redundancy checks are skipped and the hardware state is always set.
void cinder::gl::Context::enable | ( | GLenum | cap, |
GLboolean | value = true |
||
) |
Synonym for setBoolState(). Enables or disables OpenGL capability cap.
GLboolean cinder::gl::Context::getBoolState | ( | GLenum | cap | ) |
Analogous to glIsEnabled(). Returns whether a given OpenGL capability is enabled or not.
void cinder::gl::Context::setBoolState | ( | GLenum | cap, |
GLboolean | value, | ||
const std::function< void(GLboolean)> & | setter | ||
) |
Enables or disables OpenGL capability cap. Calls setter rather than glEnable or glDisable. Not generally necessary to call directly.
void cinder::gl::Context::blendFunc | ( | GLenum | sfactor, |
GLenum | dfactor | ||
) |
Analogous glBlendFunc(). Consider using a ScopedBlend instead.
void cinder::gl::Context::blendFuncSeparate | ( | GLenum | srcRGB, |
GLenum | dstRGB, | ||
GLenum | srcAlpha, | ||
GLenum | dstAlpha | ||
) |
Analogous to glBlendFuncSeparate(). Consider using a ScopedBlend instead.
void cinder::gl::Context::pushBlendFuncSeparate | ( | GLenum | srcRGB, |
GLenum | dstRGB, | ||
GLenum | srcAlpha, | ||
GLenum | dstAlpha | ||
) |
Analogous to glBlendFuncSeparate, but pushes values rather than replaces them.
void cinder::gl::Context::pushBlendFuncSeparate | ( | ) |
Duplicates and pushes the glBlendFunc state stack.
void cinder::gl::Context::popBlendFuncSeparate | ( | bool | forceRestore = false | ) |
Pops the current blend functions. If forceRestore then redundancy checks are skipped and the hardware state is always set.
void cinder::gl::Context::getBlendFuncSeparate | ( | GLenum * | resultSrcRGB, |
GLenum * | resultDstRGB, | ||
GLenum * | resultSrcAlpha, | ||
GLenum * | resultDstAlpha | ||
) |
Returns the current values for glBendFuncs.
void cinder::gl::Context::lineWidth | ( | float | lineWidth | ) |
Sets the current line width.
void cinder::gl::Context::pushLineWidth | ( | float | lineWidth | ) |
Pushes and sets the current line width.
void cinder::gl::Context::pushLineWidth | ( | ) |
Duplicates and pushes the current line width.
void cinder::gl::Context::popLineWidth | ( | bool | forceRestore = false | ) |
Sets the current line width. If forceRestore then redundancy checks are skipped and the hardware state is always set.
float cinder::gl::Context::getLineWidth | ( | ) |
Returns the current line width.
void cinder::gl::Context::depthMask | ( | GLboolean | enable | ) |
Analogous to glDepthMask(). Enables or disables writing into the depth buffer.
void cinder::gl::Context::pushDepthMask | ( | GLboolean | enable | ) |
Push the depth buffer writing flag.
void cinder::gl::Context::pushDepthMask | ( | ) |
Push the depth buffer writing flag.
void cinder::gl::Context::popDepthMask | ( | bool | forceRestore = false | ) |
Pops the depth buffer writing flag. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLboolean cinder::gl::Context::getDepthMask | ( | ) |
Returns the depth buffer writing flag.
void cinder::gl::Context::depthFunc | ( | GLenum | func | ) |
Set the depth buffer comparison function. Analogous to glDepthFunc(). Valid arguments are GL_NEVER
, GL_LESS
, GL_EQUAL
, GL_LEQUAL
, GL_GREATER
, GL_NOTEQUAL
, GL_GEQUAL
and GL_ALWAYS
. Default is GL_LESS
.
void cinder::gl::Context::pushDepthFunc | ( | GLenum | func | ) |
Push the depth buffer comparison function. Valid arguments are GL_NEVER
, GL_LESS
, GL_EQUAL
, GL_LEQUAL
, GL_GREATER
, GL_NOTEQUAL
, GL_GEQUAL
and GL_ALWAYS
. Default is GL_LESS
.
void cinder::gl::Context::pushDepthFunc | ( | ) |
Push the depth buffer comparison function.
void cinder::gl::Context::popDepthFunc | ( | bool | forceRestore = false | ) |
Pops the depth buffer comparison function. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLenum cinder::gl::Context::getDepthFunc | ( | ) |
Returns the depth buffer comparison function, either GL_NEVER
, GL_LESS
, GL_EQUAL
, GL_LEQUAL
, GL_GREATER
, GL_NOTEQUAL
, GL_GEQUAL
or GL_ALWAYS
.
void cinder::gl::Context::polygonMode | ( | GLenum | face, |
GLenum | mode | ||
) |
Sets the current polygon rasterization mode. face must be GL_FRONT_AND_BACK
. GL_POINT
, GL_LINE
& GL_FILL
are legal values for mode.
void cinder::gl::Context::pushPolygonMode | ( | GLenum | face, |
GLenum | mode | ||
) |
Pushes the current polygon rasterization mode. face must be GL_FRONT_AND_BACK
. GL_POINT
, GL_LINE
& GL_FILL
are legal values for mode.
void cinder::gl::Context::pushPolygonMode | ( | GLenum | face | ) |
Pushes the current polygon rasterization mode. face must be GL_FRONT_AND_BACK
.
void cinder::gl::Context::popPolygonMode | ( | GLenum | face, |
bool | forceRestore = false |
||
) |
Pops the current polygon rasterization mode. face must be GL_FRONT_AND_BACK
. If forceRestore then redundancy checks are skipped and the hardware state is always set.
GLenum cinder::gl::Context::getPolygonMode | ( | GLenum | face | ) |
Returns the current polygon rasterization mode. face must be GL_FRONT_AND_BACK
.
void cinder::gl::Context::sanityCheck | ( | ) |
void cinder::gl::Context::printState | ( | std::ostream & | os | ) | const |
const std::set<const TextureBase*>& cinder::gl::Context::getLiveTextures | ( | ) | const |
Returns the container of live Textures. Requires object tracking to be enabled.
const std::set<const BufferObj*>& cinder::gl::Context::getLiveBuffers | ( | ) | const |
Returns the container of live BufferObjs. Requires object tracking to be enabled.
const std::set<const GlslProg*>& cinder::gl::Context::getLiveGlslProgs | ( | ) | const |
Returns the container of live GlslProgs. Requires object tracking to be enabled.
const std::set<const Vao*>& cinder::gl::Context::getLiveVaos | ( | ) | const |
Returns the container of live Vaos. Requires object tracking to be enabled.
const std::set<const Fbo*>& cinder::gl::Context::getLiveFbos | ( | ) | const |
Returns the container of live Fbos. Requires object tracking to be enabled.
void cinder::gl::Context::enableVertexAttribArray | ( | GLuint | index | ) |
Analogous to glEnableVertexAttribArray()
void cinder::gl::Context::disableVertexAttribArray | ( | GLuint | index | ) |
Analogous to glDisableVertexAttribArray()
void cinder::gl::Context::vertexAttribPointer | ( | GLuint | index, |
GLint | size, | ||
GLenum | type, | ||
GLboolean | normalized, | ||
GLsizei | stride, | ||
const GLvoid * | pointer | ||
) |
Analogous to glVertexAttribPointer()
void cinder::gl::Context::vertexAttribIPointer | ( | GLuint | index, |
GLint | size, | ||
GLenum | type, | ||
GLsizei | stride, | ||
const GLvoid * | pointer | ||
) |
Analogous to glVertexAttribIPointer()
Analogous to glVertexAttribDivisor()
void cinder::gl::Context::vertexAttrib1f | ( | GLuint | index, |
float | v0 | ||
) |
Analogous to glVertexAttrib1f()
void cinder::gl::Context::vertexAttrib2f | ( | GLuint | index, |
float | v0, | ||
float | v1 | ||
) |
Analogous to glVertexAttrib2f()
void cinder::gl::Context::vertexAttrib3f | ( | GLuint | index, |
float | v0, | ||
float | v1, | ||
float | v2 | ||
) |
Analogous to glVertexAttrib3f()
void cinder::gl::Context::vertexAttrib4f | ( | GLuint | index, |
float | v0, | ||
float | v1, | ||
float | v2, | ||
float | v3 | ||
) |
Analogous to glVertexAttrib4f()
void cinder::gl::Context::drawArrays | ( | GLenum | mode, |
GLint | first, | ||
GLsizei | count | ||
) |
Analogous to glDrawArrays()
void cinder::gl::Context::drawElements | ( | GLenum | mode, |
GLsizei | count, | ||
GLenum | type, | ||
const GLvoid * | indices | ||
) |
Analogous to glDrawElements()
const ColorAf& cinder::gl::Context::getCurrentColor | ( | ) | const |
Returns the current active color, used in immediate-mode emulation and as UNIFORM_COLOR.
void cinder::gl::Context::setCurrentColor | ( | const ColorAf & | color | ) |
GlslProgRef & cinder::gl::Context::getStockShader | ( | const ShaderDef & | shaderDef | ) |
void cinder::gl::Context::setDefaultShaderVars | ( | ) |
VboRef cinder::gl::Context::getDefaultArrayVbo | ( | size_t | requiredSize = 0 | ) |
Returns default VBO for vertex array data, ensuring it is at least requiredSize bytes. Designed for use with convenience functions.
VboRef cinder::gl::Context::getDefaultElementVbo | ( | size_t | requiredSize = 0 | ) |
Returns default VBO for element array data, ensuring it is at least requiredSize bytes. Designed for use with convenience functions.
Vao * cinder::gl::Context::getDefaultVao | ( | ) |
Returns default VAO, designed for use with convenience functions.
VboRef cinder::gl::Context::getDrawTextureVbo | ( | ) |
Returns a VBO for drawing textured rectangles; used by gl::draw(TextureRef)
Vao * cinder::gl::Context::getDrawTextureVao | ( | ) |
Returns a VBO for drawing textured rectangles; used by gl::draw(TextureRef)
VertBatch& cinder::gl::Context::immediate | ( | ) |
Returns a reference to the immediate mode emulation structure. Generally use gl::begin() and friends instead.
|
protected |
Returns true
if value is different from the previous top of the stack.
|
protected |
Returns true
if the new top of stack is different from the previous top, or the stack is empty.
|
protected |
Returns true
if value is different from the previous top of the stack.
|
protected |
Returns true
if result is valid; will return false
when stack was empty.
|
protected |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |