diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp | |
| download | Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2 | |
Diffstat (limited to 'Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp')
| -rw-r--r-- | Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp b/Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp new file mode 100644 index 0000000..4d7c027 --- /dev/null +++ b/Master/Real-Time Systems/RTS_A8/src/ApplicationWindow.cpp @@ -0,0 +1,84 @@ +/* + * ApplicationWindow.cpp + * + * Created on: 01.12.2010 + * Author: sven + */ +#include <GL/gl.h> +#include <GL/glut.h> +#include "ApplicationWindow.h" + +ApplicationWindow::ApplicationWindow(int width,int height,int bpp) +:mWidth(width),mHeight(height),mBpp(bpp),mCaption("RTS_A8"),mState(0) +{ +} + +ApplicationWindow::~ApplicationWindow() +{ + destroy(); +} + +bool ApplicationWindow::create() +{ + int a=0; + glutInit(&a, NULL); + glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE); + glutInitWindowSize(mWidth, mHeight); + glutCreateWindow(mCaption.c_str()); + + /* + * Now Initialize OpenGL (ES) + */ + glEnable(GL_LINE_SMOOTH); + glShadeModel(GL_SMOOTH); + glDisable(GL_ALPHA_TEST); + glAlphaFunc(GL_EQUAL, 1.0f); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glViewport(0, 0, mWidth, mHeight); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glClearColor(0.0f,0.0f,0.0f,1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // ist das hier notwendig? + glOrtho(0, mWidth, 0, mHeight, 0, 100); + + return true; +} + +//-------------------------------------------------------------------- +bool ApplicationWindow::destroy() +{ + return true; +} + +//-------------------------------------------------------------------- +void ApplicationWindow::setResolution( int width, int height ) +{ + mWidth = width; + mHeight = height; +} + +//-------------------------------------------------------------------- +void ApplicationWindow::setColorDepth( int bpp ) +{ + mBpp = bpp; +} + +//-------------------------------------------------------------------- +void ApplicationWindow::setCaption( const std::string& caption ) +{ + mCaption = caption; +} + +void ApplicationWindow::setFullscreen( bool enable ) +{ + if( enable ) + { + mState |= FULL_SCREEN; + } + else + { + mState &= ~FULL_SCREEN; + } +} |
