Exemplo n.º 1
0
static PyObject* voreen_print(PyObject* /*self*/, PyObject* args) {
    char* msg;
    int len;
    int isStderr;
    if (!PyArg_ParseTuple(args, "s#i", &msg, &len, &isStderr)) {
        LWARNINGC("voreen.Python.voreen_print", "failed to parse log message");
    }
    else {
        if (len > 1 || ((len == 1) && (msg[0] != '\0') && (msg[0] != '\r') && (msg[0] != '\n'))) {
            std::string message(msg);
            const std::vector<PythonOutputListener*> listeners = PythonModule::getOutputListeners();
            if (!listeners.empty()) {
                // pass output to listeners
                for (size_t i=0; i<listeners.size(); i++) {
                    if (isStderr)
                        listeners[i]->pyStderr(message);
                    else
                        listeners[i]->pyStdout(message);
                }
            }
            else {
                // log output if no listener registered
                if (isStderr)
                    LWARNINGC("voreen.Python.voreen_print", message);
                else
                    LINFOC("voreen.Python.voreen_print", message);
            }
        }
    }

    Py_RETURN_NONE;
}
Exemplo n.º 2
0
void MainWindow::startButtonPressed() {
    QString exec = OpenSpaceExecutable;
    if (_sceneFiles.contains(_scenes->currentText()))
        exec += " -scene \"" + _sceneFiles[_scenes->currentText()] + "\"";

    if (_configurationFiles.contains(_configurations->currentText()))
        exec += " -sgct \"" + _configurationFiles[_configurations->currentText()] + "\"";

    LINFOC("MainWindow", "Executing: " << exec.toStdString());
    QProcess::startDetached(exec);
}
void TNMParallelCoordinates::handleMouseClick(tgt::MouseEvent* e) {
	// The picking texture is the result of the previous rendering in the private render port
    tgt::Texture* pickingTexture = _privatePort.getColorTexture();
	// Retrieve the texture from the graphics memory and get it to the RAM
	pickingTexture->downloadTexture();

	// The texture coordinates are flipped in the y direction, so we take care of that here
    const tgt::ivec2 screenCoords = tgt::ivec2(e->coord().x, pickingTexture->getDimensions().y - e->coord().y);
	// And then go from integer pixel coordinates to [-1,1] coordinates
    const tgt::vec2& normalizedDeviceCoordinates = (tgt::vec2(screenCoords) / tgt::vec2(_privatePort.getSize()) - 0.5f) * 2.f;

	// The picking information for the handles is stored in the red color channel
    int handleId = static_cast<int>(pickingTexture->texelAsFloat(screenCoords).r * 255 - 1);

    LINFOC("Picking", "Picked handle index: " << handleId);
    // Use the 'id' and the 'normalizedDeviceCoordinates' to move the correct handle
    // The id is the id of the AxisHandle that has been clicked (the same id you assigned in the constructor)
    // id == -1 if no handle was clicked
    // Use the '_pickedIndex' member variable to store the picked index

    _pickedHandle = handleId;
    
    
    // Derive the id of the line that was clicked based on the color scheme that you devised in the
    // renderLinesPicking method
    const Data& data = *(_inport.getData());
    
    int lineId = static_cast<int>(pickingTexture->texelAsFloat(screenCoords).g * data.size() * 255 - 1);

    LINFOC("Picking", "Picked line index: " << lineId);
    if (lineId != -1)
	    // We want to add it only if a line was clicked
	    _linkingList.insert(lineId);

    // if the right mouse button is pressed and no line is clicked, clear the list:
    if ((e->button() == tgt::MouseEvent::MOUSE_BUTTON_RIGHT) && (lineId == -1))
	    _linkingList.clear();
    
    // Make the list of selected indices available to the Scatterplot
    _linkingIndices.set(_linkingList);
}
Exemplo n.º 4
0
cl::Program* OpenCLModule::loadProgram(const std::string& path) throw (VoreenException) {
    if (!opencl_) 
        throw VoreenException("OpenCLModule: no OpenCL wrapper. Call initCL first!");

    std::string kernelFile = VoreenApplication::app()->getModulePath() + "/opencl/cl/voreenblas.cl";
    LINFOC("voreen.OpenCLModule", "Loading program " << path);
    cl::Program* prog = new cl::Program(getCLContext());
    if (!prog->loadSource(kernelFile)) {
        delete prog;    
        throw VoreenException("Failed to load OpenCL program: " + kernelFile);
    }

    if (!prog->build(getCLDevice())) {
        delete prog;
        throw VoreenException("Failed to build OpenCL program: " + kernelFile);
    }

    return prog;
}
Exemplo n.º 5
0
void initGL(InitFeature::Features featureset) {
    if (featureset & InitFeature::SHADER_MANAGER) {
        featureset = (InitFeature::Features) (featureset | InitFeature::GPU_PROPERTIES | InitFeature::FILE_SYSTEM);
    }
    if (featureset & InitFeature::TEXTURE_MANAGER) {
        featureset = (InitFeature::Features) (featureset | InitFeature::GPU_PROPERTIES | InitFeature::FILE_SYSTEM);
    }
    
    
	GLenum err = glewInit();
    if (err != GLEW_OK) {
        // Problem: glewInit failed, something is seriously wrong.
        tgtAssert(false, "glewInit failed");
        std::cerr << "glewInit failed, error: " << glewGetErrorString(err) << std::endl;
        exit(EXIT_FAILURE);
    }
    LINFOC("tgt.init", "GLEW version:       " << glewGetString(GLEW_VERSION));

    if (featureset & InitFeature::GPU_PROPERTIES )
        GpuCapabilities::init();
#ifdef _MSC_VER
        GpuCapabilitiesWindows::init();
#endif
    if (featureset & InitFeature::TESSELATOR)
        Tesselator::init();
    if (featureset & InitFeature::TEXTURE_MANAGER) {
        TextureManager::init();
        #ifdef TGT_HAS_DEVIL
            TexMgr.registerReader(new TextureReaderDevil());
        //devil has tga support so we do not need the built-in reader:
        #else
            TexMgr.registerReader(new TextureReaderTga());
        #endif
    }

    // starting shadermanager
    ShaderManager::init();
}
Exemplo n.º 6
0
void VoreenVersionQt::logAll(const std::string& loggerCat) {
    VoreenVersion::logAll(loggerCat);

    LINFOC(loggerCat, "Qt version: " << getQtVersion());
}