GLDraw: GLCode::Mat4

git-svn-id: svn://ultimatepp.org/upp/trunk@12742 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-02-04 15:34:29 +00:00
parent 3793ccf4a1
commit a783cffdfa
2 changed files with 14 additions and 1 deletions

View file

@ -114,7 +114,6 @@ GLCode& GLCode::Uniform(const char *id, double a, double b, double c, double d)
return *this;
}
GLCode& GLCode::operator()(const char *id, Color c, double alpha)
{
return Uniform(GetUniform(id), c, alpha);
@ -125,4 +124,15 @@ GLCode& GLCode::operator()(int i, Color c, double alpha)
return Uniform(i, c.GetR() / 255.0f, c.GetG() / 255.0f, c.GetB() / 255.0f, alpha);
}
GLCode& GLCode::Mat4(int i, float *mat4)
{
glUniformMatrix4fv(i, 1, GL_FALSE, mat4);
return *this;
}
GLCode& GLCode::Mat4(const char *id, float *mat4)
{
return Mat4(GetUniform(id), mat4);
}
};

View file

@ -58,6 +58,9 @@ struct GLCode : GLProgram {
GLCode& operator()(int i, Sizef sz) { return Uniform(i, sz.cx, sz.cy); }
GLCode& operator()(const char *id, Color c, double alpha = 1);
GLCode& operator()(int i, Color c, double alpha = 1);
GLCode& Mat4(int i, float *mat4);
GLCode& Mat4(const char *id, float *mat4);
};
class GLTexture {