#include <OGL_Renderer.h>
Public Member Functions | |
| OGL_Renderer () | |
| OGL_Renderer (Uint ResX, Uint ResY, Uint BPP, bool fullscreen, bool vsync) | |
| ~OGL_Renderer () | |
| void | setApplicationTitle (const std::string &title) |
| bool | drawImage (Image *image, int x, int y) |
| bool | drawImage (Image *image, int rasterX, int rasterY, int x, int y, int width, int height) |
| bool | drawImagePattern (Image *image, int x, int y, int w, int h) |
| bool | drawImageRect (int x, int y, int w, int h, Image *topLeft, Image *top, Image *topRight, Image *left, Image *center, Image *right, Image *bottomLeft, Image *bottom, Image *bottomRight) |
| bool | drawImageRect (int x, int y, int w, int h, ImageList &images) |
| void | drawPixel (int x, int y, int r, int g, int b, int a) |
| void | drawLine (int x, int y, int x2, int y2, int r, int g, int b, int a) |
| void | drawBox (int x, int y, int width, int height, int r, int g, int b, int a) |
| void | drawCircle (int cx, int cy, int radius, int r, int g, int b, int a, int num_segments, float scale_x, float scale_y) |
| void | floodFill (int x, int y, int width, int height, int r, int g, int b, int a) |
| bool | drawText (Font *font, const std::string &text, int x, int y, int r, int g, int b, int a) |
| bool | drawTextClamped (Font *font, const std::string &text, int x, int y, int w, int h, int r, int g, int b, int a) |
| void | imageDesaturate (Image *image) |
| void | clearScreen (int r, int g, int b) |
| void | update () |
| Uint | getPixelColor (Image *src, int x, int y) |
| bool | isPixelTransparent (Image *src, int x, int y) |
| int | getScreenWidth () |
| int | getScreenHeight () |
Private Member Functions | |
| OGL_Renderer (const OGL_Renderer &) | |
| OGL_Renderer & | operator= (const OGL_Renderer &) |
| void | initGL () |
| void | initVideo (Uint resX, Uint resY, Uint bpp, bool fullscreen, bool vsync) |
| void | checkExtensions () |
| bool | drawPointer (int x, int y) |
| GLuint | getTextureId (Image *image) |
| GLuint | getPatternTextureId (Image *image, int w, int h) |
| GLuint | generateTexture (SDL_Surface *src) |
| void | updateTextures () |
| void | getError () |
Private Attributes | |
| SDL_Surface * | mScreen |
| Timer | mTimer |
| Uint | mLastResourceCheck |
| std::map< int, pair< GLuint, int > > | mTextureArray |
OpenGL Renderer.
Implements all Renderer functions with the SDL_opengl API. Note: The use of glBegin()->glEnd() calls is now deprecated in OGL3. If we can switch to a non-immediate mode methodollogy it may help us when splitting towards a pure 3D renderer.
| OGL_Renderer::OGL_Renderer | ( | ) |
| OGL_Renderer::~OGL_Renderer | ( | ) |
| OGL_Renderer::OGL_Renderer | ( | const OGL_Renderer & | ) | [private] |
| void OGL_Renderer::checkExtensions | ( | ) | [private] |
Checks for expected extensions and prints warning messages if the video driver doesn't support the extension.
| void OGL_Renderer::clearScreen | ( | int | r, | |
| int | g, | |||
| int | b | |||
| ) | [virtual] |
Clears the screen with a given RGB value.
| r | Red color value between 0 - 255. | |
| g | Green Color Value between 0 - 255. | |
| b | Blue Color Value between 0 - 255. |
Reimplemented from Renderer.
| void OGL_Renderer::drawBox | ( | int | x, | |
| int | y, | |||
| int | width, | |||
| int | height, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Draws a hollow box on the primary surface.
| x | X-Coordinate of the box. | |
| y | Y-Coordinate of the box. | |
| width | Width, in pixels, of the box. | |
| height | Height, in pixels, of the box. | |
| r | Red Color Value. Must be between 0 - 255. | |
| g | Green Color Value. Must be between 0 - 255. | |
| b | Blue Color Value. Must be between 0 - 255. | |
| a | Alhpa value to use. Must be between 0 (completely transparent) - 255 (completely opaque). |
Reimplemented from Renderer.
| void OGL_Renderer::drawCircle | ( | int | cx, | |
| int | cy, | |||
| int | radius, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a, | |||
| int | num_segments, | |||
| float | scale_x, | |||
| float | scale_y | |||
| ) | [virtual] |
Reimplemented from Renderer.
| bool OGL_Renderer::drawImage | ( | Image * | image, | |
| int | x, | |||
| int | y | |||
| ) | [virtual] |
| bool OGL_Renderer::drawImage | ( | Image * | image, | |
| int | rasterX, | |||
| int | rasterY, | |||
| int | x, | |||
| int | y, | |||
| int | width, | |||
| int | height | |||
| ) | [virtual] |
| bool OGL_Renderer::drawImagePattern | ( | Image * | image, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h | |||
| ) | [virtual] |
| bool OGL_Renderer::drawImageRect | ( | int | x, | |
| int | y, | |||
| int | w, | |||
| int | h, | |||
| ImageList & | images | |||
| ) | [virtual] |
| void OGL_Renderer::drawLine | ( | int | x, | |
| int | y, | |||
| int | x2, | |||
| int | y2, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Draws a line from (x, y) - (x2, y2) on the primary surface.
| x | X-Coordinate of the start of the line. | |
| y | Y-Coordinate of the start of the line. | |
| x2 | X-Coordinate of the end of the line. | |
| y2 | Y-Coordinate of the end of the line. | |
| r | Red Color Value. Must be between 0 - 255. | |
| g | Green Color Value. Must be between 0 - 255. | |
| b | Blue Color Value. Must be between 0 - 255. | |
| a | Alpha Value. Must be between 0 - 255. Defaults to 255. |
Reimplemented from Renderer.
| void OGL_Renderer::drawPixel | ( | int | x, | |
| int | y, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Draws a single Pixel to the primary surface.
| x | X-Coordinate of the pixel to draw. | |
| y | Y-Coordinate of the pixel to draw. | |
| r | Red Color Value. Must be between 0 - 255. | |
| g | Green Color Value. Must be between 0 - 255. | |
| b | Blue Color Value. Must be between 0 - 255. | |
| a | Alpha Value. Must be between 0 - 255. Defaults to 255. |
Reimplemented from Renderer.
| bool OGL_Renderer::drawPointer | ( | int | x, | |
| int | y | |||
| ) | [private, virtual] |
Renders the mouse cursor.
Reimplemented from Renderer.
| bool OGL_Renderer::drawText | ( | Font * | font, | |
| const std::string & | text, | |||
| int | x, | |||
| int | y, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Reimplemented from Renderer.
| bool OGL_Renderer::drawTextClamped | ( | Font * | font, | |
| const std::string & | text, | |||
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Reimplemented from Renderer.
| void OGL_Renderer::floodFill | ( | int | x, | |
| int | y, | |||
| int | width, | |||
| int | height, | |||
| int | r, | |||
| int | g, | |||
| int | b, | |||
| int | a | |||
| ) | [virtual] |
Fills a given area with a solid color on the primary surface.
| x | X-Coordinate of the area to fill. | |
| y | Y-Coordinate of the area to fill. | |
| width | Width, in pixels, of the area to fill. | |
| height | Height, in pixels, of the area to fill. | |
| r | Red Color Value. Must be between 0 - 255. | |
| g | Green Color Value. Must be between 0 - 255. | |
| b | Blue Color Value. Must be between 0 - 255. | |
| a | Alpha value. Must be between 0 - 255. |
Reimplemented from Renderer.
| GLuint OGL_Renderer::generateTexture | ( | SDL_Surface * | src | ) | [private] |
textureFormat could be potentially uninitialized should nColors be anything other than '3' or '4' (24 bit and 32 bit color modes, respectively). The only other expected values would be '2' (16 bit color mode) or '1' (8 bit color mode). While in practice neither of these cases is likely to show up, it's extremely important that textureFormat is initialized to a good default value that will work for generally all modes or one that will at least not cause a crash. | void OGL_Renderer::getError | ( | ) | [private] |
| GLuint OGL_Renderer::getPatternTextureId | ( | Image * | image, | |
| int | w, | |||
| int | h | |||
| ) | [inline, private] |
| int OGL_Renderer::getScreenHeight | ( | ) | [virtual] |
Returns the primary display's Height.
Reimplemented from Renderer.
| int OGL_Renderer::getScreenWidth | ( | ) | [virtual] |
Returns the primary display's Width.
Reimplemented from Renderer.
| GLuint OGL_Renderer::getTextureId | ( | Image * | image | ) | [inline, private] |
Gets a TextureID from our array of GL Texture's.
| void OGL_Renderer::imageDesaturate | ( | Image * | image | ) | [virtual] |
| void OGL_Renderer::initGL | ( | ) | [private] |
| void OGL_Renderer::initVideo | ( | Uint | resX, | |
| Uint | resY, | |||
| Uint | bpp, | |||
| bool | fullscreen, | |||
| bool | vsync | |||
| ) | [private, virtual] |
Reimplemented from Renderer.
| bool OGL_Renderer::isPixelTransparent | ( | Image * | src, | |
| int | x, | |||
| int | y | |||
| ) | [virtual] |
Reimplemented from Renderer.
| OGL_Renderer& OGL_Renderer::operator= | ( | const OGL_Renderer & | ) | [private] |
| void OGL_Renderer::setApplicationTitle | ( | const std::string & | title | ) | [virtual] |
Reimplemented from Renderer.
| void OGL_Renderer::update | ( | ) | [virtual] |
Reimplemented from Renderer.
| void OGL_Renderer::updateTextures | ( | ) | [inline, private] |
Checks through the list of textures and removes any textures that haven't been accessed for more than TEXTURE_EXPIRE_TIME minutes.
Uint OGL_Renderer::mLastResourceCheck [private] |
Tick count from last resource check.
SDL_Surface* OGL_Renderer::mScreen [private] |
Primary screen surface.
std::map<int, pair<GLuint, int> > OGL_Renderer::mTextureArray [private] |
Internal array of GL Texture ID and time stamp.
Timer OGL_Renderer::mTimer [private] |
Internal Timer.
1.7.1