28 #include "graphics/opengl/glutil.h"
57 struct GLDevicePrivate;
79 virtual bool Create() OVERRIDE;
80 virtual void Destroy() OVERRIDE;
84 void SetUseVbo(
bool useVbo);
90 virtual void Clear() OVERRIDE;
97 virtual void SetLight(
int index,
const Light &light) OVERRIDE;
108 virtual void SetTexture(
int index,
unsigned int textureId) OVERRIDE;
117 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) OVERRIDE;
119 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) OVERRIDE;
133 virtual void SetViewport(
int x,
int y,
int width,
int height) OVERRIDE;
137 virtual void SetColorMask(
bool red,
bool green,
bool blue,
bool alpha) OVERRIDE;
141 virtual void SetDepthBias(
float factor,
float units) OVERRIDE;
171 void UpdateModelviewMatrix();
173 void UpdateLightPosition(
int index);
175 void UpdateTextureParams(
int index);
196 std::vector<Light> m_lights;
198 std::vector<bool> m_lightsEnabled;
201 std::vector<Texture> m_currentTextures;
203 std::vector<bool> m_texturesEnabled;
205 std::vector<TextureStageParams> m_textureStageParams;
208 std::set<Texture> m_allTextures;
222 unsigned int bufferId;
223 VertexType vertexType;
229 int m_glMajor, m_glMinor;
233 bool m_shadowAmbientSupported;
235 bool m_multitextureAvailable;
239 bool m_anisotropyAvailable;
243 bool m_framebufferObject;
247 std::map<unsigned int, VboObjectInfo> m_vboObjects;
249 unsigned int m_lastVboId;
253 GLuint m_framebuffer;
255 GLuint m_colorBuffer;
257 GLuint m_depthBuffer;
259 int m_maxRenderbufferSize;
261 bool m_offscreenRenderingEnabled;
virtual void SetFillMode(FillMode mode) OVERRIDE
Sets the current fill mode.
Definition: gldevice.cpp:1845
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) OVERRIDE
Sets only the texture wrap modes (for faster than thru stage params)
Definition: gldevice.cpp:1153
Additional config with OpenGL-specific settings.
Definition: glutil.h:48
virtual void EndScene() OVERRIDE
Ends drawing the 3D scene.
Definition: gldevice.cpp:371
virtual void InitOffscreenBuffer(int width, int height) OVERRIDE
Initializes offscreen buffer.
Definition: gldevice.cpp:1853
virtual void SetTextureCoordGeneration(int index, TextureGenerationParams ¶ms) OVERRIDE
Sets the texture coordinate generation mode for given texture unit.
Definition: gldevice.cpp:936
virtual void SetShadeModel(ShadeModel model) OVERRIDE
Sets the shade model.
Definition: gldevice.cpp:1833
virtual void SetShadowColor(float value) OVERRIDE
Sets shadow color.
Definition: gldevice.cpp:1840
virtual void SetTransform(TransformType type, const Math::Matrix &matrix) OVERRIDE
Sets the transform matrix of given type.
Definition: gldevice.cpp:381
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) OVERRIDE
Updates the static buffer composed of given primitives with single texture vertices.
Definition: gldevice.cpp:1400
virtual void SetClearColor(const Color &color) OVERRIDE
Sets the clear color.
Definition: gldevice.cpp:1801
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) OVERRIDE
Definition: gldevice.cpp:531
Vertex of a primitive.
Definition: vertex.h:51
Vertex with secondary texture coordinates.
Definition: vertex.h:112
virtual int GetMaxLightCount() OVERRIDE
Returns the maximum number of lights available.
Definition: gldevice.cpp:440
ARB extension.
Definition: gldevice.h:54
FogMode
Type of fog calculation function.
Definition: device.h:154
virtual void SetGlobalAmbient(const Color &color) OVERRIDE
Sets the global ambient color.
Definition: gldevice.cpp:1806
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius) OVERRIDE
Definition: gldevice.cpp:1629
virtual void SetRenderTexture(RenderTarget target, int texture) OVERRIDE
Sets render target to texture.
Definition: gldevice.cpp:1889
4x4 matrix
Definition: matrix.h:66
TexWrapMode
Wrapping mode for texture coords.
Definition: texture.h:98
virtual void SetLightEnabled(int index, bool enabled) OVERRIDE
Enables/disables the light at given index.
Definition: gldevice.cpp:515
virtual void SetColorMask(bool red, bool green, bool blue, bool alpha) OVERRIDE
Sets the color mask.
Definition: gldevice.cpp:1776
FillMode
Polygon fill mode.
Definition: device.h:187
ShadowMappingSupport
Definition: gldevice.h:50
virtual void SetAlphaTestFunc(CompFunc func, float refValue) OVERRIDE
Sets the alpha test function and reference value.
Definition: gldevice.cpp:1791
virtual void DestroyTexture(const Texture &texture) OVERRIDE
Deletes a given texture, freeing it from video memory.
Definition: gldevice.cpp:818
Implementation of CDevice interface in OpenGL.
Definition: gldevice.h:70
virtual int GetMaxTextureStageCount() OVERRIDE
Returns the maximum number of multitexture stages.
Definition: gldevice.cpp:846
use display lists
Definition: gldevice.h:46
CompFunc
Type of function used to compare values.
Definition: device.h:119
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) OVERRIDE
Sets the fog parameters: mode, color, start distance, end distance and density (for exp models) ...
Definition: gldevice.cpp:1811
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) OVERRIDE
Sets the blending functions for source and destination operations.
Definition: gldevice.cpp:1796
virtual void DebugLights() OVERRIDE
Displays light positions to aid in debuggings.
Definition: gldevice.cpp:72
virtual void DestroyStaticBuffer(unsigned int bufferId) OVERRIDE
Deletes a static buffer.
Definition: gldevice.cpp:1606
virtual void SetMaterial(const Material &material) OVERRIDE
Sets the current material.
Definition: gldevice.cpp:431
Parameters for a texture unit.
Definition: texture.h:187
virtual void SetRenderState(RenderState state, bool enabled) OVERRIDE
Enables/disables the given render state.
Definition: gldevice.cpp:1713
Material of a surface.
Definition: material.h:44
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) OVERRIDE
Creates a static buffer composed of given primitives with single texture vertices.
Definition: gldevice.cpp:1268
Parameters for texture coordinate generation.
Definition: texture.h:253
No support for depth textures.
Definition: gldevice.h:53
VertexBufferType
Specifies type of vertex buffer to use.
Definition: gldevice.h:43
virtual void * GetFrameBufferPixels() const OVERRIDE
Returns the pixels of the entire screen.
Definition: gldevice.cpp:1941
virtual void DebugHook() OVERRIDE
Provides a hook to debug graphics code (implementation-specific)
Definition: gldevice.cpp:65
Properties of light in 3D scene.
Definition: light.h:53
virtual void DestroyAllTextures() OVERRIDE
Deletes all textures created so far.
Definition: gldevice.cpp:834
virtual void SetDepthBias(float factor, float units) OVERRIDE
Sets the depth bias (constant value added to Z-coords)
Definition: gldevice.cpp:1786
virtual void SetViewport(int x, int y, int width, int height) OVERRIDE
Changes rendering viewport.
Definition: gldevice.cpp:1708
Parameters for texture creation.
Definition: texture.h:154
ShadeModel
Shade model used in rendering.
Definition: device.h:177
BlendFunc
Type of blending function.
Definition: device.h:135
virtual bool Create() OVERRIDE
Initializes the device, setting the initial state.
Definition: gldevice.cpp:172
Image loaded from file.
Definition: image.h:57
virtual void CopyFramebufferToTexture(Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height) OVERRIDE
Copies content of framebuffer to texture.
Definition: gldevice.cpp:1926
PrimitiveType
Type of primitive to render.
Definition: device.h:201
virtual void SetLight(int index, const Light &light) OVERRIDE
Sets the light at given index.
Definition: gldevice.cpp:445
virtual Texture CreateDepthTexture(int width, int height, int depth) OVERRIDE
Creates a depth texture with specific dimensions and depth.
Definition: gldevice.cpp:738
CullMode
Culling mode for polygons.
Definition: device.h:165
use core OpenGL 1.5 VBOs
Definition: gldevice.h:47
Colored vertex.
Definition: vertex.h:83
virtual void SetCullMode(CullMode mode) OVERRIDE
Sets the current cull mode.
Definition: gldevice.cpp:1824
Namespace for (new) graphics code.
Definition: app.h:49
Implementation-specific image data.
Definition: image.h:42
virtual void SetTextureEnabled(int index, bool enabled) OVERRIDE
Enables/disables the given texture stage.
Definition: gldevice.cpp:899
RenderState
Render states that can be enabled/disabled.
Definition: device.h:102
Info about a texture.
Definition: texture.h:282
virtual void SetTexture(int index, const Texture &texture) OVERRIDE
Definition: gldevice.cpp:855
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms) OVERRIDE
Definition: gldevice.cpp:926
virtual void Destroy() OVERRIDE
Destroys the device, releasing every acquired resource.
Definition: gldevice.cpp:325
3D (3x1) vector
Definition: vector.h:52
Abstract graphics device - CDevice class and related structs/enums.
virtual void Clear() OVERRIDE
Clears the screen to blank.
Definition: gldevice.cpp:375
virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices, int vertexCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) OVERRIDE
Renders primitive composed of vertices with single texture.
Definition: gldevice.cpp:1188
RGBA color.
Definition: color.h:38
virtual void DrawStaticBuffer(unsigned int bufferId) OVERRIDE
Draws a static buffer.
Definition: gldevice.cpp:1508
virtual void SetDepthTestFunc(CompFunc func) OVERRIDE
Sets the function of depth test.
Definition: gldevice.cpp:1781
TransformType
Type of transformation in rendering pipeline.
Definition: device.h:90
Abstract interface of graphics device.
Definition: device.h:251
virtual void BeginScene() OVERRIDE
Begins drawing the 3D scene.
Definition: gldevice.cpp:361
RenderTarget
Render targets for rendering to textures.
Definition: device.h:233