MCPcopy Create free account
hub / github.com/cinder/Cinder / draw

Method draw

test/iosAppTest/src/iosAppTestApp.cpp:375–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375void iosAppTestApp::draw()
376{
377 gl::enableAlphaBlending();
378 gl::enableDepthRead();
379 sOrderTester.setState( TestCallbackOrder::DRAW );
380 CameraPersp mCam;
381 mCam.lookAt( vec3( 3, 2, -3 ), vec3( 0 ) );
382 mCam.setPerspective( 60, getWindowAspectRatio(), 1, 1000 );
383
384 if( getDisplay() == Display::getMainDisplay() )
385 gl::clear( Color( 1.2f, 0.2f, 0.3f ) );
386 else
387 gl::clear( Color( 0.4f, 0.2f, 0.2f ) );
388
389 gl::color( Color::white() );
390
391 gl::bindStockShader( gl::ShaderDef().color().texture() );
392 mTex->bind();
393
394 gl::setMatrices( mCam );
395 {
396 gl::ScopedModelMatrix modelScope;
397 gl::multModelMatrix( mCubeRotation );
398 gl::drawCube( vec3( 0 ), vec3( 2 ) );
399 }
400
401 gl::setMatricesWindow( getWindowSize() );
402 for( map<uint32_t,TouchPoint>::const_iterator activeIt = mActivePoints.begin(); activeIt != mActivePoints.end(); ++activeIt ) {
403 activeIt->second.draw();
404 }
405
406 for( list<TouchPoint>::iterator dyingIt = mDyingPoints.begin(); dyingIt != mDyingPoints.end(); ) {
407 dyingIt->draw();
408 if( dyingIt->isDead() )
409 dyingIt = mDyingPoints.erase( dyingIt );
410 else
411 ++dyingIt;
412 }
413
414 // draw yellow circles at the active touch points
415 gl::color( Color( 1, 1, 0 ) );
416 for( auto touch : getActiveTouches() )
417 gl::drawStrokedCircle( touch.getPos(), 20.0f );
418
419 if( getWindow() == mSecondWindow || Display::getDisplays().size() < 2 ) {
420 static Font font = Font( "Arial", 48 );
421 static std::string lastMessage;
422 static gl::TextureRef messageTex;
423 if( lastMessage != mSecondWindowMessage ) {
424 TextBox box = TextBox().font( font ).text( mSecondWindowMessage );
425 messageTex = gl::Texture::create( box.render() );
426 lastMessage = mSecondWindowMessage;
427 }
428 if( messageTex ) {
429 gl::color( Color::white() );
430 gl::draw( messageTex, ivec2( ( getWindowWidth() - messageTex->getWidth() ) / 2, getWindowCenter().y ) );
431 }
432 }

Callers

nothing calls this directly

Calls 15

enableAlphaBlendingFunction · 0.85
enableDepthReadFunction · 0.85
getWindowAspectRatioFunction · 0.85
whiteFunction · 0.85
bindStockShaderFunction · 0.85
setMatricesFunction · 0.85
multModelMatrixFunction · 0.85
drawCubeFunction · 0.85
setMatricesWindowFunction · 0.85
drawStrokedCircleFunction · 0.85
TextBoxFunction · 0.85
getWindowWidthFunction · 0.85

Tested by

no test coverage detected