Colobot
glutil.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "graphics/core/device.h"
23 
24 // config.h must be included before glew.h
25 #include "common/config.h"
26 
27 #include <GL/glew.h>
28 
29 
30 // Graphics module namespace
31 namespace Gfx
32 {
33 
38 enum VBOMode
39 {
40  VBO_MODE_ENABLE,
43 };
44 
49 {
51  int redSize;
53  int greenSize;
55  int blueSize;
57  int alphaSize;
59  int depthSize;
60 
63 
66 
69 
71  void LoadDefault();
72 };
73 
76 
77 CompFunc TranslateGLCompFunc(GLenum flag);
78 
79 GLenum TranslateGfxCompFunc(CompFunc func);
80 
81 BlendFunc TranslateGLBlendFunc(GLenum flag);
82 
83 GLenum TranslateGfxBlendFunc(BlendFunc func);
84 
85 bool InPlane(Math::Vector normal, float originPlane, Math::Vector center, float radius);
86 
87 GLenum TranslateTextureCoordinate(int index);
88 
89 GLenum TranslateTextureCoordinateGen(int index);
90 
91 GLint LoadShader(GLint type, const char* filename);
92 
93 GLint LinkProgram(int count, GLint shaders[]);
94 
95 } // namespace Gfx
Additional config with OpenGL-specific settings.
Definition: glutil.h:48
GLDeviceConfig()
Constructor calls LoadDefaults()
Definition: glutil.cpp:27
int depthSize
Color depth in bits.
Definition: glutil.h:59
int redSize
Size of red channel in bits.
Definition: glutil.h:51
int blueSize
Size of blue channel in bits.
Definition: glutil.h:55
CompFunc
Type of function used to compare values.
Definition: device.h:119
< override: disable
Definition: glutil.h:42
General config for graphics device.
Definition: device.h:53
BlendFunc
Type of blending function.
Definition: device.h:135
int alphaSize
Size of alpha channel in bits.
Definition: glutil.h:57
< override: enable
Definition: glutil.h:41
GLenum TranslateGfxPrimitive(PrimitiveType type)
Translate Gfx primitive type to OpenGL primitive type.
Definition: glutil.cpp:50
PrimitiveType
Type of primitive to render.
Definition: device.h:201
VBOMode
VBO autodetect/override.
Definition: glutil.h:38
Namespace for (new) graphics code.
Definition: app.h:49
int greenSize
Size of green channel in bits.
Definition: glutil.h:53
3D (3x1) vector
Definition: vector.h:52
Abstract graphics device - CDevice class and related structs/enums.
void LoadDefault()
Loads the default values.
Definition: glutil.cpp:35
VBOMode vboMode
VBO override/autodetect.
Definition: glutil.h:65
bool hardwareAccel
Force hardware acceleration (video mode set will fail on lack of hw accel)
Definition: glutil.h:62