1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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;
}
}
|