begin implementing OpenGL 1.0 engine

* option to pass -opengl1 or -opengl2 as argument
* note that with this commit there are a lot of graphics regressions and the master will remaing unstable for a while
* shaders disabled for a while
This commit is contained in:
Eduardo Bart
2012-04-18 20:03:43 -03:00
parent a4a00a49fe
commit 58d76e255d
46 changed files with 1303 additions and 510 deletions

View File

@@ -29,11 +29,12 @@
class PainterShaderProgram : public ShaderProgram
{
protected:
enum {
VERTEX_ATTR = 0,
TEXCOORD_ATTR = 1,
PROJECTION_MATRIX_UNIFORM = 0,
TEXTURE_TRANSFORM_MATRIX_UNIFORM = 1,
TEXTURE_MATRIX_UNIFORM = 1,
COLOR_UNIFORM = 2,
OPACITY_UNIFORM = 3,
TIME_UNIFORM = 4,
@@ -42,34 +43,28 @@ class PainterShaderProgram : public ShaderProgram
//TEX2_UNIFORM = 7,
//TEX3_UNIFORM = 8,
};
public:
enum DrawMode {
Triangles = GL_TRIANGLES,
TriangleStrip = GL_TRIANGLE_STRIP
};
friend class PainterOGL2;
public:
PainterShaderProgram();
bool link();
void setProjectionMatrix(const Matrix3& projectionMatrix);
void setTextureMatrix(const Matrix2& textureMatrix);
void setColor(const Color& color);
void setOpacity(float opacity);
void setTexture(const TexturePtr& texture, int index = 0);
void setUniformTexture(int location, const TexturePtr& texture, int index);
void draw(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles);
void updateTime();
private:
DrawMode m_drawMode;
float m_startTime;
std::array<uint, 2> m_textures;
Color m_color;
float m_opacity;
Matrix3 m_projectionMatrix;
Matrix2 m_textureTransformMatrix;
Matrix2 m_textureMatrix;
float m_time;
int m_lastTexture;
};
#endif