Exemplo n.º 1
0
CubeMap::CubeMap( GLsizei texWidth,
                 GLsizei texHeight,
                 const ofTexture &pos_x,
                 const ofTexture &pos_y,
                 const ofTexture &pos_z,
                 const ofTexture &neg_x,
                 const ofTexture &neg_y,
                 const ofTexture &neg_z )
{
    mWidth = texWidth;
    mHeight = texHeight;
    setupCapture();
//    glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS)​;
    glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
	//create a texture object
	glGenTextures(1, &textureObject);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, textureObject);
	//assign the images to positions

	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, pos_x.getTextureData());
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, neg_x.getTextureData());
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, pos_y.getTextureData());
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, neg_y.getTextureData());
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, pos_z.getTextureData());
	glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, neg_z.getTextureData());
	//set filtering modes for scaling up and down
	glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
Exemplo n.º 2
0
void Preview::start(unsigned int format, QSize resolution, int framerate)
{
    if (wc->previewFormatMap.isEmpty() || !wc->previewFormatMap.keys().contains(format)) return;
    Q_UNUSED(framerate);
    if (preview_active) return;

    pixelformat = qFourccToVideoFormat(format);
    qDebug()<<"pixelformat: "<<pixelformat;

    if (pixelformat == QVideoFrame::Format_Invalid) {
        qWarning()<<"v4lwebcam: pixel format not understood by video library";
        return;
    }

    wc->open();
    setupCapture(current_format = format, current_resolution = resolution);


    notifier = new QSocketNotifier(wc->fd, QSocketNotifier::Read , this);
    notifier->setEnabled(false);
    connect(notifier, SIGNAL(activated(int)), this, SLOT(captureFrame()));

    startCapture();
    preview_active = true;
}
Exemplo n.º 3
0
/////////////////////////////////////////////////////////
// startrender
//
/////////////////////////////////////////////////////////
void pix_videoDarwin :: stopRendering()
{
    //this should stop the recording process
    m_record = 0;
    setupCapture();
    //stopTransfer();
}
void Genetic_AlgorithmApp::setup()
{
    m_appPath = getArgs()[0];
    m_appPath = m_appPath.parent_path();

    /* App */
    m_renderCurrentImage = false;
    /* === */
    /* Algo Gen */
	m_pixelPerSticky = 15;
	m_numberGapPixel = 0;
    m_isStarted = false;
    m_isPaused = false;
    /* === */

    /* Image Load*/
    m_currentImageLoadedIndex = 0;
    /* === */
    
    /* Camera capture */
    setupCapture();
    m_hasCaptureCamera = false;
    m_realTime = false;
    /* === */

    /* IHM */
    m_ihmParam = cinder::params::InterfaceGl::create("Sticky", cinder::Vec2i(245, 340));
    m_ihmParam->setPosition(cinder::Vec2i(20, 20));
    
    m_camParam = cinder::params::InterfaceGl::create("Camera", cinder::Vec2i(250, 150));
    m_camParam->setPosition(cinder::Vec2i(getWindowWidth() - 300, 20));

    m_ihmShader = cinder::params::InterfaceGl::create("Shader", cinder::Vec2i(150, 50));
    m_ihmShader->setPosition(cinder::Vec2i(getWindowWidth() - 200, 190));

    m_ihmStats = cinder::params::InterfaceGl::create("Stats", cinder::Vec2i(200, 100));
    m_ihmStats->setPosition(cinder::Vec2i(getWindowWidth() - 200, 260));
    m_ihmStats->hide();

    setupIHM();
    /* === */

    /* THREAD */
    m_threadRunning = false;
    m_computeFPS = 0.0;
    m_computeHeightFPS = 0.0;

    m_numberOfPopulation = 100;

    /* Camera */
    m_camera.setup(60.0f, getWindowAspectRatio(), 5.0f, 300000.0f, 500.f);

    /* shader */
    m_neighbors = 1;
    try
    {
        m_shader = gl::GlslProg::create(loadResource(SHADER_VERT), loadResource(SHADER_FRAG));
    }
    catch (gl::GlslProgCompileExc& e)
    {
        console() << e.what() << std::endl;
        quit();
    }
    catch (...)
    {
        console() << "Shader error" << std::endl;
        quit();
    }

    m_isBuilder = false;
    //console() << m_shader->getShaderLog(m_shader->getHandle()) << std::endl;
}