git-svn-id: svn://db.shs.com.ru/libs@46 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -51,15 +51,19 @@ QString findFile(const QString & file, const QStringList & pathes) {
|
||||
}
|
||||
|
||||
|
||||
void glDrawQuad(GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
|
||||
void glDrawQuad(QGLShaderProgram * prog, 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;
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
glTexCoord2f(0.f, 0.f); glVertex2f(x, y);
|
||||
glTexCoord2f(1.f, 0.f); glVertex2f(x + w, y);
|
||||
glTexCoord2f(1.f, 1.f); glVertex2f(x + w, y + h);
|
||||
glTexCoord2f(0.f, 1.f); glVertex2f(x, y + h);
|
||||
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);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user