From 7fad840bbbde36bdb13c766f6dcecdc3ced4cfcf Mon Sep 17 00:00:00 2001 From: Lars Krecklau Date: Fri, 19 Aug 2011 15:52:41 +0200 Subject: [PATCH] -Added setters to the viewport to change the size and the offset --- include/ACGL/OpenGL/Objects/State.hh | 2 +- include/ACGL/OpenGL/Objects/Viewport.hh | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/ACGL/OpenGL/Objects/State.hh b/include/ACGL/OpenGL/Objects/State.hh index be8c9e3..fcdf672 100644 --- a/include/ACGL/OpenGL/Objects/State.hh +++ b/include/ACGL/OpenGL/Objects/State.hh @@ -88,7 +88,7 @@ public: // ============================================================================================ METHODS \/ // ==================================================================================================== \/ public: - void updateMappings (void); + void updateMappings (void); void useViewport (void) const; void useShaderProgramObject (void) const; diff --git a/include/ACGL/OpenGL/Objects/Viewport.hh b/include/ACGL/OpenGL/Objects/Viewport.hh index b96a033..525b647 100644 --- a/include/ACGL/OpenGL/Objects/Viewport.hh +++ b/include/ACGL/OpenGL/Objects/Viewport.hh @@ -27,10 +27,10 @@ class Viewport // ============================================================================================ CONSTRUCTORS \/ // ========================================================================================================= \/ public: - Viewport(GLint _offsetX, - GLint _offsetY, - GLsizei _width, - GLsizei _height) + Viewport(GLint _offsetX = 0, + GLint _offsetY = 0, + GLsizei _width = 0, + GLsizei _height = 0) : mOffsetX(_offsetX), mOffsetY(_offsetY), mWidth(_width), @@ -57,6 +57,18 @@ public: glViewport(mOffsetX, mOffsetY, mWidth, mHeight); } + inline void setOffset (GLint _offsetX, GLint _offsetY) + { + mOffsetX = _offsetX; + mOffsetY = _offsetY; + } + + inline void setSize (GLsizei _width, GLsizei _height) + { + mWidth = _width; + mHeight = _height; + } + // =================================================================================================== \/ // ============================================================================================ FIELDS \/ // =================================================================================================== \/ -- GitLab