git-svn-id: svn://db.shs.com.ru/libs@59 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-12-04 11:50:32 +00:00
parent edfd396059
commit 6ab9283a18
13 changed files with 92 additions and 46 deletions

View File

@@ -51,19 +51,19 @@ QString findFile(const QString & file, const QStringList & pathes) {
}
void glDrawQuad(QGLShaderProgram * prog, GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
void glDrawQuad(QGLShaderProgram * prog, QVector4D * corner_dirs, GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
glResetAllTransforms();
glSetPolygonMode(GL_FILL);
int loc = prog ? prog->attributeLocation("qgl_Color") : 0,
locv = prog ? prog->attributeLocation("qgl_Vertex") : 0,
loct = prog ? prog->attributeLocation("qgl_Texture") : 0;
//locc = prog ? prog->attributeLocation("view_corner") : 0;
loct = prog ? prog->attributeLocation("qgl_Texture") : 0,
locc = prog ? prog->attributeLocation("view_corner") : 0;
glBegin(GL_QUADS);
if (prog) glVertexAttrib3f(loc, 1.f, 1.f, 1.f); glColor3f(1.f, 1.f, 1.f);
if (prog) {/*prog->setAttributeValue(locc, corner_dirs[0]);*/ glVertexAttrib2f(loct, 0.f, 0.f); glVertexAttrib2f(locv, x, y);} glTexCoord2f(0.f, 0.f); glVertex2f(x, y);
if (prog) {/*prog->setAttributeValue(locc, corner_dirs[1]);*/ glVertexAttrib2f(loct, 1.f, 0.f); glVertexAttrib2f(locv, x + w, y);} glTexCoord2f(1.f, 0.f); glVertex2f(x + w, y);
if (prog) {/*prog->setAttributeValue(locc, corner_dirs[2]);*/ glVertexAttrib2f(loct, 1.f, 1.f); glVertexAttrib2f(locv, x + w, y + h);} glTexCoord2f(1.f, 1.f); glVertex2f(x + w, y + h);
if (prog) {/*prog->setAttributeValue(locc, corner_dirs[3]);*/ glVertexAttrib2f(loct, 0.f, 1.f); glVertexAttrib2f(locv, x, y + h);} glTexCoord2f(0.f, 1.f); glVertex2f(x, y + h);
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[0]); glVertexAttrib2f(loct, 0.f, 0.f); glVertexAttrib2f(locv, x, y);} glTexCoord2f(0.f, 0.f); glVertex2f(x, y);
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[1]); glVertexAttrib2f(loct, 1.f, 0.f); glVertexAttrib2f(locv, x + w, y);} glTexCoord2f(1.f, 0.f); glVertex2f(x + w, y);
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[2]); glVertexAttrib2f(loct, 1.f, 1.f); glVertexAttrib2f(locv, x + w, y + h);} glTexCoord2f(1.f, 1.f); glVertex2f(x + w, y + h);
if (prog) {if (corner_dirs) prog->setAttributeValue(locc, corner_dirs[3]); glVertexAttrib2f(loct, 0.f, 1.f); glVertexAttrib2f(locv, x, y + h);} glTexCoord2f(0.f, 1.f); glVertex2f(x, y + h);
glEnd();
}