2012-04-19 01:03:43 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PAINTEROGL1_H
|
|
|
|
#define PAINTEROGL1_H
|
|
|
|
|
2012-04-20 12:16:03 +02:00
|
|
|
#define PAINTER_OGL1
|
|
|
|
|
2012-04-19 01:03:43 +02:00
|
|
|
#include "painter.h"
|
|
|
|
|
|
|
|
/**
|
2012-04-20 14:07:47 +02:00
|
|
|
* Painter using OpenGL 1.1 fixed-function rendering pipeline,
|
2012-04-19 01:03:43 +02:00
|
|
|
* compatible with OpenGL ES 1.0 and intended to be used on
|
|
|
|
* older graphics cards. Shaders are not available
|
|
|
|
* for this painter engine.
|
|
|
|
*/
|
|
|
|
class PainterOGL1 : public Painter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum MatrixMode {
|
2012-04-20 12:16:03 +02:00
|
|
|
MatrixProjection = 0x1701, //GL_PROJECTION
|
|
|
|
MatrixTexture = 0x1702, //GL_TEXTURE
|
2012-04-19 01:03:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
PainterOGL1();
|
|
|
|
|
|
|
|
void bind();
|
|
|
|
void unbind();
|
|
|
|
|
|
|
|
void refreshState();
|
|
|
|
|
|
|
|
void drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles);
|
|
|
|
void drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture);
|
|
|
|
void drawTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
|
|
|
void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
|
|
|
void drawFilledRect(const Rect& dest);
|
2012-06-10 08:09:37 +02:00
|
|
|
void drawFilledTriangle(const Point& a, const Point& b, const Point& c);
|
2012-04-19 01:03:43 +02:00
|
|
|
void drawBoundingRect(const Rect& dest, int innerLineWidth);
|
|
|
|
|
|
|
|
void setMatrixMode(MatrixMode matrixMode);
|
|
|
|
void setProjectionMatrix(const Matrix3& projectionMatrix);
|
2012-06-02 16:43:27 +02:00
|
|
|
void setTextureMatrix(const Matrix3& textureMatrix);
|
2012-04-19 01:03:43 +02:00
|
|
|
void setColor(const Color& color);
|
|
|
|
void setOpacity(float opacity);
|
|
|
|
|
2012-06-14 20:26:55 +02:00
|
|
|
bool hasShaders() { return false; }
|
|
|
|
|
2012-04-19 01:03:43 +02:00
|
|
|
private:
|
|
|
|
void updateGlColor();
|
|
|
|
void updateGlMatrixMode();
|
|
|
|
void updateGlProjectionMatrix();
|
|
|
|
void updateGlTextureMatrix();
|
2012-06-03 23:41:44 +02:00
|
|
|
void updateGlTextureState();
|
2012-04-19 01:03:43 +02:00
|
|
|
|
|
|
|
GLenum m_matrixMode;
|
2012-07-31 02:47:21 +02:00
|
|
|
stdext::boolean<false> m_textureEnabled;
|
2012-04-19 01:03:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern PainterOGL1 *g_painterOGL1;
|
|
|
|
|
|
|
|
#endif
|