76 struct GLDevicePrivate;
103 void SetUseVbo(
bool useVbo);
109 virtual void Clear();
131 virtual void SetTexture(
int index,
unsigned int textureId);
193 void UpdateModelviewMatrix();
195 void UpdateLightPosition(
int index);
197 void UpdateTextureParams(
int index);
218 std::vector<Light> m_lights;
220 std::vector<bool> m_lightsEnabled;
223 std::vector<Texture> m_currentTextures;
225 std::vector<bool> m_texturesEnabled;
227 std::vector<TextureStageParams> m_textureStageParams;
230 std::set<Texture> m_allTextures;
244 unsigned int bufferId;
245 VertexType vertexType;
250 bool m_multitextureAvailable;
254 std::map<unsigned int, VboObjectInfo> m_vboObjects;
256 unsigned int m_lastVboId;
virtual const Math::Matrix & GetTransform(TransformType type)
Returns the current transform matrix of given type.
Definition: gldevice.cpp:342
Additional config with OpenGL-specific settings.
Definition: gldevice.h:50
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend)
Sets the blending functions for source and destination operations.
Definition: gldevice.cpp:1669
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density)
Sets the fog parameters: mode, color, start distance, end distance and density (for exp models) ...
Definition: gldevice.cpp:1709
virtual int GetMaxTextureStageCount()
Returns the maximum number of multitexture stages.
Definition: gldevice.cpp:731
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex *vertices, int vertexCount)
Updates the static buffer composed of given primitives with single texture vertices.
Definition: gldevice.cpp:1209
virtual void SetShadeModel(ShadeModel model)
Sets the shade model.
Definition: gldevice.cpp:1758
virtual void SetGlobalAmbient(const Color &color)
Sets the global ambient color.
Definition: gldevice.cpp:1697
virtual CullMode GetCullMode()
Returns the current cull mode.
Definition: gldevice.cpp:1748
GLDeviceConfig()
Constructor calls LoadDefaults()
Definition: gldevice.cpp:38
virtual int GetMaxLightCount()
Returns the maximum number of lights available.
Definition: gldevice.cpp:410
Vertex of a primitive.
Definition: vertex.h:48
Vertex with secondary texture coordinates.
Definition: vertex.h:107
int depthSize
Color depth in bits.
Definition: gldevice.h:61
int redSize
Size of red channel in bits.
Definition: gldevice.h:53
virtual bool Create()
Initializes the device, setting the initial state.
Definition: gldevice.cpp:182
int blueSize
Size of blue channel in bits.
Definition: gldevice.h:57
FogMode
Type of fog calculation function.
Definition: device.h:149
virtual void DrawStaticBuffer(unsigned int bufferId)
Draws a static buffer.
Definition: gldevice.cpp:1290
virtual bool GetRenderState(RenderState state)
Returns the current setting of given render state.
Definition: gldevice.cpp:1532
4x4 matrix
Definition: matrix.h:63
virtual void SetLight(int index, const Light &light)
Sets the light at given index.
Definition: gldevice.cpp:415
virtual FillMode GetFillMode()
Returns the current fill mode.
Definition: gldevice.cpp:1783
virtual void SetLightEnabled(int index, bool enabled)
Enables/disables the light at given index.
Definition: gldevice.cpp:493
TexWrapMode
Wrapping mode for texture coords.
Definition: texture.h:82
virtual void SetTexture(int index, const Texture &texture)
Definition: gldevice.cpp:740
virtual void DestroyStaticBuffer(unsigned int bufferId)
Deletes a static buffer.
Definition: gldevice.cpp:1380
FillMode
Polygon fill mode.
Definition: device.h:182
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius)
Definition: gldevice.cpp:1410
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue)
Returns the current alpha test function and reference value.
Definition: gldevice.cpp:1619
virtual void SetAlphaTestFunc(CompFunc func, float refValue)
Sets the alpha test function and reference value.
Definition: gldevice.cpp:1614
Implementation of CDevice interface in OpenGL.
Definition: gldevice.h:89
CompFunc
Type of function used to compare values.
Definition: device.h:114
virtual Color GetGlobalAmbient()
Returns the global ambient color.
Definition: gldevice.cpp:1702
Parameters for a texture unit.
Definition: texture.h:165
Material of a surface.
Definition: material.h:41
virtual Texture GetTexture(int index)
Definition: gldevice.cpp:786
< override: disable
Definition: gldevice.h:44
virtual bool GetLightEnabled(int index)
Returns the current enable state of light at given index.
Definition: gldevice.cpp:506
virtual TextureStageParams GetTextureStageParams(int index)
Returns the current params of texture stage with given index.
Definition: gldevice.cpp:1005
virtual void SetRenderState(RenderState state, bool enabled)
Enables/disables the given render state.
Definition: gldevice.cpp:1489
virtual float GetDepthBias()
Returns the current depth bias.
Definition: gldevice.cpp:1607
virtual void SetCullMode(CullMode mode)
Sets the current cull mode.
Definition: gldevice.cpp:1739
virtual const Light & GetLight(int index)
Returns the current light at given index.
Definition: gldevice.cpp:485
General config for graphics device.
Definition: device.h:51
Properties of light in 3D scene.
Definition: light.h:51
virtual void DebugHook()
Provides a hook to debug graphics code (implementation-specific)
Definition: gldevice.cpp:75
Parameters for texture creation.
Definition: texture.h:129
ShadeModel
Shade model used in rendering.
Definition: device.h:172
virtual void SetMaterial(const Material &material)
Sets the current material.
Definition: gldevice.cpp:396
BlendFunc
Type of blending function.
Definition: device.h:130
int alphaSize
Size of alpha channel in bits.
Definition: gldevice.h:59
< override: enable
Definition: gldevice.h:43
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density)
Returns the current fog parameters: mode, color, start distance, end distance and density (for exp mo...
Definition: gldevice.cpp:1722
virtual void SetTransform(TransformType type, const Math::Matrix &matrix)
Sets the transform matrix of given type.
Definition: gldevice.cpp:318
virtual void SetFillMode(FillMode mode)
Sets the current fill mode.
Definition: gldevice.cpp:1775
virtual const Material & GetMaterial()
Returns the current material.
Definition: gldevice.cpp:405
virtual void Clear()
Clears the screen to blank.
Definition: gldevice.cpp:312
virtual void SetClearColor(const Color &color)
Sets the clear color.
Definition: gldevice.cpp:1685
Image loaded from file.
Definition: image.h:54
virtual ShadeModel GetShadeModel()
Returns the current shade model.
Definition: gldevice.cpp:1765
PrimitiveType
Type of primitive to render.
Definition: device.h:196
CullMode
Culling mode for polygons.
Definition: device.h:160
Colored vertex.
Definition: vertex.h:80
virtual void DestroyTexture(const Texture &texture)
Deletes a given texture, freeing it from video memory.
Definition: gldevice.cpp:703
VBOMode
VBO autodetect/override.
Definition: gldevice.h:40
int greenSize
Size of green channel in bits.
Definition: gldevice.h:55
Implementation-specific image data.
Definition: image.h:39
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend)
Returns the current blending functions for source and destination operations.
Definition: gldevice.cpp:1674
virtual Color GetClearColor()
Returns the current clear color.
Definition: gldevice.cpp:1690
RenderState
Render states that can be enabled/disabled.
Definition: device.h:99
Info about a texture.
Definition: texture.h:212
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT)
Sets only the texture wrap modes (for faster than thru stage params)
Definition: gldevice.cpp:974
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex *vertices, int vertexCount)
Creates a static buffer composed of given primitives with single texture vertices.
Definition: gldevice.cpp:1107
virtual void Destroy()
Destroys the device, releasing every acquired resource.
Definition: gldevice.cpp:264
virtual void SetTextureEnabled(int index, bool enabled)
Enables/disables the given texture stage.
Definition: gldevice.cpp:793
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms)
Definition: gldevice.cpp:517
3D (3x1) vector
Definition: vector.h:49
Abstract graphics device - CDevice class and related structs/enums.
void LoadDefault()
Loads the default values.
Definition: gldevice.cpp:43
virtual bool GetTextureEnabled(int index)
Returns the current enable state of given texture stage.
Definition: gldevice.cpp:816
RGBA color.
Definition: color.h:35
virtual void EndScene()
Ends drawing the 3D scene.
Definition: gldevice.cpp:308
VBOMode vboMode
VBO override/autodetect.
Definition: gldevice.h:67
virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices, int vertexCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f))
Renders primitive composed of vertices with single texture.
Definition: gldevice.cpp:1027
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix)
Multiplies the current transform matrix of given type by given matrix.
Definition: gldevice.cpp:356
virtual void DebugLights()
Displays light positions to aid in debuggings.
Definition: gldevice.cpp:82
TransformType
Type of transformation in rendering pipeline.
Definition: device.h:88
virtual void BeginScene()
Begins drawing the 3D scene.
Definition: gldevice.cpp:298
virtual void SetDepthBias(float factor)
Sets the depth bias (constant value added to Z-coords)
Definition: gldevice.cpp:1602
bool hardwareAccel
Force hardware acceleration (video mode set will fail on lack of hw accel)
Definition: gldevice.h:64
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms)
Definition: gldevice.cpp:827
virtual CompFunc GetDepthTestFunc()
Returns the current function of depth test.
Definition: gldevice.cpp:1595
virtual void DestroyAllTextures()
Deletes all textures created so far.
Definition: gldevice.cpp:719
Abstract interface of graphics device.
Definition: device.h:235
virtual void SetDepthTestFunc(CompFunc func)
Sets the function of depth test.
Definition: gldevice.cpp:1590