Esempio n. 1
0
void ForestApp::draw()
{
    gl::clear( Color::gray(0.9f) );

    float wallWidth = getWindowWidth() * 0.75;
    float wallHeight = wallWidth / mStrandBox.mBorderRect.getAspectRatio();
    Vec2f wallSize(wallWidth, wallHeight);
    Vec2f wallTopLeft = getWindowCenter() - wallSize/2;

    // Wall coordinate system, Y=0 at bottom with +Y in growth direction
    gl::pushModelView();
    gl::translate(wallTopLeft.x, wallTopLeft.y + wallHeight);
    gl::scale(wallWidth, -wallWidth);

    // Drawing should be safe without acquiring the mutex (performance)
    mStrandBox.draw();
    mDots.draw();
    mPanels.draw();

    gl::popModelView();
    
    if (mShowMatrix) {
        mDots.drawAffinityMatrix();
    }
    mParams->draw();
}
void TextParticlesApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
	gl::color( 1, 1, 1 );
	gl::enableAlphaBlending();
	
	{
		gl::ScopedMatrices scpMtrx;
		
		// SET matrices so that by default, we are looking at a rect the size of the window
		lookAtTexture( mCam, getWindowSize() );
		
		gl::translate( mTextSize * vec2( -0.5 ) );
		
		gl::ScopedDepth scpDepth(	true );
//		gl::ScopedColor scpColor( 1, 0, 0 );
//		gl::drawStrokedRect( Rectf( 0, 0, mTextSize.x, mTextSize.y ) );
		
		gl::color( Color::white() );
		if( mActive ){
			gl::ScopedGlslProg render( mRenderProg );
			gl::ScopedVao vao( mAttributes[mSourceIndex] );
			gl::context()->setDefaultShaderVars();
			gl::drawArrays( GL_POINTS, 0, mTextParticleCount );
			
		}else{
			if( mString.length() > 0 )
				gl::draw( mTextFbo->getColorTexture() );
		}
		
	}
	
	mParams->draw();
}
void OpenCVTemplateApp::draw()
{
    gl::clear( Color( 0, 0, 0 ) );
    if(imageTexture) {

        unsigned int windowWidth = this->getWindow()->getWidth();
        unsigned int windowHeight = this->getWindow()->getHeight();
        gl::pushMatrices();
        gl::translate((windowWidth-image.cols)/2, (windowHeight-image.rows)/2);
        gl::draw(imageTexture);
        gl::popMatrices();
    }
    if(frameTexture) {
        gl::pushMatrices();
        unsigned int windowWidth = this->getWindow()->getWidth();
        unsigned int windowHeight = this->getWindow()->getHeight();
        gl::translate((windowWidth-frameWidth)/2, (windowHeight-frameHeight)/2);
        gl::draw(frameTexture);

        if(featurePoints.size() > 0) {
            gl::color(1,0,0);
            for(auto& p : featurePoints) {
                gl::drawSolidCircle(fromOcv(p), 1);
            }
            gl::color(1,1,1);
        }
        gl::popMatrices();
    }
    interface->draw();
}
void TextboxApp::draw()
{
	// clear out the window with black
	gl::clear( Color( 0.15f, 0.15f, 0.15f ) );
    gl::setMatricesWindow(app::getWindowSize());
  
    glAlphaFunc(GL_GREATER, 0.0);
    glEnable(GL_ALPHA_TEST);
    glEnable( GL_BLEND );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
    
    glPushMatrix();
    glTranslatef(PADDING + mTextBox->getTopLeft().x,PADDING + mTextBox->getTopLeft().y,0);
    glColor3f(1,1,1);
    gl::draw(mTextBox->getTexture());
    
    if(TEXT_BOX_DEBUG_DRAW){
        mTextBox->debugDraw();
    }
    glPopMatrix();
    
    glDisable(GL_BLEND);
    glDisable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.5); // reset what seems to be cinders default
    
    mParams->draw();
}
Esempio n. 5
0
void cApp::draw(){
    
    bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
        
        gl::clear();    
        gl::enableDepthRead();
        gl::enableDepthWrite();
        gl::enableAlphaBlending();
        glPointSize(1);
        glLineWidth(1);
    
        if( !mExp.bRender && !mExp.bSnap ){ mt::drawCoordinate(10); }
        for( int i=0; i<rms.size(); i++){
            rms[rms.size()-i-1].draw();
        }
        
        norms.draw();
        
    }mExp.end();
    
    mExp.draw();
    
    if(gui) gui->draw();

    if( bStart && !bFall )frame++;
}
Esempio n. 6
0
void FlockingApp::draw()
{	
	gl::clear( Color( 0, 0, 0 ), true );
	gl::enableDepthRead();
	gl::enableDepthWrite();
	
	// DRAW PARTICLES
	mParticleController.draw();
	
	// DRAW ZONE DIAGRAM
	gl::disableDepthRead();
	gl::disableDepthWrite();
	gl::setMatricesWindow( getWindowSize() );
	gl::pushModelView();
		gl::translate( Vec3f( 117.0f, getWindowHeight() - 117.0f, 0.0f ) );
		
		gl::color( ColorA( 0.25f, 0.25f, 1.0f, 1.0f ) );
		gl::drawSolidCircle( Vec2f::zero(), mZoneRadius );
		
		gl::color( ColorA( 1.0f, 1.0f, 1.0f, 0.25f ) );
		gl::drawStrokedCircle( Vec2f::zero(), 100.0f );
	gl::popModelView();
	
	// DRAW PARAMS WINDOW
	mParams->draw();
}
void WaterSimulationApp::draw(){

	gl::clear( Color( 0.11f, 0.13f, 0.1f ) );
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	mParams->draw();

	gl::setMatrices(mMayaCam.getCamera());
	if(mDrawBox){
		glColor4f(0.2, 0.4, 0.5, 1);//orange
		gl::drawStrokedCube(boxCenter,boxDimension);
	}
	if(mDrawGravity){
		glColor4f(1.0f,0.3f,0.0f,0.5f);//red
		if(mDrawGravity)glColor4f(0.0f,1.0f,0.5f,1);//green
		gl::drawVector(boxCenter,(boxCenter-gravity),3.0f,1.0f);
	}

	//draw random force
	if(mDrawForce){
		if(randomForce.lengthSquared()!=0){
			glColor4f(1.0f,0.0f,0.0f,1);
			gl::drawVector(randomForceX,randomForce+randomForceX,1.0f,0.5f);
		}
	}

	fluidsys->draw();

}
Esempio n. 8
0
void cApp::draw(){
    
    gl::enableAlphaBlending();
    glPointSize(1);
    glLineWidth(1);
    
    //bOrtho ? mExp.beginOrtho( true ) : mExp.begin( camUi.getCamera() ); {
    {
        mExp.bind();
        gl::clear();
        gl::enableDepthRead();
        gl::enableDepthWrite();

        for( int i=0; i<6; i++){
            gl::pushMatrices();
            gl::setMatrices( cams[i] );
            
            if( !mExp.bRender && !mExp.bSnap ){
                mt::drawCoordinate(160);
            }
            
            rms[i].draw();
            
            gl::popMatrices();
        }
    }mExp.end();

    mExp.draw();

    if(gui) gui->draw();

    if( bStart)frame++;
}
Esempio n. 9
0
void ciApp::draw()
{
	gl::clear();

	gl::ScopedColor white(Color::white());

	auto get_center_rect = [&](Area area) ->Rectf { return Rectf(area).getCenteredFit(getWindowBounds(), true); };

	{	
		//auto tex = filter->getTexture();
		auto tex = vector_blur.getTexture();
		gl::draw(tex, get_center_rect(tex->getBounds()));
	}
	
	{
		gl::ScopedMatrices scpMatrix;
		gl::scale(0.2f, 0.2f);
		gl::draw(mTexture);
	}

	vector_blur.drawDebug(vec2(0, 0), 0.2f);

	mParams->draw();

	{
		TextLayout infoFps;
		infoFps.clear(ColorA(0.2f, 0.2f, 0.2f, 0.5f));
		infoFps.setColor(Color::white());
		infoFps.setFont(Font("Arial", 16));
		infoFps.setBorder(4, 2);
		infoFps.addLine("App Framerate: " + tostr(getAverageFps(), 1));
		auto tex = gl::Texture::create(infoFps.render(true));
		gl::draw(tex, ivec2(20, getWindowHeight() - tex->getHeight() - 20));
	}
}
void ImageBasedLighting_05App::draw()
{
    gl::clear( Color( 0, 0, 0 ) );
    
    gl::setMatrices( mCam );
    
    // enable depth testing
    gl::ScopedDepth scopedDepth( true );
    
    // bind the cubemap textures
    gl::ScopedTextureBind scopedTexBind0( mTextureRadianceMap, 0 );
    gl::ScopedTextureBind scopedTexBind1( mTextureIrradianceMap, 1 );
    gl::ScopedTextureBind scopedTexBind2( mNormalMap, 2 );
    gl::ScopedTextureBind scopedTexBind3( mRoughnessMap, 3 );
    gl::ScopedTextureBind scopedTexBind4( mMetallicMap, 4 );
    gl::ScopedTextureBind scopedTexBind5( mColorMap, 5 );
    gl::ScopedTextureBind scopedTexBind6( mAOMap, 6 );
    gl::ScopedTextureBind scopedTexBind7( mSpecularMap, 7 );
    
    auto shader = mBatchModel->getGlslProg();
    shader->uniform( "uRadianceMap", 0 );
    shader->uniform( "uIrradianceMap", 1 );
    shader->uniform( "uNormalMap", 2 );
    shader->uniform( "uRoughnessMap", 3 );
    shader->uniform( "uMetallicMap", 4 );
    shader->uniform( "uColorMap", 5 );
    shader->uniform( "uAOMap", 6 );
    shader->uniform( "uSpecularMap", 7);
    
    // sends the base color, the specular opacity,
    // the light position, color and radius to the shader
//    shader->uniform( "uBaseColor", mBaseColor );
//    shader->uniform( "uSpecular", mSpecular );
//    shader->uniform( "uNormalMapScale",mNormalMapScale);
    
    // sends the tone-mapping uniforms
    shader->uniform( "uExposure", mExposure );
    shader->uniform( "uGamma", mGamma );
    
    // render a grid of sphere with different roughness/metallic values and colors
    {
        
//        shader->uniform( "uRoughness", mRoughness );
//        shader->uniform( "uRoughness4", pow( mRoughness, 4.0f ) );
//        shader->uniform( "uMetallic", mMetallic );
        
        mBatchModel->draw();
        
    }
    
    // render skybox
    shader = mBatchSkyBox->getGlslProg();
    shader->uniform( "uExposure", mExposure );
    shader->uniform( "uGamma", mGamma );
    mBatchSkyBox->draw();
    
    //  DRAW SETTINGS
    _params->draw();
}
Esempio n. 11
0
void ThresholdTestApp::draw()
{
	gl::clear( Color( 0.1f, 0.1f, 0.15f ) );

	if( mTexture )
		gl::draw( mTexture );
	
	mParams->draw();
}
void ImageRetargetingApp::drawLinearScaleWindow()
{
    gl::clear( Color( 0.f, 0.f, 0.f ) );
    
    if( originalTexture ) {
        gl::draw(originalTexture, *linearScaleRec);
    }
    linearScalingParams->draw();
}
Esempio n. 13
0
void AudioObjApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
    gl::enableAlphaBlending();
    gl::enableDepthRead();
    gl::enableDepthWrite();
    
    gl::pushMatrices();

	gl::setMatrices( mMayaCam.getCamera() );
	
	if ( mFeature && mFeatureTex )
	{
		mShader->bind();
		mFeatureTex.enableAndBind();
		mShader->uniform( "dataTex",		0 );
		mShader->uniform( "texWidth",		(float)mFeatureTex.getWidth() );
		mShader->uniform( "texHeight",		(float)mFeatureTex.getHeight() );
		mShader->uniform( "soundDataSize",  (float)mFeature->getSize() );
		mShader->uniform( "spread",         mFeatureSpread );
		mShader->uniform( "spreadOffset",   mFeatureSpreadOffset );
        mShader->uniform( "time",           (float)getElapsedSeconds() );
		mShader->uniform( "tintColor",      mObjColor );
	}
    
    if ( mRenderWireframe )
        gl::enableWireframe();
    
	gl::color( Color(1.0f, 0.0f, 0.0f ) );
    
	if ( mVbo )
	    gl::draw( mVbo );

    if ( mRenderWireframe )
        gl::disableWireframe();
    
	mShader->unbind();
	mFeatureTex.unbind();

	gl::color( Color::white() );
//	gl::drawCoordinateFrame();
  
	gl::popMatrices();
    
    gl::disableDepthRead();
    gl::disableDepthWrite();
    
	gl::setMatricesWindow( getWindowSize() );

	ciXtractReceiver::drawData( mFeature, Rectf( 15, getWindowHeight() - 150, 255, getWindowHeight() - 35 ) );
	
	gl::draw( mFeatureSurf );

    mParams->draw();
}
Esempio n. 14
0
void GeometryApp::draw()
{
	// Prepare for drawing.
	gl::clear();
	gl::setMatrices( mCamera );
	
	// Draw the grid.
	if( mShowGrid && mGrid ) {
		gl::ScopedGlslProg scopedGlslProg( gl::context()->getStockShader( gl::ShaderDef().color() ) );
		// draw the coordinate frame with length 2.
		gl::drawCoordinateFrame( 2 );
		mGrid->draw();
	}

	if( mPrimitive ) {
		gl::ScopedTextureBind scopedTextureBind( mTexture );
		mPhongShader->uniform( "uTexturingMode", mTexturingMode );

		// Rotate it slowly around the y-axis.
		gl::ScopedModelMatrix matScope;
		gl::rotate( float( getElapsedSeconds() / 5 ), 0, 1, 0 );

		// Draw the normals.
		if( mShowNormals && mPrimitiveNormalLines ) {
			gl::ScopedColor colorScope( Color( 1, 1, 0 ) );
			mPrimitiveNormalLines->draw();
		}

		// Draw the primitive.
		gl::ScopedColor colorScope( Color( 0.7f, 0.5f, 0.3f ) );

		if( mViewMode == WIREFRAME ) {
			// We're using alpha blending, so render the back side first.
			gl::ScopedAlphaBlend blendScope( false );
			gl::ScopedFaceCulling cullScope( true, GL_FRONT );

			mWireframeShader->uniform( "uBrightness", 0.5f );
			mPrimitiveWireframe->draw();

			// Now render the front side.
			gl::cullFace( GL_BACK );

			mWireframeShader->uniform( "uBrightness", 1.0f );
			mPrimitiveWireframe->draw();
		}
		else
			mPrimitive->draw();
	}

	// Render the parameter window.
#if ! defined( CINDER_GL_ES )
	if( mParams )
		mParams->draw();
#endif
}
Esempio n. 15
0
void hidTestApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
	
	gl::setMatricesWindow( getWindowSize() );
	
	mInteractionZonesDebug->draw();
	
	drawKey();
	
	mParams->draw();
}
Esempio n. 16
0
void RDiffusionApp::draw()
{
	gl::clear();
	gl::setMatricesWindow( getWindowSize() );
	gl::viewport( getWindowSize() );
	{
		gl::ScopedTextureBind bind( mFBOs[mCurrentFBO]->getColorTexture() );
		gl::drawSolidRect( getWindowBounds() );
	}
	
	mParams->draw();
}
Esempio n. 17
0
void FlockingApp::draw()
{	
	gl::clear( Color( 0, 0, 0.01f ), true );
	gl::enableDepthRead();
	gl::enableDepthWrite();
	
	// DRAW PARTICLES
	glColor4f( ColorA( 1.0f, 1.0f, 1.0f, 1.0f ) );
	mParticleController.draw();
	
	// DRAW PARAMS WINDOW
	mParams->draw();
}
Esempio n. 18
0
void NormalGetterApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
    
    if(mFbo && mOutputFbo){
        normalize(mFbo->getColorTexture());
        gl::draw(mOutputFbo->getColorTexture());
    }
    
  //  if(mFbo) gl::draw(mFbo->getColorTexture());
    mStatus->draw();
    mParams->draw();
}
void ImageRetargetingApp::drawSeamCarvingWindow()
{
    gl::clear( Color( 0.f, 0.f, 0.f ) );
    switch(seamCarvingState)
    {
        case SeamCarvingState::ShowImage:
            if( seamCarvedTexture ) {
                gl::draw(seamCarvedTexture);
            }
            break;
            
        case SeamCarvingState::ShowGradient:
            if( gradientTexture ) {
                gl::draw(gradientTexture);
            }
            break;
            
        case SeamCarvingState::SeamCarving:
            if(seamCarvedTexture){
                int dw = seamCarver->newWidth - seamCarvedImage.getWidth();
                int dh = seamCarver->newHeight - seamCarvedImage.getHeight();
                
                if (dw<0 && dh<0){
                    seamCarvingWindow->setSize(seamCarvedTexture.getWidth()-1, seamCarvedTexture.getHeight());
                    seamCarvedImage = seamCarver->deleteVerticalSeam(seamCarvedImage);
                }
                else if (dw<0){
                    seamCarvingWindow->setSize(seamCarvedTexture.getWidth()-1, seamCarvedTexture.getHeight());
                    seamCarvedImage = seamCarver->deleteVerticalSeam(seamCarvedImage);
                }
                else if (dh<0){
                    seamCarvingWindow->setSize(seamCarvedTexture.getWidth(), seamCarvedTexture.getHeight()-1);
                    seamCarvedImage = seamCarver->deleteHorizontalSeam(seamCarvedImage);
                }
                //TODO:: Add Seam
                else if (dw>=0 && dh>=0) {
                    seamCarvingState = SeamCarvingState::ShowImage;
                    seamCarver->stopCarveTimer();
                }
                seamCarvedTexture = gl::Texture(seamCarvedImage);
                gl::draw(seamCarvedTexture);
            }
            
            break;
        case SeamCarvingState::Undefined:
            break;
    }
    seamCarvingParams->draw();
}
void SpawnObjectApp::draw()
{
    // clear out the window with black
    gl::clear( Color::gray( 0.15f ) );
    
    gl::enableDepthRead();
    gl::enableDepthWrite();
    gl::enableAlphaBlending();
    
    gl::enable( GL_TEXTURE_2D );
    
    gl::setMatrices( mMayaCam.getCamera() );                   // set camera matrices
    //    mLight->update( mMayaCam.getCamera() );
    
    Fixture::renderGrid();
    
    gl::enable( GL_LIGHTING );
    
    if ( mVenueMesh )                                           // render venue
        gl::draw( mVenueMesh );
    
    gl::disable( GL_LIGHTING );
    
    if ( mFixtureMesh )                                         // render fixtures
    {
        FixtureRef fix;
        
        for( size_t k=0; k < mFixtures.size(); k++ )
        {
            fix = mFixtures[k];
            
            ci::gl::pushMatrices();                             // store current matrices
            ci::gl::translate( fix->getPos() );                 // translate
            
            ci::gl::color( fix->getValue() * Color::white() );
            
            ci::gl::draw( mFixtureMesh );                       // draw mesh
            ci::gl::popMatrices();                              // restore matrices
        }
        
        ci::gl::color( ci::Color::white() );
    }
    
    if ( mModule )                                              // render effect preview
        mModule->render();
    
    mParams->draw();
}
Esempio n. 21
0
void FlockingApp::draw()
{	
	gl::clear( Color( 0, 0, 0 ), true );
	gl::enableDepthRead();
	gl::enableDepthWrite();

	gl::color( ColorA( 1.0f, 1.0f, 1.0f, 1.0f ) );
	mParticleController.draw();
	
	if( mSaveFrames ){
		writeImage( getHomeDirectory() / "flocking" / ("image_" + toString( getElapsedFrames() ) + ".png"), copyWindowSurface() );
	}
	
	// DRAW PARAMS WINDOW
	mParams->draw();
}
void ImageRetargetingApp::drawMeshWarpingWindow()
{
    gl::clear( Color( 0.f, 0.f, 0.f ) );
    
    switch (meshWarpingState) {
        case MeshWarpingState::ShowImage :
            
            if (originalTexture) {
                meshWarpRetargetter->drawMesh(originalTexture);
            }
            break;
            
        case MeshWarpingState::ShowSegmentedImage :
            if( segmentedTexture ) {
                meshWarpRetargetter->drawMesh(segmentedTexture);
            }
            break;
            
        case MeshWarpingState::ShowSaliencyMap :
            if( saliencyTexture ) {
                meshWarpRetargetter->drawMesh(saliencyTexture);
            }
            break;
          
        case MeshWarpingState::ShowMesh :
            if( originalTexture ) {
                meshWarpRetargetter->drawMesh(originalTexture);
            }
            break;
            
        case MeshWarpingState::ShowPatchCenterEdge :
            if( saliencyTexture ) {
                meshWarpRetargetter->drawEdges(saliencyTexture);
            }
            break;
          
        case MeshWarpingState::ShowMeshWarping :
            if( originalTexture ) {
                meshWarpRetargetter->drawMesh(originalTexture);
            }
            break;
            
        default:
            break;
    }
    meshWarpingParams->draw();
}
Esempio n. 23
0
void BasicReceiverApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
    
    gl::enableAlphaBlending();
    
	Rectf			rect( 16, 250, 236, 320 );
	FeatureDataRef	feature;
	for( size_t k=0; k < mAvailableFeatures.size(); k++ )
	{
		feature = mXtract->getFeatureData( mAvailableFeatures[k] );
		ciXtractReceiver::drawData( feature, rect );
		rect.offset( Vec2f( 0, rect.getHeight() + 15 ) );
	}

    mParams->draw();
}
void OpenNI2xCinderBlockSample::draw()
{
	gl::clear();

	for(int i=0; i<m_OpenNI2xBlock.getDevicesInitialized(); i++)
	{
		if(m_OpenNI2xBlock.isDeviceActive(i))
		{
			m_OpenNI2xBlock.updateDevice(i);
			m_OpenNI2xBlock.debugDraw(i);
		}
	}

	gl::drawString( "fps: " + toString(getAverageFps()), Vec2f( getWindowWidth()-130.0f, 10.0f ), Color(1.0f,0.0f,0.0f), Font("Arial", 20));

	// Draw the interface
	m_Params->draw();
}
Esempio n. 25
0
void GeoDeVisualizerApp::draw()
{
    // clear screen
    gl::clear(Color(0.0f,0.0f,0.0f));
    gl::enableDepthRead();
    gl::enableDepthWrite();
    
    // draw parameter window
    mParams->draw();
    
    // draw mesh
    glLineWidth(0.5);
    gl::pushModelView();
    gl::enableWireframe();
    gl::draw(mFrame);
    gl::disableWireframe();
    gl::draw(mTriangles);
    gl::popModelView();
}
Esempio n. 26
0
void FiretrailApp::draw()
{
    const gl::ScopedViewport scopedVPort(vec2(0,0), getWindowSize());
    const gl::ScopedMatrices scopedMatrices;
    gl::setMatrices( mCamera );
    
	gl::clear();
    gl::color(Color::white());

    gl::ScopedBlendAdditive scopedBlend;
    gl::ScopedTextureBind texFire( mFireTex, 0);
    gl::ScopedTextureBind noiseFire( mNoiseTex, 1);
    
    mGlsl->uniform("time", (float)getElapsedSeconds() * mTimeFactor);
    
    mBatch->draw();
    
    mParams->draw();
}
Esempio n. 27
0
void SpiderWebApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
	gl::enableAlphaBlending();
	
//	gl::enable( GL_LINE_SMOOTH );
//	gl::enable (GL_BLEND);
//	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//	glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
	

	
	
//	gl::setMatrices( mCam );
	{
		gl::ScopedColor color;
		gl::color(1, 1, 1, 0.5);
		gl::draw( mTreesBg, getWindowBounds() );
//		mWeb->draw();
	}
	
	// Notice that this vao holds the buffers we've just
	// written to with Transform Feedback. It will show
	// the most recent positions
	gl::ScopedVao scopeVao( mVaos[mIterationIndex & 1] );
	gl::ScopedGlslProg scopeGlsl( mRenderGlsl );
//	gl::setMatrices( mCam );
	gl::setDefaultShaderVars();
	
	gl::ScopedColor color( Color::white() );
	
	
	// draw points
//	gl::pointSize( 3.0f);
//	gl::drawArrays( GL_POINTS, 0, MAX_POINTS );
	
	// draw lines
	gl::ScopedBuffer scopeBuffer( mLineIndices );
	gl::drawElements( GL_LINES, mConnectionCount * 2, GL_UNSIGNED_INT, nullptr );
	
	mParams->draw();
}
Esempio n. 28
0
void ciApp::draw()
{
	auto viewport = getWindowBounds();
	gl::clear();

	{
		auto rect = Rectf(fbo->getBounds()).getCenteredFit(viewport, false);
		gl::draw(fbo->getColorTexture(), rect);
	}

	if (is_debug_visible)
	{
		params->draw();

		const gl::ScopedColor scpColor(Color::white());
		auto tex = getInfoTexture(getAverageFps(), time_step, elapsed_time, time_value);
		ivec2 pos(20, getWindowHeight() - tex->getHeight() - 20);
		gl::draw(tex, pos);
	}
}
Esempio n. 29
0
void TweakBarApp::draw()
{
	// this pair of lines is the standard way to clear the screen in OpenGL
	gl::enableDepthRead();
	gl::enableDepthWrite();
	gl::clear( Color::gray( 0.1f ) );

/*	glLoadIdentity();
	glEnable( GL_LIGHTING );
	glEnable( GL_LIGHT0 );	
	GLfloat lightPosition[] = { -mLightDirection.x, -mLightDirection.y, -mLightDirection.z, 0 };
	glLightfv( GL_LIGHT0, GL_POSITION, lightPosition );
	glMaterialfv( GL_FRONT, GL_DIFFUSE,	mColor );*/

	gl::setMatrices( mCam );
	gl::rotate( mObjOrientation );
	gl::color( mColor );
	gl::drawCube( vec3( 0 ), vec3( mObjSize ) );

	// Draw the interface
	mParams->draw();
}
Esempio n. 30
0
void TessellationShaderApp::draw()
{
	gl::clear();
#if ! defined( CINDER_GL_ES )
	gl::enableWireframe();
#endif
	
	gl::setMatricesWindow( getWindowSize() );
	gl::translate( getWindowCenter() );
	
	gl::ScopedGlslProg glslProg( mGlsl );
	mGlsl->uniform( "uTessLevelInner", (float)mTessLevelInner );
	mGlsl->uniform( "uTessLevelOuter", (float)mTessLevelOuter );
	mGlsl->uniform( "uRadius", mRadius );	
	
	mBatch->draw();

#if ! defined( CINDER_GL_ES )
	gl::disableWireframe();
	mParams->draw();
#endif
}