Beispiel #1
0
void PlotCartesianWidget::initializeGL()
{
    glcontext->makeCurrent(this);

    glf->glClearColor( 1, 1, 1, 1 );
    glf->glDisable(GL_DEPTH_TEST);

    // this being a line graph, turn on line smoothing
    glf->glEnable( GL_LINE_SMOOTH );
    glf->glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    glf->glEnable(GL_BLEND);
    glf->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    initializeText();

    plotShader = new DGLShader( (getShaderTemplatesPath() + "Plots.vert").c_str(),
                                (getShaderTemplatesPath() + "Plots.frag").c_str(),
                                (getShaderTemplatesPath() + "Plots.geom").c_str());
    glf->glGenVertexArrays(1,&axisVAO);
    glf->glGenBuffers(2, axisVBO);
    updateAxisVAO();

    glf->glGenVertexArrays(1, &dataLineVAO);
    glf->glGenBuffers(1, &dataLineVBO);
    fWidth = float(width()*devicePixelRatio());
    fHeight = float(height()*devicePixelRatio());
    updateInputDataLineVAO();
}
Beispiel #2
0
void IBLWidget::initializeGL()
{
    glcontext->makeCurrent(this);

    model = new SimpleModel();

    loadIBL( (getProbesPath() + "beach.penv").c_str() );
    loadModel( (getModelsPath() + "sphere.obj").c_str() );

    // load the shaders
    resultShader = new DGLShader( (getShaderTemplatesPath() + "Quad.vert").c_str(), (getShaderTemplatesPath() + "IBLResult.frag").c_str() );
    compShader = new DGLShader( (getShaderTemplatesPath() + "Quad.vert").c_str(), (getShaderTemplatesPath() + "IBLComp.frag").c_str() );
}
Beispiel #3
0
BRDFMeasuredMERL::BRDFMeasuredMERL()
                 : brdfData(NULL)
{
    std::string path = (getShaderTemplatesPath() + "measured.func");

    // read the shader
    std::ifstream ifs( path.c_str() );
    std::string temp;
    while( getline( ifs, temp ) )
        brdfFunction += (temp + "\n");
}
Beispiel #4
0
void PlotCartesianWidget::initializeText()
{
    // Create font texture
    glf->glGenTextures( 1, &textTexureID );
    glf->glBindTexture( GL_TEXTURE_2D, textTexureID );

    glf->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glf->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glf->glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glf->glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

    QImage img;
    if(!img.load(QString((getImagesPath() + "verasansmono.png").c_str())))
        std::cout << "Can't load font texture" << std::endl;

    glf->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img.width(), img.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, img.convertToFormat(QImage::Format_RGB888).bits());
    glf->glBindTexture( GL_TEXTURE_2D, 0 );

    textShader = new DGLShader( (getShaderTemplatesPath() + "Text.vert").c_str(), (getShaderTemplatesPath() + "Text.frag").c_str(), (getShaderTemplatesPath() + "Text.geom").c_str() );

    glf->glGenVertexArrays(1,&textVAO);
    glf->glGenBuffers(1,&textVBO);
}