void VideoTable::draw()
{
    
    
    gl::clear( Color( 0, 0, 0) );
    gl::enableAlphaBlending();
    gl::color(1.0f,1.0f,1.0f);
    gl::draw(background_tex,getWindowBounds());
    for(int i=0;i<recipeViews.size();i++){
        recipeViews.at(i).draw();
    }
    if(model.useFrontPlate)    gl::draw(foreground_tex,getWindowBounds());
    
    if(controller.getDebugState()!=0){
        
        char buffer [50];
        int n;
        n=sprintf (buffer, "%i, %i, %i", pConnector.getVal(148920, 0),pConnector.getVal(148920,2),pConnector.getVal(148920, 2));
        
        if(controller.getDebugState()!=0){
            cTarget->update(buffer);
            cTarget->update(getMousePos());
            cTarget->draw();
        }
        if(model.useSensors) pg.draw(Rectf(getWindowWidth()/3.0f,getWindowHeight()/3.0f,getWindowWidth()*2.0f/3.0f,getWindowHeight()*2.0f/3.0f));
        
        mParams.show();
             params::InterfaceGl::draw();
    } else {
        mParams.hide();
    }
    

}
void Genetic_AlgorithmApp::draw()
{
    gl::clear(cinder::Color::black());

    auto screen = getWindowBounds();

    if (m_algoGenResult)
    {
        m_mutex.lock();
        {
            gl::draw(gl::Texture(m_algoGenResult), ci::Rectf(-(0.5f * m_currentImage.getWidth()), 0.5f * m_currentImage.getHeight(), 0.5f * m_currentImage.getWidth(), -(0.5f * m_currentImage.getHeight())));
        }
        m_mutex.unlock();
    }    

    if (m_renderCurrentImage && m_currentImage)
    {
        int32_t x1 = static_cast<int32_t>(- (0.5f * m_currentImage.getWidth()));
        int32_t y1 = static_cast<int32_t>(0.5f * m_currentImage.getHeight());

        int32_t x2 = static_cast<int32_t>((0.5f * m_currentImage.getWidth()) * 0.1f);
        int32_t y2 = static_cast<int32_t>(-((0.5f * m_currentImage.getHeight()) * 0.1f));

        x2 = static_cast<int32_t>(x1 + (0.1f * (x2 - x1)));
        y2 = static_cast<int32_t>(y1 + (0.1f * (y2 - y1)));
        
        gl::draw(gl::Texture(m_currentImage), ci::Rectf(x1, y1, x2, y2 ));
    }

    updateIHM();
}
Ejemplo n.º 3
0
void fsExperiments::draw()
{
	gl::clear( mBackground );

	CameraPersp cam( getWindowWidth(), getWindowHeight(), 60.0f );
	cam.setPerspective( 60, getWindowAspectRatio(), 1, 5000 );
	cam.lookAt( Vec3f( 0, 0, mEyeDistance ), Vec3f::zero(), Vec3f( 0, -1, 0 ) );
	gl::setMatrices( cam );

	gl::setViewport( getWindowBounds() );

	gl::enableDepthRead();
	gl::enableDepthWrite();

	GlobalData& data = GlobalData::get();

	gl::pushModelView();
	gl::rotate( mArcball.getQuat() );
	gl::rotate( data.mHeadRotation );

	mEffects[ mCurrentEffect ]->draw();

	gl::popModelView();

	params::PInterfaceGl::draw();
}
Ejemplo n.º 4
0
void GUIPanel::packFreeLayout()
{
  if(!update || !parent)
    return;

  Tuple4i newBounds = getWindowBounds();
  size_t  t         = 0;
  int     temp1     = 0,
          temp2     = 0;

  for(t = 0; t < elements.size(); t++)
  {
    elements[t]->forceUpdate(update);
    const Tuple4i &childBounds = elements[t]->getWindowBounds();

    newBounds.x = (childBounds.x - clipSize) < newBounds.x ?
                   childBounds.x - clipSize : newBounds.x;
    newBounds.y = (childBounds.y - clipSize) < newBounds.y ?
                   childBounds.y - clipSize : newBounds.y;
    newBounds.z = (childBounds.z + clipSize) > newBounds.z ?
                   childBounds.z + clipSize: newBounds.z;
    newBounds.w = (childBounds.w + clipSize) > newBounds.w ?
                   childBounds.w + clipSize : newBounds.w;
  }

  windowBounds = newBounds;
  update       = false;

  correctPosition();
  computeClippedBounds(windowBounds);

  for(t = 0; t < elements.size(); t++)
    elements[t]->computeWindowBounds();
}
Ejemplo n.º 5
0
void _TBOX_PREFIX_App::draw()
{
	if ( mChannel ) {
		ci::gl::TextureRef tex = ci::gl::Texture::create( Kinect2::channel16To8( mChannel ) );
		ci::gl::draw( tex, tex->getBounds(), getWindowBounds() );
	}
}
void SimpleParticlesApp::draw()
{
	gl::clear( Color::black() );

	gl::setViewport( getWindowBounds() );
	gl::setMatricesWindow( getWindowSize() );

	mEmitterController.render();

	/*
	if ( mTorrentRef )
	{
		Rectf bounds = getWindowBounds();
		int i = 0;
		for ( auto peer: mTorrentRef->getPeers() )
		{
			shared_ptr< PeerCircle > pcr = std::static_pointer_cast< PeerCircle >( peer );
			pcr->draw( bounds );
			//console() << "peer " << i << " " << pcr->getPos() << endl;
			i++;
		}
	}
	*/

	params::PInterfaceGl::draw();
}
Ejemplo n.º 7
0
void DetectingStage::drawTalkVid(){
	Texture talkVidTexture = talkVid_.getTexture();
	if (talkVidTexture && !isDebugMode){
		enableAlphaBlending();
		displayArea_.draw(talkVidTexture, getWindowBounds());
		disableAlphaBlending();
	}
}
void CinderKinectServerApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) ); 
	
	if (mOpenNIWrapper->getDepthSurface() != 0)
	{
		gl::draw(gl::Texture(mOpenNIWrapper->getDepthSurface()), getWindowBounds());	
	}
}
Ejemplo n.º 9
0
double FlareScoring::score(
        const QVector< DataPoint > &result)
{
    DataPoint dpBottom, dpTop;
    if (getWindowBounds(result, dpBottom, dpTop))
    {
        return dpTop.hMSL- dpBottom.hMSL;
    }

    return 0;
}
Ejemplo n.º 10
0
void SimplePuzzleApp::draw()
{
	gl::clear( Color::black() );

	if ( mTorrentRef )
	{
		Rectf rect( getWindowBounds() );
		rect.scaleCentered( Vec2f( .95f, .05f ) );
		std::dynamic_pointer_cast< TorrentPuzzle >( mTorrentRef )->draw( rect );
	}
}
Ejemplo n.º 11
0
double SpeedScoring::score(
        const MainWindow::DataPoints &result)
{
    DataPoint dpBottom, dpTop;
    if (getWindowBounds(result, dpBottom, dpTop))
    {
        return (dpTop.z - dpBottom.z) / (dpBottom.t - dpTop.t);
    }

    return 0;
}
void Genetic_AlgorithmApp::resize()
{
    ci::Rectf screen = getWindowBounds();
 
    m_beforeResizeWidth = screen.getWidth();
    m_beforeResizeHeight = screen.getHeight();

    m_camParam->setPosition(cinder::Vec2i(getWindowWidth() - 300, 20));
    m_ihmShader->setPosition(cinder::Vec2i(getWindowWidth() - 200, 190));
    m_ihmStats->setPosition(cinder::Vec2i(getWindowWidth() - 200, 260));
}
void Genetic_AlgorithmApp::start()
{
    if (m_isStarted || m_pixelPerSticky <= m_numberGapPixel || !m_currentImage)
        return;

    ci::Rectf screen = getWindowBounds();

    int width = m_currentImage.getWidth();
    int height = m_currentImage.getHeight();

    m_currentAlgoGenImage = ci::ip::resizeCopy(m_currentImage, m_currentImage.getBounds(), ci::Vec2i(width / m_pixelPerSticky, height / m_pixelPerSticky));

    m_algoGen.setPopSize(m_numberOfPopulation);
    m_algoGen.setup(m_currentAlgoGenImage.getWidth(), m_currentAlgoGenImage.getHeight());

    m_algoGenHeight.setPopSize(m_numberOfPopulation);
    m_algoGenHeight.getInterval(ColorAlgoGen::COPY) = m_algoGen.getInterval(ColorAlgoGen::COPY);
    m_algoGenHeight.getInterval(ColorAlgoGen::MUTATE) = m_algoGen.getInterval(ColorAlgoGen::MUTATE);
    m_algoGenHeight.getInterval(ColorAlgoGen::CROSSOVER) = m_algoGen.getInterval(ColorAlgoGen::CROSSOVER);
    m_algoGenHeight.getInterval(ColorAlgoGen::RANDOM) = m_algoGen.getInterval(ColorAlgoGen::RANDOM);

    m_algoGenHeight.setup(m_currentAlgoGenImage.getWidth(), m_currentAlgoGenImage.getHeight());

    genPlaneResult(m_currentAlgoGenImage.getWidth(), m_currentAlgoGenImage.getHeight(), m_planeResultAlgoGen);

    m_timerShader.start();

    m_isStarted = true;
    m_isPaused = false;
    m_isBuilder = false;

    if (m_thread.joinable())
        m_thread.join();

    if (m_threadHeight.joinable())
        m_threadHeight.join();

    m_threadRunning = true;

    m_thread = std::thread(std::bind(&Genetic_AlgorithmApp::threadingCompute, this));
    m_threadHeight = std::thread(std::bind(&Genetic_AlgorithmApp::threadingComputeHeight, this));

    int32_t distance = std::max(m_currentAlgoGenImage.getWidth(), m_currentAlgoGenImage.getHeight());

    m_camera.getCameraDistance() = static_cast<float>(distance /*+ distance * 1.1f*/);
    m_camera.update();

    setupIHM();
}
void Genetic_AlgorithmApp::draw()
{
    gl::clear(cinder::Color::black());

    m_camera.update();

    gl::enableDepthRead();
    gl::enableDepthWrite();

    if (m_isStarted && m_algoGenResult && m_heightMap)
    {
        auto texture = gl::Texture(m_algoGenResult);
        auto heightMap = gl::Texture(m_heightMap);

        m_shader->bind();

        m_shader->uniform("u_texture", 0);
        m_shader->uniform("u_heightMap", 1);
        m_shader->uniform("u_time", static_cast<float>(0.00025 * m_timerShader.getSeconds()));
        m_shader->uniform("u_neighbors", m_neighbors);

        texture.bind(0);
        heightMap.bind(1);
        
        gl::color(Color::white());

        gl::draw(m_planeResultAlgoGen);

        texture.unbind();
        heightMap.unbind();
        m_shader->unbind();
    }

    if (m_renderCurrentImage && m_currentImage)
    {
        auto screen = getWindowBounds();
        auto demiW = 0.5f * screen.getWidth();
        auto demiH = 0.5f * screen.getHeight();

        float widthTenPercent = 0.1f * demiW;
        float heightTenPercent = 0.1f * demiH;
        
        ci::Rectf rectDraw(demiW - widthTenPercent, demiH - heightTenPercent, demiW, demiH);

        gl::draw(gl::Texture(m_currentImage), rectDraw);
    }

    updateIHM();
}
Ejemplo n.º 15
0
void HodginDidItApp::drawVeil()
{
	gl::clear(Color::black());

	mFboWater[mFboIndex].bindTexture(0,0);
	gl::enable(GL_TEXTURE_2D);
	mFboPoints.bindTexture(1);
	mShaderDisplace.bind();
	mShaderDisplace.uniform("buffer",0);
	mShaderDisplace.uniform("pixel",mPixelSize);
	mShaderDisplace.uniform("tex",1);
	gl::drawSolidRect(getWindowBounds());
	mFboPoints.unbindTexture();
	gl::disable(GL_TEXTURE_2D);
	mShaderDisplace.unbind();
}
Ejemplo n.º 16
0
//////////////////////////////////////////////
//
// DRAW
//
void MyApp::draw()
{
	sf::gl::setMatrices( mCam );
	gl::setViewport( getWindowBounds() );
	mShader.bind();
	this->renderScene();
	mShader.unbind();
	
	glDisable( GL_LIGHTING );
	gl::setMatricesWindow( getWindowSize() );
	gl::disableDepthRead();
	gl::disableDepthWrite();
	gl::enableAlphaBlending();
	gl::drawString( "Press: [R]ender, [S]ave, [D]ump to console", Vec2f( 10, 10), Color::white(), mFont );
	gl::drawString( sunflow.getStatus(), Vec2f( 10, 25), Color::white(), mFont );
	gl::disableAlphaBlending();
}
Ejemplo n.º 17
0
void GUITextBox::render(float clockTick)
{
  if (!parent || !visible)
    return;
    
  modifyCurrentAlpha(clockTick);
  getWindowBounds();
  
  int realBlinkerPosition = clamp(blinkerPosition,
                                  windowBounds.x  + padding.x,
                                  windowBounds.z  - padding.x);
  blinkerTimer += clockTick;
  blinkerTimer -= blinkerTimer > 1.0f ? 1.0f : 0.0f;
  
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glColor4fv(color);
  
  glBegin(GL_TRIANGLE_STRIP);
  glVertex2i(windowBounds.x, windowBounds.y);
  glVertex2i(windowBounds.x, windowBounds.w);
  glVertex2i(windowBounds.z + padding.x, windowBounds.y);
  glVertex2i(windowBounds.z + padding.x, windowBounds.w);
  glEnd();
  
  glColor3fv(bordersColor);
  glBegin(GL_LINE_LOOP);
  glVertex2i(windowBounds.x, windowBounds.y);
  glVertex2i(windowBounds.x, windowBounds.w);
  glVertex2i(windowBounds.z + padding.x, windowBounds.w);
  glVertex2i(windowBounds.z + padding.x, windowBounds.y);
  glEnd();
  glDisable(GL_BLEND);
  
  label.print(windowBounds.x + padding.x, windowBounds.y, textStartIndex, textEndIndex);
  
  if (blinkerOn && (blinkerTimer > 0.5f))
  {
    glColor3fv(label.getColor());
    glBegin(GL_LINES);
    glVertex2i(realBlinkerPosition, windowBounds.y + padding.y/2);
    glVertex2i(realBlinkerPosition, windowBounds.w - padding.y);
    glEnd();
    glColor3f(1,1,1);
  }
}
void VJ_Boilerplate::draw(){
    gl::enableAlphaBlending();
    gl::clear( Color( 0, 0, 0 ) );
    WindowData *data = getWindow()->getUserData<WindowData>();
	if(data->type == 0){

        //write visualization to scene
        Area  viewport = gl::getViewport();
        scene.bindFramebuffer();
        gl::setViewport(scene.getBounds());
        gl::clear( Color( 0, 0, 0 ) );
        
        //Drawing Commands
        for(auto visual : visuals){
            visual->requestDraw();
        }
        
        //For some weird reason we need to call an gl-command after the drawing ?!
        gl::color(255,255,255);
        scene.unbindFramebuffer();
        
        for(auto shader : shaders){
            shader->requestStart();
            shader->requestSet();
        }
        
        //draw the visualization inside the shader commands
        gl::pushModelView();
        gl::translate(Vec2f(0, getWindowHeight()));
        gl::scale(Vec3f(1, -1, 1));
        gl::draw(scene.getTexture(), getWindowBounds());
        gl::popModelView();
        
        for(auto shader : shaders){
            shader->requestEnd();
        }
        
        gl::setViewport(viewport);

        visuals.at(visuals.size()-1)->requestDraw();
        
    }else{
        //If you have multiple windows you can define different type of actions for each window...
        //visuals.at(0)->draw();
    }
}
Ejemplo n.º 19
0
GHOST_TSuccess GHOST_WindowWin32::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
{
	GHOST_TSuccess success;
	GHOST_Rect cBnds, wBnds;
	getClientBounds(cBnds);
	if ((cBnds.getWidth() != (GHOST_TInt32)width) || (cBnds.getHeight() != (GHOST_TInt32)height)) {
		getWindowBounds(wBnds);
		int cx = wBnds.getWidth() + width - cBnds.getWidth();
		int cy = wBnds.getHeight() + height - cBnds.getHeight();
		success = ::SetWindowPos(m_hWnd, HWND_TOP, 0, 0, cx, cy, SWP_NOMOVE | SWP_NOZORDER) ?
		          GHOST_kSuccess : GHOST_kFailure;
	}
	else {
		success = GHOST_kSuccess;
	}
	return success;
}
void msaFluidParticlesApp::draw()
{
	gl::clear( Color( 1.0f, 1.0f, 1.0f ) );


	CameraPersp cam( getWindowWidth(), getWindowHeight(), 60.0f );
	cam.setPerspective( 60, getWindowAspectRatio(), 1, 1500 );
	cam.lookAt( Vec3f( 2.6f, 1.6f, -2.6f ), Vec3f::zero() );
	gl::setMatrices( cam );
	gl::rotate( mArcball.getQuat() );

	// set the viewport to match our window
	gl::setViewport( getWindowBounds() );

	gl::enableDepthRead();
	gl::enableDepthWrite();

	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK);

	//mFbo.bindTexture();
	gl::Texture txFluid = mFbo.getTexture(0);

	
	mShader->bind();
	txFluid.enableAndBind();
	mShader->uniform( "displacementMap", 0 );
	mShader->uniform( "colorMap", 0 );
	gl::drawSphere(Vec3f::zero(), 1.0, 254);
	txFluid.unbind();
	mShader->unbind();
	//mFbo.unbindTexture();

	gl::disable(GL_CULL_FACE);
	gl::disableDepthRead();
	gl::disableDepthWrite();
	gl::setMatricesWindow( getWindowSize());
	if(drawFluidTex){
		glEnable( GL_TEXTURE_2D );
		txFluid.setFlipped(true);
		gl::draw( txFluid, Rectf( 0, 0, 256, 256));
		glDisable(GL_TEXTURE_2D);
	}
}
Ejemplo n.º 21
0
void    GUITextBox::setupBlinker(int x)
{
  if (!focused || !active)
    return;
    
  GUIFont *font           = GUIFontManager::getFont(label.getFontIndex());
  const    String &string = label.getString();
  const    int    *spaces = NULL;
  blinkerPosition         = getWindowBounds().x + padding.x;
  x -= 1;
  
  if (font)
  {
    spaces = font->getFontObject()->getCharHorizontalGlyphs();
    
    for (size_t i = 0; i < string.getLength(); i++)
      if (blinkerPosition < x)
        blinkerPosition += spaces[int(string.getBytes()[i])];
  }
  
  blinkerOn = true;
}
Ejemplo n.º 22
0
void FlareScoring::prepareDataPlot(
        DataPlot *plot)
{
    // Return now if plot empty
    if (mMainWindow->dataSize() == 0) return;

    DataPoint dpBottom, dpTop;
    bool success;

    switch (mMainWindow->windowMode())
    {
    case MainWindow::Actual:
        success = getWindowBounds(mMainWindow->data(), dpBottom, dpTop);
        break;
    case MainWindow::Optimal:
        success = getWindowBounds(mMainWindow->optimal(), dpBottom, dpTop);
        break;
    }

    // Add shading for scoring window
    if (success && plot->yValue(DataPlot::Elevation)->visible())
    {
        DataPoint dpLower = mMainWindow->interpolateDataT(mMainWindow->rangeLower());
        DataPoint dpUpper = mMainWindow->interpolateDataT(mMainWindow->rangeUpper());

        const double xMin = plot->xValue()->value(dpLower, mMainWindow->units());
        const double xMax = plot->xValue()->value(dpUpper, mMainWindow->units());

        QVector< double > xElev, yElev;

        xElev << xMin << xMax;
        yElev << plot->yValue(DataPlot::Elevation)->value(dpBottom, mMainWindow->units())
              << plot->yValue(DataPlot::Elevation)->value(dpBottom, mMainWindow->units());

        QCPGraph *graph = plot->addGraph(
                    plot->axisRect()->axis(QCPAxis::atBottom),
                    plot->yValue(DataPlot::Elevation)->axis());
        graph->setData(xElev, yElev);
        graph->setPen(QPen(QBrush(Qt::lightGray), mMainWindow->lineThickness(), Qt::DashLine));

        yElev.clear();
        yElev << plot->yValue(DataPlot::Elevation)->value(dpTop, mMainWindow->units())
              << plot->yValue(DataPlot::Elevation)->value(dpTop, mMainWindow->units());

        graph = plot->addGraph(
                    plot->axisRect()->axis(QCPAxis::atBottom),
                    plot->yValue(DataPlot::Elevation)->axis());
        graph->setData(xElev, yElev);
        graph->setPen(QPen(QBrush(Qt::lightGray), mMainWindow->lineThickness(), Qt::DashLine));

        QCPItemRect *rect = new QCPItemRect(plot);
        plot->addItem(rect);

        rect->setPen(QPen(QBrush(Qt::lightGray), mMainWindow->lineThickness(), Qt::DashLine));
        rect->setBrush(QColor(0, 0, 0, 8));

        rect->topLeft->setType(QCPItemPosition::ptAxisRectRatio);
        rect->topLeft->setAxes(plot->xAxis, plot->yValue(DataPlot::Elevation)->axis());
        rect->topLeft->setCoords(-0.1, -0.1);

        rect->bottomRight->setType(QCPItemPosition::ptAxisRectRatio);
        rect->bottomRight->setAxes(plot->xAxis, plot->yValue(DataPlot::Elevation)->axis());
        rect->bottomRight->setCoords(
                    (plot->xValue()->value(dpBottom, mMainWindow->units()) - xMin) / (xMax - xMin),
                    1.1);

        rect = new QCPItemRect(plot);
        plot->addItem(rect);

        rect->setPen(QPen(QBrush(Qt::lightGray), mMainWindow->lineThickness(), Qt::DashLine));
        rect->setBrush(QColor(0, 0, 0, 8));

        rect->topLeft->setType(QCPItemPosition::ptAxisRectRatio);
        rect->topLeft->setAxes(plot->xAxis, plot->yValue(DataPlot::Elevation)->axis());
        rect->topLeft->setCoords(
                    (plot->xValue()->value(dpTop, mMainWindow->units()) - xMin) / (xMax - xMin),
                    -0.1);

        rect->bottomRight->setType(QCPItemPosition::ptAxisRectRatio);
        rect->bottomRight->setAxes(plot->xAxis, plot->yValue(DataPlot::Elevation)->axis());
        rect->bottomRight->setCoords(1.1, 1.1);
    }
}
void msaFluidParticlesApp::fadeToColor( float r, float g, float b, float speed )
{
	glColor4f( r, g, b, speed );
	gl::drawSolidRect( getWindowBounds() );
}
Ejemplo n.º 24
0
Surface	AppBase::copyWindowSurface( const Area &area )
{
	Area clippedArea = area.getClipBy( getWindowBounds() );
	return getWindow()->getRenderer()->copyWindowSurface( clippedArea, getWindow()->toPixels( getWindow()->getHeight() ) );
}
Ejemplo n.º 25
0
Tuple2i  GUIRectangle::getCenter()
{
  getWindowBounds();
  return Tuple2i((windowBounds.x + windowBounds.z)/2,
                 (windowBounds.y + windowBounds.w)/2);
}