diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-10 16:54:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-10 17:25:07 +0300 |
commit | 3a28edfb7ac991ad70a7baf76f48218d9db89bcb (patch) | |
tree | 918e56537dd2f7c2ce94e97a297a83a55d6f6ea6 /src/openglgraphics.cpp | |
parent | f199b9ba7da47cb6f9aa95f843c0628621899aa9 (diff) | |
download | manaplus-3a28edfb7ac991ad70a7baf76f48218d9db89bcb.tar.gz manaplus-3a28edfb7ac991ad70a7baf76f48218d9db89bcb.tar.bz2 manaplus-3a28edfb7ac991ad70a7baf76f48218d9db89bcb.tar.xz manaplus-3a28edfb7ac991ad70a7baf76f48218d9db89bcb.zip |
Split ImageHelper to ImageHelper, SDLImageHelper, OpenGLImageHelper.
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r-- | src/openglgraphics.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 3ca2a8c09..6b89f4bca 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -31,6 +31,7 @@ #include "resources/image.h" #include "resources/imagehelper.h" +#include "resources/openglimagehelper.h" #include "utils/stringutils.h" @@ -81,7 +82,7 @@ static inline void drawQuad(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) { - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. const float texX1 = static_cast<float>(srcX) / @@ -143,7 +144,7 @@ static inline void drawRescaledQuad(Image *image, int width, int height, int desiredWidth, int desiredHeight) { - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { // Find OpenGL normalized texture coordinates. const float texX1 = static_cast<float>(srcX) / @@ -214,7 +215,7 @@ bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -271,7 +272,7 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, if (!useColor) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -324,14 +325,14 @@ void OpenGLGraphics::drawImagePattern(const Image *image, int x, int y, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); unsigned int vp = 0; const unsigned int vLimit = vertexBufSize * 4; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast<float>(srcX) / tw; float texY1 = static_cast<float>(srcY) / th; @@ -458,7 +459,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -466,7 +467,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, const unsigned int vLimit = vertexBufSize * 4; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { const float tw = static_cast<float>(image->getTextureWidth()); const float th = static_cast<float>(image->getTextureHeight()); @@ -598,7 +599,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, OpenGLGraphicsVertexes *ogl = vert->getOGL(); glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); std::vector<GLint*> *intVertPool = ogl->getIntVertPool(); @@ -609,7 +610,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, std::vector<int>::const_iterator ivp_end = vp->end(); // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { std::vector<GLfloat*> *floatTexPool = ogl->getFloatTexPool(); std::vector<GLfloat*>::const_iterator ft; @@ -678,7 +679,7 @@ void OpenGLGraphics::calcImagePattern(GraphicsVertexes* vert, Image *image, ogl->init(); // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast<float>(srcX) / tw; float texY1 = static_cast<float>(srcY) / th; @@ -811,7 +812,7 @@ void OpenGLGraphics::calcTile(ImageVertexes *vert, int dstX, int dstY) unsigned int vp = ogl->ptr; // Draw a set of textured rectangles - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) { float texX1 = static_cast<float>(srcX) / tw; float texY1 = static_cast<float>(srcY) / th; @@ -912,10 +913,10 @@ void OpenGLGraphics::drawTile(ImageVertexes *vert) OpenGLGraphicsVertexes *ogl = vert->ogl; glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); - bindTexture(ImageHelper::mTextureType, image->mGLImage); + bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); - if (ImageHelper::mTextureType == GL_TEXTURE_2D) + if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) drawQuadArrayfi(ogl->mIntVertArray, ogl->mFloatTexArray, ogl->ptr); else drawQuadArrayii(ogl->mIntVertArray, ogl->mIntTexArray, ogl->ptr); @@ -1189,7 +1190,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable) { if (!mTexture) { - glEnable(ImageHelper::mTextureType); + glEnable(OpenGLImageHelper::mTextureType); mTexture = true; } @@ -1215,7 +1216,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable) if (mTexture) { - glDisable(ImageHelper::mTextureType); + glDisable(OpenGLImageHelper::mTextureType); mTexture = false; } } |