Colobot
|
Implementation of CDevice interface in OpenGL 3.3. More...
#include <src/graphics/opengl/gl33device.h>
Public Member Functions | |
CGL33Device (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... | |
virtual void | DebugHook ()=0 |
Provides a hook to debug graphics code (implementation-specific) More... | |
virtual void | DebugLights ()=0 |
Displays light positions to aid in debuggings. More... | |
virtual std::string | GetName ()=0 |
Returns a name of this device. More... | |
virtual bool | Create ()=0 |
Initializes the device, setting the initial state. More... | |
virtual void | Destroy ()=0 |
Destroys the device, releasing every acquired resource. More... | |
virtual void | ConfigChanged (const DeviceConfig &newConfig)=0 |
Changes configuration. More... | |
virtual void | BeginScene ()=0 |
Begins drawing the 3D scene. More... | |
virtual void | EndScene ()=0 |
Ends drawing the 3D scene. More... | |
virtual void | Clear ()=0 |
Clears the screen to blank. More... | |
virtual void | SetRenderMode (RenderMode mode)=0 |
Sets current rendering mode. More... | |
virtual void | SetTransform (TransformType type, const Math::Matrix &matrix)=0 |
Sets the transform matrix of given type. More... | |
virtual void | SetMaterial (const Material &material)=0 |
Sets the current material. More... | |
virtual int | GetMaxLightCount ()=0 |
Returns the maximum number of lights available. More... | |
virtual void | SetLight (int index, const Light &light)=0 |
Sets the light at given index. More... | |
virtual void | SetLightEnabled (int index, bool enabled)=0 |
Enables/disables the light at given index. More... | |
virtual Texture | CreateTexture (CImage *image, const TextureCreateParams ¶ms)=0 |
Creates a texture from image; the image can be safely removed after that. More... | |
virtual Texture | CreateTexture (ImageData *data, const TextureCreateParams ¶ms)=0 |
Creates a texture from raw image data; image data can be freed after that. More... | |
virtual Texture | CreateDepthTexture (int width, int height, int depth)=0 |
Creates a depth texture with specific dimensions and depth. More... | |
virtual void | UpdateTexture (const Texture &texture, Math::IntPoint offset, ImageData *data, TexImgFormat format)=0 |
Updates a part of texture from raw image data. More... | |
virtual void | DestroyTexture (const Texture &texture)=0 |
Deletes a given texture, freeing it from video memory. More... | |
virtual void | DestroyAllTextures ()=0 |
Deletes all textures created so far. More... | |
virtual int | GetMaxTextureStageCount ()=0 |
Returns the maximum number of multitexture stages. More... | |
virtual void | SetTexture (int index, const Texture &texture)=0 |
Sets the texture at given texture stage. More... | |
virtual void | SetTexture (int index, unsigned int textureId)=0 |
Sets the texture image by ID at given texture stage. More... | |
virtual void | SetTextureEnabled (int index, bool enabled)=0 |
Enables/disables the given texture stage. More... | |
virtual void | SetTextureStageParams (int index, const TextureStageParams ¶ms)=0 |
Sets the params for texture stage with given index. More... | |
virtual void | SetTextureStageWrap (int index, TexWrapMode wrapS, TexWrapMode wrapT)=0 |
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))=0 |
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))=0 |
Renders primitive composed of vertices with multitexturing (2 textures) More... | |
virtual void | DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount)=0 |
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))=0 |
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))=0 |
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)=0 |
Renders primitives composed of lists of vertices with solid color. More... | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount)=0 |
Creates a static buffer composed of given primitives with single texture vertices. More... | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount)=0 |
Creates a static buffer composed of given primitives with multitexturing. More... | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount)=0 |
Creates a static buffer composed of given primitives with solid color. More... | |
virtual void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const Vertex *vertices, int vertexCount)=0 |
Updates the static buffer composed of given primitives with single texture vertices. More... | |
virtual void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount)=0 |
Updates the static buffer composed of given primitives with multitexturing. More... | |
virtual void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount)=0 |
Updates the static buffer composed of given primitives with solid color. More... | |
virtual void | DrawStaticBuffer (unsigned int bufferId)=0 |
Draws a static buffer. More... | |
virtual void | DestroyStaticBuffer (unsigned int bufferId)=0 |
Deletes a static buffer. More... | |
virtual int | ComputeSphereVisibility (const Math::Vector ¢er, float radius)=0 |
virtual void | SetViewport (int x, int y, int width, int height)=0 |
Changes rendering viewport. More... | |
virtual void | SetRenderState (RenderState state, bool enabled)=0 |
Enables/disables the given render state. More... | |
virtual void | SetColorMask (bool red, bool green, bool blue, bool alpha)=0 |
Sets the color mask. More... | |
virtual void | SetDepthTestFunc (CompFunc func)=0 |
Sets the function of depth test. More... | |
virtual void | SetDepthBias (float factor, float units)=0 |
Sets the depth bias (constant value added to Z-coords) More... | |
virtual void | SetAlphaTestFunc (CompFunc func, float refValue)=0 |
Sets the alpha test function and reference value. More... | |
virtual void | SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend)=0 |
Sets the blending functions for source and destination operations. More... | |
virtual void | SetClearColor (const Color &color)=0 |
Sets the clear color. More... | |
virtual void | SetGlobalAmbient (const Color &color)=0 |
Sets the global ambient color. More... | |
virtual void | SetFogParams (FogMode mode, const Color &color, float start, float end, float density)=0 |
Sets the fog parameters: mode, color, start distance, end distance and density (for exp models) More... | |
virtual void | SetCullMode (CullMode mode)=0 |
Sets the current cull mode. More... | |
virtual void | SetShadeModel (ShadeModel model)=0 |
Sets the shade model. More... | |
virtual void | SetShadowColor (float value)=0 |
Sets shadow color. More... | |
virtual void | SetFillMode (FillMode mode)=0 |
Sets the current fill mode. More... | |
virtual void | CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height)=0 |
Copies content of framebuffer to texture. More... | |
virtual std::unique_ptr< CFrameBufferPixels > | GetFrameBufferPixels () const =0 |
Returns the pixels of the entire screen. More... | |
virtual CFramebuffer * | GetFramebuffer (std::string name)=0 |
Returns framebuffer with given name or nullptr if it doesn't exist. More... | |
virtual CFramebuffer * | CreateFramebuffer (std::string name, const FramebufferParams ¶ms)=0 |
Creates new framebuffer with given name or nullptr if it's not possible. More... | |
virtual void | DeleteFramebuffer (std::string name)=0 |
Deletes framebuffer. More... | |
virtual bool | IsAnisotropySupported ()=0 |
Checks if anisotropy is supported. More... | |
virtual int | GetMaxAnisotropyLevel ()=0 |
Returns max anisotropy level supported. More... | |
virtual int | GetMaxSamples ()=0 |
Returns max samples supported. More... | |
virtual bool | IsShadowMappingSupported ()=0 |
Checks if shadow mapping is supported. More... | |
virtual int | GetMaxTextureSize ()=0 |
Returns max texture size supported. More... | |
virtual bool | IsFramebufferSupported ()=0 |
Checks if framebuffers are supported. More... | |
Additional Inherited Members | |
![]() | |
std::string | m_errorMessage |
DeviceCapabilities | m_capabilities |
Implementation of CDevice interface in OpenGL 3.3.
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, CGLDeviceConfig 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.
|
inlineoverridevirtual |
Creates a static buffer composed of given primitives with single texture vertices.
Implements Gfx::CDevice.
|
inlineoverridevirtual |
Creates a static buffer composed of given primitives with multitexturing.
Implements Gfx::CDevice.
|
inlineoverridevirtual |
Creates a static buffer composed of given primitives with solid color.
Implements Gfx::CDevice.
|
inlineoverridevirtual |
Updates the static buffer composed of given primitives with single texture vertices.
Implements Gfx::CDevice.
|
inlineoverridevirtual |
Updates the static buffer composed of given primitives with multitexturing.
Implements Gfx::CDevice.
|
inlineoverridevirtual |
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.