Colobot
|
Implementation of CDevice interface in OpenGL. More...
#include <gldevice.h>
Public Member Functions | |
CGLDevice (const DeviceConfig &config) | |
void | DebugHook () override |
Provides a hook to debug graphics code (implementation-specific) | |
void | DebugLights () override |
Displays light positions to aid in debuggings. | |
bool | Create () override |
Initializes the device, setting the initial state. | |
void | Destroy () override |
Destroys the device, releasing every acquired resource. | |
void | ConfigChanged (const DeviceConfig &newConfig) override |
Changes configuration. | |
void | BeginScene () override |
Begins drawing the 3D scene. | |
void | EndScene () override |
Ends drawing the 3D scene. | |
void | Clear () override |
Clears the screen to blank. | |
void | SetTransform (TransformType type, const Math::Matrix &matrix) override |
Sets the transform matrix of given type. | |
void | SetMaterial (const Material &material) override |
Sets the current material. | |
int | GetMaxLightCount () override |
Returns the maximum number of lights available. | |
void | SetLight (int index, const Light &light) override |
Sets the light at given index. | |
void | SetLightEnabled (int index, bool enabled) override |
Enables/disables the light at given index. | |
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. | |
Texture | CreateDepthTexture (int width, int height, int depth) override |
Creates a depth texture with specific dimensions and depth. | |
void | DestroyTexture (const Texture &texture) override |
Deletes a given texture, freeing it from video memory. | |
void | DestroyAllTextures () override |
Deletes all textures created so far. | |
int | GetMaxTextureStageCount () override |
Returns the maximum number of multitexture stages. | |
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. | |
void | SetTextureEnabled (int index, bool enabled) override |
Enables/disables the given texture stage. | |
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) | |
void | SetTextureCoordGeneration (int index, TextureGenerationParams ¶ms) override |
Sets the texture coordinate generation mode for given texture unit. | |
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. | |
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) | |
void | DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount) override |
Renders primitive composed of vertices with solid color. | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with single texture vertices. | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with multitexturing. | |
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override |
Creates a static buffer composed of given primitives with solid color. | |
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. | |
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override |
Updates the static buffer composed of given primitives with multitexturing. | |
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override |
Updates the static buffer composed of given primitives with solid color. | |
void | DrawStaticBuffer (unsigned int bufferId) override |
Draws a static buffer. | |
void | DestroyStaticBuffer (unsigned int bufferId) override |
Deletes a static buffer. | |
int | ComputeSphereVisibility (const Math::Vector ¢er, float radius) override |
void | SetViewport (int x, int y, int width, int height) override |
Changes rendering viewport. | |
void | SetRenderState (RenderState state, bool enabled) override |
Enables/disables the given render state. | |
void | SetColorMask (bool red, bool green, bool blue, bool alpha) override |
Sets the color mask. | |
void | SetDepthTestFunc (CompFunc func) override |
Sets the function of depth test. | |
void | SetDepthBias (float factor, float units) override |
Sets the depth bias (constant value added to Z-coords) | |
void | SetAlphaTestFunc (CompFunc func, float refValue) override |
Sets the alpha test function and reference value. | |
void | SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend) override |
Sets the blending functions for source and destination operations. | |
void | SetClearColor (const Color &color) override |
Sets the clear color. | |
void | SetGlobalAmbient (const Color &color) override |
Sets the global ambient color. | |
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) | |
void | SetCullMode (CullMode mode) override |
Sets the current cull mode. | |
void | SetShadeModel (ShadeModel model) override |
Sets the shade model. | |
void | SetShadowColor (float value) override |
Sets shadow color. | |
void | SetFillMode (FillMode mode) override |
Sets the current fill mode. | |
void | CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height) override |
Copies content of framebuffer to texture. | |
std::unique_ptr< CFrameBufferPixels > | GetFrameBufferPixels () const override |
Returns the pixels of the entire screen. | |
CFramebuffer * | GetFramebuffer (std::string name) override |
Returns framebuffer with given name or nullptr if it doesn't exist. | |
CFramebuffer * | CreateFramebuffer (std::string name, const FramebufferParams ¶ms) override |
Creates new framebuffer with given name or nullptr if it's not possible. | |
void | DeleteFramebuffer (std::string name) override |
Deletes framebuffer. | |
bool | IsAnisotropySupported () override |
Checks if anisotropy is supported. | |
int | GetMaxAnisotropyLevel () override |
Returns max anisotropy level supported. | |
int | GetMaxSamples () override |
Returns max samples supported. | |
bool | IsShadowMappingSupported () override |
Checks if shadow mapping is supported. | |
int | GetMaxTextureSize () override |
Returns max texture size supported. | |
bool | IsFramebufferSupported () override |
Checks if framebuffers are supported. | |
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, CGLDeviceConfig is outside the CDevice class and must be set in CApplication.
|
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 |
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 |
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 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.