Colobot
|
Implementation of CDevice interface in OpenGL. More...
#include <gl21device.h>
Public Member Functions | |
CGL21Device (const GLDeviceConfig &config) | |
virtual void | DebugHook () OVERRIDE |
Provides a hook to debug graphics code (implementation-specific) | |
virtual void | DebugLights () OVERRIDE |
Displays light positions to aid in debuggings. | |
virtual bool | Create () OVERRIDE |
Initializes the device, setting the initial state. | |
virtual void | Destroy () OVERRIDE |
Destroys the device, releasing every acquired resource. | |
void | ConfigChanged (const GLDeviceConfig &newConfig) |
virtual void | BeginScene () OVERRIDE |
Begins drawing the 3D scene. | |
virtual void | EndScene () OVERRIDE |
Ends drawing the 3D scene. | |
virtual void | Clear () OVERRIDE |
Clears the screen to blank. | |
virtual void | SetTransform (TransformType type, const Math::Matrix &matrix) OVERRIDE |
Sets the transform matrix of given type. | |
virtual void | SetMaterial (const Material &material) OVERRIDE |
Sets the current material. | |
virtual int | GetMaxLightCount () OVERRIDE |
Returns the maximum number of lights available. | |
virtual void | SetLight (int index, const Light &light) OVERRIDE |
Sets the light at given index. | |
virtual void | SetLightEnabled (int index, bool enabled) OVERRIDE |
Enables/disables the light at given index. | |
virtual Texture | CreateTexture (CImage *image, const TextureCreateParams ¶ms) OVERRIDE |
virtual Texture | CreateTexture (ImageData *data, const TextureCreateParams ¶ms) OVERRIDE |
Creates a texture from raw image data; image data can be freed after that. | |
virtual Texture | CreateDepthTexture (int width, int height, int depth) OVERRIDE |
Creates a depth texture with specific dimensions and depth. | |
virtual void | DestroyTexture (const Texture &texture) OVERRIDE |
Deletes a given texture, freeing it from video memory. | |
virtual void | DestroyAllTextures () OVERRIDE |
Deletes all textures created so far. | |
virtual int | GetMaxTextureStageCount () OVERRIDE |
Returns the maximum number of multitexture stages. | |
virtual void | SetTexture (int index, const Texture &texture) OVERRIDE |
virtual void | SetTexture (int index, unsigned int textureId) OVERRIDE |
Sets the texture image by ID at given texture stage. | |
virtual void | SetTextureEnabled (int index, bool enabled) OVERRIDE |
Enables/disables the given texture stage. | |
virtual void | SetTextureStageParams (int index, const TextureStageParams ¶ms) OVERRIDE |
virtual void | SetTextureStageWrap (int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) OVERRIDE |
Sets only the texture wrap modes (for faster than thru stage params) | |
virtual 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) | |
virtual void | DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount) OVERRIDE |
Renders primitive composed of vertices with solid color. | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) OVERRIDE |
Creates a static buffer composed of given primitives with single texture vertices. | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) OVERRIDE |
Creates a static buffer composed of given primitives with multitexturing. | |
virtual unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) OVERRIDE |
Creates a static buffer composed of given primitives with solid color. | |
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. | |
virtual void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) OVERRIDE |
Updates the static buffer composed of given primitives with multitexturing. | |
virtual void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) OVERRIDE |
Updates the static buffer composed of given primitives with solid color. | |
virtual void | DrawStaticBuffer (unsigned int bufferId) OVERRIDE |
Draws a static buffer. | |
virtual void | DestroyStaticBuffer (unsigned int bufferId) OVERRIDE |
Deletes a static buffer. | |
virtual int | ComputeSphereVisibility (const Math::Vector ¢er, float radius) OVERRIDE |
virtual void | SetViewport (int x, int y, int width, int height) OVERRIDE |
Changes rendering viewport. | |
virtual void | SetRenderState (RenderState state, bool enabled) OVERRIDE |
Enables/disables the given render state. | |
virtual void | SetColorMask (bool red, bool green, bool blue, bool alpha) OVERRIDE |
Sets the color mask. | |
virtual void | SetDepthTestFunc (CompFunc func) OVERRIDE |
Sets the function of depth test. | |
virtual void | SetDepthBias (float factor, float units) OVERRIDE |
Sets the depth bias (constant value added to Z-coords) | |
virtual void | SetAlphaTestFunc (CompFunc func, float refValue) OVERRIDE |
Sets the alpha test function and reference value. | |
virtual void | SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend) OVERRIDE |
Sets the blending functions for source and destination operations. | |
virtual void | SetClearColor (const Color &color) OVERRIDE |
Sets the clear color. | |
virtual void | SetGlobalAmbient (const Color &color) OVERRIDE |
Sets the global ambient color. | |
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) | |
virtual void | SetCullMode (CullMode mode) OVERRIDE |
Sets the current cull mode. | |
virtual void | SetShadeModel (ShadeModel model) OVERRIDE |
Sets the shade model. | |
virtual void | SetShadowColor (float value) OVERRIDE |
Sets shadow color. | |
virtual void | SetFillMode (FillMode mode) OVERRIDE |
Sets the current fill mode. | |
virtual void | InitOffscreenBuffer (int width, int height) OVERRIDE |
Initializes offscreen buffer. | |
virtual void | SetRenderTexture (RenderTarget target, int texture) OVERRIDE |
Sets render target to texture. | |
virtual void | CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height) OVERRIDE |
Copies content of framebuffer to texture. | |
virtual void * | GetFrameBufferPixels () const OVERRIDE |
Returns the pixels of the entire screen. | |
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, CGL21DeviceConfig is outside the CDevice class and must be set in CApplication.
|
virtual |
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.
|
virtual |
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.
|
virtual |
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.
|
virtual |
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.