Colobot
|
Implementation of CDevice interface in OpenGL. More...
#include <gl14device.h>
Public Member Functions | |
CGL14Device (const DeviceConfig &config) | |
void | DebugHook () override |
Provides a hook to debug graphics code (implementation-specific) More... | |
void | DebugLights () override |
Displays light positions to aid in debuggings. More... | |
std::string | GetName () override |
Returns a name of this device. More... | |
bool | Create () override |
Initializes the device, setting the initial state. More... | |
void | Destroy () override |
Destroys the device, releasing every acquired resource. More... | |
void | ConfigChanged (const DeviceConfig &newConfig) override |
Changes configuration. More... | |
void | BeginScene () override |
Begins drawing the 3D scene. More... | |
void | EndScene () override |
Ends drawing the 3D scene. More... | |
void | Clear () override |
Clears the screen to blank. More... | |
void | SetRenderMode (RenderMode mode) override |
Sets current rendering mode. More... | |
void | SetTransform (TransformType type, const Math::Matrix &matrix) override |
Sets the transform matrix of given type. More... | |
void | SetMaterial (const Material &material) override |
Sets the current material. More... | |
int | GetMaxLightCount () override |
Returns the maximum number of lights available. More... | |
void | SetLight (int index, const Light &light) override |
Sets the light at given index. More... | |
void | SetLightEnabled (int index, bool enabled) override |
Enables/disables the light at given index. More... | |
Texture | CreateTexture (CImage *image, const TextureCreateParams ¶ms) override |
Texture | CreateTexture (ImageData *data, const TextureCreateParams ¶ms) override |
Creates a texture from raw image data; image data can be freed after that. More... | |
Texture | CreateDepthTexture (int width, int height, int depth) override |
Creates a depth texture with specific dimensions and depth. More... | |
void | UpdateTexture (const Texture &texture, Math::IntPoint offset, ImageData *data, TexImgFormat format) override |
Updates a part of texture from raw image data. More... | |
void | DestroyTexture (const Texture &texture) override |
Deletes a given texture, freeing it from video memory. More... | |
void | DestroyAllTextures () override |
Deletes all textures created so far. More... | |
int | GetMaxTextureStageCount () override |
Returns the maximum number of multitexture stages. More... | |
void | SetTexture (int index, const Texture &texture) override |
void | SetTexture (int index, unsigned int textureId) override |
Sets the texture image by ID at given texture stage. More... | |
void | SetTextureEnabled (int index, bool enabled) override |
Enables/disables the given texture stage. More... | |
void | SetTextureStageParams (int index, const TextureStageParams ¶ms) override |
void | SetTextureStageWrap (int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) override |
Sets only the texture wrap modes (for faster than thru stage params) More... | |
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. More... | |
virtual void | DrawPrimitive (PrimitiveType type, const VertexTex2 *vertices, int vertexCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override |
Renders primitive composed of vertices with multitexturing (2 textures) More... | |
virtual void | DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount) override |
Renders primitive composed of vertices with solid color. More... | |
virtual void | DrawPrimitives (PrimitiveType type, const Vertex *vertices, int first[], int count[], int drawCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override |
Renders primitives composed of lists of vertices with single texture. More... | |
virtual void | DrawPrimitives (PrimitiveType type, const VertexTex2 *vertices, int first[], int count[], int drawCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override |
Renders primitives composed of lists of vertices with multitexturing (2 textures) More... | |
virtual void | DrawPrimitives (PrimitiveType type, const VertexCol *vertices, int first[], int count[], int drawCount) override |
Renders primitives composed of lists of vertices with solid color. More... | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with single texture vertices. More... | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with multitexturing. More... | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with solid color. More... | |
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. More... | |
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override |
Updates the static buffer composed of given primitives with multitexturing. More... | |
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override |
Updates the static buffer composed of given primitives with solid color. More... | |
void | DrawStaticBuffer (unsigned int bufferId) override |
Draws a static buffer. More... | |
void | DestroyStaticBuffer (unsigned int bufferId) override |
Deletes a static buffer. More... | |
int | ComputeSphereVisibility (const Math::Vector ¢er, float radius) override |
void | SetViewport (int x, int y, int width, int height) override |
Changes rendering viewport. More... | |
void | SetRenderState (RenderState state, bool enabled) override |
Enables/disables the given render state. More... | |
void | SetColorMask (bool red, bool green, bool blue, bool alpha) override |
Sets the color mask. More... | |
void | SetDepthTestFunc (CompFunc func) override |
Sets the function of depth test. More... | |
void | SetDepthBias (float factor, float units) override |
Sets the depth bias (constant value added to Z-coords) More... | |
void | SetAlphaTestFunc (CompFunc func, float refValue) override |
Sets the alpha test function and reference value. More... | |
void | SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend) override |
Sets the blending functions for source and destination operations. More... | |
void | SetClearColor (const Color &color) override |
Sets the clear color. More... | |
void | SetGlobalAmbient (const Color &color) override |
Sets the global ambient color. More... | |
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) More... | |
void | SetCullMode (CullMode mode) override |
Sets the current cull mode. More... | |
void | SetShadeModel (ShadeModel model) override |
Sets the shade model. More... | |
void | SetShadowColor (float value) override |
Sets shadow color. More... | |
void | SetFillMode (FillMode mode) override |
Sets the current fill mode. More... | |
void | CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height) override |
Copies content of framebuffer to texture. More... | |
std::unique_ptr< CFrameBufferPixels > | GetFrameBufferPixels () const override |
Returns the pixels of the entire screen. More... | |
CFramebuffer * | GetFramebuffer (std::string name) override |
Returns framebuffer with given name or nullptr if it doesn't exist. More... | |
CFramebuffer * | CreateFramebuffer (std::string name, const FramebufferParams ¶ms) override |
Creates new framebuffer with given name or nullptr if it's not possible. More... | |
void | DeleteFramebuffer (std::string name) override |
Deletes framebuffer. More... | |
bool | IsAnisotropySupported () override |
Checks if anisotropy is supported. More... | |
int | GetMaxAnisotropyLevel () override |
Returns max anisotropy level supported. More... | |
int | GetMaxSamples () override |
Returns max samples supported. More... | |
bool | IsShadowMappingSupported () override |
Checks if shadow mapping is supported. More... | |
int | GetMaxTextureSize () override |
Returns max texture size supported. More... | |
bool | IsFramebufferSupported () override |
Checks if framebuffers are supported. More... | |
![]() | |
std::string | GetError () |
Returns last error message or empty string. More... | |
const DeviceCapabilities & | GetCapabilities () |
Returns device capabilities. More... | |
Additional Inherited Members | |
![]() | |
std::string | m_errorMessage |
DeviceCapabilities | m_capabilities |
Implementation of CDevice interface in OpenGL.
Provides the concrete implementation of 3D device in OpenGL.
This class should be initialized (by calling Initialize() ) only after setting the video mode by CApplication, once the OpenGL context is defined. Because of that, CGL14DeviceConfig is outside the CDevice class and must be set in CApplication.
|
overridevirtual |
Provides a hook to debug graphics code (implementation-specific)
Implements Gfx::CDevice.
|
overridevirtual |
Displays light positions to aid in debuggings.
Implements Gfx::CDevice.
|
overridevirtual |
Returns a name of this device.
Implements Gfx::CDevice.
|
overridevirtual |
Initializes the device, setting the initial state.
Implements Gfx::CDevice.
|
overridevirtual |
Destroys the device, releasing every acquired resource.
Implements Gfx::CDevice.
|
overridevirtual |
Changes configuration.
Implements Gfx::CDevice.
|
overridevirtual |
Begins drawing the 3D scene.
Implements Gfx::CDevice.
|
overridevirtual |
Ends drawing the 3D scene.
Implements Gfx::CDevice.
|
overridevirtual |
Clears the screen to blank.
Implements Gfx::CDevice.
|
overridevirtual |
Sets current rendering mode.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the transform matrix of given type.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the current material.
Implements Gfx::CDevice.
|
overridevirtual |
Returns the maximum number of lights available.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the light at given index.
Implements Gfx::CDevice.
|
overridevirtual |
Enables/disables the light at given index.
Implements Gfx::CDevice.
|
overridevirtual |
If image is invalid, returns invalid texture. Otherwise, returns pointer to new Texture struct. This struct must not be deleted in other way than through DeleteTexture()
Implements Gfx::CDevice.
|
overridevirtual |
Creates a texture from raw image data; image data can be freed after that.
Implements Gfx::CDevice.
|
overridevirtual |
Creates a depth texture with specific dimensions and depth.
Implements Gfx::CDevice.
|
overridevirtual |
Updates a part of texture from raw image data.
Implements Gfx::CDevice.
|
overridevirtual |
Deletes a given texture, freeing it from video memory.
Implements Gfx::CDevice.
|
overridevirtual |
Deletes all textures created so far.
Implements Gfx::CDevice.
|
overridevirtual |
Returns the maximum number of multitexture stages.
Implements Gfx::CDevice.
|
overridevirtual |
If texture is invalid, unbinds the given texture. If valid, binds the texture and enables the given texture stage. The setting is remembered, even if texturing is disabled at the moment.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the texture image by ID at given texture stage.
Implements Gfx::CDevice.
|
overridevirtual |
Enables/disables the given texture stage.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the texture parameters for the given texture stage. If the given texture was not set (bound) yet, nothing happens. The settings are remembered, even if texturing is disabled at the moment.
Implements Gfx::CDevice.
|
overridevirtual |
Sets only the texture wrap modes (for faster than thru stage params)
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitive composed of vertices with single texture.
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitive composed of vertices with multitexturing (2 textures)
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitive composed of vertices with solid color.
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitives composed of lists of vertices with single texture.
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitives composed of lists of vertices with multitexturing (2 textures)
Implements Gfx::CDevice.
|
overridevirtual |
Renders primitives composed of lists of vertices with solid color.
Implements Gfx::CDevice.
|
overridevirtual |
Creates a static buffer composed of given primitives with single texture vertices.
Implements Gfx::CDevice.
|
overridevirtual |
Creates a static buffer composed of given primitives with multitexturing.
Implements Gfx::CDevice.
|
overridevirtual |
Creates a static buffer composed of given primitives with solid color.
Implements Gfx::CDevice.
|
overridevirtual |
Updates the static buffer composed of given primitives with single texture vertices.
Implements Gfx::CDevice.
|
overridevirtual |
Updates the static buffer composed of given primitives with multitexturing.
Implements Gfx::CDevice.
|
overridevirtual |
Updates the static buffer composed of given primitives with solid color.
Implements Gfx::CDevice.
|
overridevirtual |
Draws a static buffer.
Implements Gfx::CDevice.
|
overridevirtual |
Deletes a static buffer.
Implements Gfx::CDevice.
|
overridevirtual |
Tests whether a sphere is (partially) within the frustum volume Returns a mask of frustum planes for which the test is positive
Implements Gfx::CDevice.
|
overridevirtual |
Changes rendering viewport.
Implements Gfx::CDevice.
|
overridevirtual |
Enables/disables the given render state.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the color mask.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the function of depth test.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the depth bias (constant value added to Z-coords)
Implements Gfx::CDevice.
|
overridevirtual |
Sets the alpha test function and reference value.
Implements Gfx::CDevice.
Sets the blending functions for source and destination operations.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the clear color.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the global ambient color.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the fog parameters: mode, color, start distance, end distance and density (for exp models)
Implements Gfx::CDevice.
|
overridevirtual |
Sets the current cull mode.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the shade model.
Implements Gfx::CDevice.
|
overridevirtual |
Sets shadow color.
Implements Gfx::CDevice.
|
overridevirtual |
Sets the current fill mode.
Implements Gfx::CDevice.
|
overridevirtual |
Copies content of framebuffer to texture.
Implements Gfx::CDevice.
|
overridevirtual |
Returns the pixels of the entire screen.
Implements Gfx::CDevice.
|
overridevirtual |
Returns framebuffer with given name or nullptr if it doesn't exist.
Implements Gfx::CDevice.
|
overridevirtual |
Creates new framebuffer with given name or nullptr if it's not possible.
Implements Gfx::CDevice.
|
overridevirtual |
Deletes framebuffer.
Implements Gfx::CDevice.
|
overridevirtual |
Checks if anisotropy is supported.
Implements Gfx::CDevice.
|
overridevirtual |
Returns max anisotropy level supported.
Implements Gfx::CDevice.
|
overridevirtual |
Returns max samples supported.
Implements Gfx::CDevice.
|
overridevirtual |
Checks if shadow mapping is supported.
Implements Gfx::CDevice.
|
overridevirtual |
Returns max texture size supported.
Implements Gfx::CDevice.
|
overridevirtual |
Checks if framebuffers are supported.
Implements Gfx::CDevice.