/* * ApplicationWindow.cpp * * Created on: 01.12.2010 * Author: sven */ #include #include #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; } }