void QuickTimePlayer::draw() { gl::clear( Color( 0, 0, 0 ) ); gl::enableAlphaBlending(); if( mFrameTexture ) { Rectf centeredRect = Rectf( mFrameTexture.getBounds() ).getCenteredFit( getWindowBounds(), true ); gl::draw( mFrameTexture, centeredRect ); if (bInitialized) { spoutsender.SendTexture(mFrameTexture.getId(), mFrameTexture.getTarget(), g_Width, g_Height, false); } } if( mInfoTexture ) { glDisable( GL_TEXTURE_RECTANGLE_ARB ); gl::draw( mInfoTexture, Vec2f( 20, getWindowHeight() - 20 - mInfoTexture.getHeight() ) ); } }
void FadeCandyClientApp::draw() { unsigned int width, height; char txt[256]; // clear out the window with black gl::clear( Color( 0, 0, 0 ) ); gl::setViewport( getWindowBounds() ); gl::color( Color(1,1,1) ); gl::setMatrices( mMayaCam.getCamera() ); effectRunner->draw(); //draw debug info gl::setMatricesWindow( getWindowSize() ); Font mDefault; #if defined( CINDER_COCOA ) mDefault = Font( "Helvetica", 16 ); #elif defined( CINDER_MSW ) mDefault = Font( "Arial", 16 ); #endif gl::enableAlphaBlending(); gl::drawStringCentered(effectRunner->getDebugString(),Vec2f(getWindowCenter().x,5),Color(1,1,1),mDefault); gl::disableAlphaBlending(); // Save current global width and height - they will be changed // by receivetexture if the sender changes dimensions width = g_Width; height = g_Height; // // Try to receive the texture at the current size // // NOTE : // if the host calls SendTexture with a framebuffer object actively bound // the host must provide the GL handle to its EXT_framebuffer_object // so that the dll can restore that binding because it makes use of its // own FBO for intermediate rendering - default is 0 for no bound host FBO - see Spout.h // if(bInitialized && spoutTexture) { if(!ReceiveTexture(SenderName, spoutTexture.getId(), spoutTexture.getTarget(), width, height)) { // // Receiver failure : // 1) width and height are zero for read failure. // 2) width and height are changed for sender change // The local texture then has to be resized. // if(width == 0 || height == 0) { // width and height are returned zero if there has been // a texture read failure which might happen if the sender // is closed. Spout will keep trying and if the same sender opens again // will use it. Otherwise the user can select another sender. return; } if(width != g_Width || height != g_Height ) { // The sender dimensions have changed // Update the global width and height g_Width = width; g_Height = height; // Update the local texture to receive the new dimensions spoutTexture = gl::Texture(g_Width, g_Height); return; // quit for next round } } else { spoutSurf = Surface(spoutTexture); e->mSurf = spoutSurf; } } }