#include"loadmodel.h"


LoadModel::LoadModel()
{
}
 LoadModel::~LoadModel()
{    
}
 void LoadModel::Init(QString &strFilename)
{
     initializeOpenGLFunctions();
     testv.clear();
     testn.clear();
     testt.clear();

     testv<<QVector3D(-1.0,0,-1.0);
     testv<<QVector3D(0,1.0,0);
     testv<<QVector3D(1.0,0,-1.0);

     testv<<QVector3D(0,0.707,-0.707);
     testv<<QVector3D(0,0.707,-0.707);
     testv<<QVector3D(0,0.707,-0.707);

     testt<<QVector2D(0.f,3.f);
     testt<<QVector2D(3.f,0.f);
     testt<<QVector2D(3.f,3.f);

}

void LoadModel::draw(QOpenGLShaderProgram *program,int vertexAttr,int normalAttr,int texAttr)
{

    program->enableAttributeArray(normalAttr);
    program->enableAttributeArray(vertexAttr);
    program->enableAttributeArray(texAttr);
    program->setAttributeArray(vertexAttr, testv.constData());
    program->setAttributeArray(normalAttr, testn.constData());
    program->setAttributeArray(texAttr, testt.constData());
    glDrawArrays(GL_TRIANGLES, 0, testv.size());
    program->disableAttributeArray(normalAttr);
    program->disableAttributeArray(vertexAttr);
    program->disableAttributeArray(texAttr);
}




