Skip to content

Commit d17ba23

Browse files
authored
ofScopedMatrix (#7946)
#changelog #gl
1 parent 4621d70 commit d17ba23

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

libs/openFrameworks/graphics/ofGraphics.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,24 @@ void ofPushMatrix();
972972
/// \sa ofPushMatrix()
973973
void ofPopMatrix();
974974

975+
/// \brief Manages a an ofPush/Pop Matrix cycle with an anonymous scoped object
976+
///
977+
struct ofScopedMatrix {
978+
ofScopedMatrix() { ofPushMatrix(); }
979+
~ofScopedMatrix() { ofPopMatrix(); }
980+
};
981+
982+
/// \brief Manages a an ofPush/Pop Style cycle with an anonymous scoped object
983+
///
984+
struct ofScopedStyle {
985+
ofScopedStyle() { ofPushStyle(); }
986+
~ofScopedStyle() { ofPopStyle(); }
987+
};
988+
989+
/// \brief Combines ofScopeMatrix and Style
990+
///
991+
struct ofScopedMatrixStyle: public ofScopedMatrix, public ofScopedStyle { };
992+
975993
/// \brief Query the current (oF internal) Transformation Matrix state.
976994
glm::mat4 ofGetCurrentMatrix(ofMatrixMode matrixMode);
977995

0 commit comments

Comments
 (0)