git-svn-id: svn://db.shs.com.ru/libs@593 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -53,51 +53,40 @@ QString findFile(const QString & file, const QStringList & pathes) {
|
||||
}
|
||||
|
||||
|
||||
void quadProgPoint(QOpenGLFunctions * glFuncs, QOpenGLShaderProgram * prog, QVector4D * corner_dirs,
|
||||
GLfloat x, GLfloat y, GLfloat tx, GLfloat ty, int locv, int loct, int locc, int index) {
|
||||
if (prog) {
|
||||
if (corner_dirs)
|
||||
prog->setAttributeValue(locc, corner_dirs[index]);
|
||||
glFuncs->glVertexAttrib2f(loct, tx, ty);
|
||||
glFuncs->glVertexAttrib2f(locv, x, y);
|
||||
} else {
|
||||
glTexCoord2f(tx, ty);
|
||||
glVertex2f(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void glDrawQuad(QOpenGLShaderProgram * 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;
|
||||
int loc = prog ? prog->attributeLocation("qgl_Color") : -1,
|
||||
locv = prog ? prog->attributeLocation("qgl_Vertex") : -1,
|
||||
loct = prog ? prog->attributeLocation("qgl_Texture") : -1,
|
||||
locc = prog ? prog->attributeLocation("view_corner") : -1;
|
||||
if (prog) {
|
||||
}
|
||||
//if (prog)
|
||||
//qDebug() << loc << locv << loct << locc;
|
||||
glBegin(GL_QUADS);
|
||||
QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
|
||||
if (prog) {
|
||||
glFuncs->glVertexAttrib3f(loc, 1.f, 1.f, 1.f);
|
||||
}
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
if (prog) {
|
||||
if (corner_dirs)
|
||||
prog->setAttributeValue(locc, corner_dirs[0]);
|
||||
glFuncs->glVertexAttrib2f(loct, 0.f, 0.f);
|
||||
glFuncs->glVertexAttrib2f(locv, x, y);
|
||||
}
|
||||
glTexCoord2f(0.f, 0.f);
|
||||
glVertex2f(x, y);
|
||||
if (prog) {
|
||||
if (corner_dirs)
|
||||
prog->setAttributeValue(locc, corner_dirs[1]);
|
||||
glFuncs->glVertexAttrib2f(loct, 1.f, 0.f);
|
||||
glFuncs->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]);
|
||||
glFuncs->glVertexAttrib2f(loct, 1.f, 1.f);
|
||||
glFuncs->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]);
|
||||
glFuncs->glVertexAttrib2f(loct, 0.f, 1.f);
|
||||
glFuncs->glVertexAttrib2f(locv, x, y + h);
|
||||
}
|
||||
glTexCoord2f(0.f, 1.f);
|
||||
glVertex2f(x, y + h);
|
||||
quadProgPoint(glFuncs, prog, corner_dirs, x , y , 0.f, 0.f, locv, loct, locc, 0);
|
||||
quadProgPoint(glFuncs, prog, corner_dirs, x+w, y , 1.f, 0.f, locv, loct, locc, 1);
|
||||
quadProgPoint(glFuncs, prog, corner_dirs, x+w, y+h, 1.f, 1.f, locv, loct, locc, 2);
|
||||
quadProgPoint(glFuncs, prog, corner_dirs, x , y+h, 0.f, 1.f, locv, loct, locc, 3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user