Esempio n. 1
0
void PointCloudVBO::checkGLContext()
// ----------------------------------------------------------------------------
//   Do what's needed if GL context has changed
// ----------------------------------------------------------------------------
{
    if (QGLContext::currentContext() != context)
    {
        IFTRACE(pointcloud)
            debug() << "GL context changed\n";

        // Re-create VBO(s)
        genPointBuffer();
        if (colored())
            genColorBuffer();

        if (optimized)
        {
            IFTRACE(pointcloud)
                debug() << "GL context changed on optimized cloud\n";

            XL_ASSERT(file != "" || nbRandom != 0);

            if (file != "")
            {
                IFTRACE(pointcloud)
                    debug() << "Reloading file\n";
                text f = file;
                clear();
                loadData(f, sep, xi, yi, zi, colorScale, ri, gi, bi, ai);
            }
            else if (nbRandom != 0)
            {
                IFTRACE(pointcloud)
                    debug() << "Re-creating random points\n";
                unsigned n = nbRandom;
                clear();
                randomPoints(n, coloredRandom);
            }

            optimized = false;
            XL_ASSERT(!dirty);
        }
        else
            updateVbo();

        context = QGLContext::currentContext();
    }
}
Esempio n. 2
0
void SeedPointGenerator::process() {
    if (useSameSeed_.get()) {
        mt_.seed(seed_.get());
    }

    switch (generator_.get()) {
        case RND:
            randomPoints();
            break;
        case PLANE:
            planePoints();
            break;
        case LINE:
            linePoints();
            break;
        case SPHERE:
            spherePoints();
            break;
        default:
            LogWarn("No points generated since given type is not yet implemented");
            break;
    }
}