Skip to content

Instantly share code, notes, and snippets.

@cwhitney
Created November 20, 2012 19:54
Show Gist options
  • Save cwhitney/4120600 to your computer and use it in GitHub Desktop.
Save cwhitney/4120600 to your computer and use it in GitHub Desktop.
gl::setMatricesWindow( mFbo.getSize(), false );
gl::pushMatrices();
mFbo.bindFramebuffer();{
gl::clear( Color(0,0,0) );
gl::draw( mFace );
}mFbo.unbindFramebuffer();
gl::popMatrices();
gl::setMatricesWindow( getWindowSize(), true );
@studioijeoma
Copy link

void KaiserRefreshApp::drawMenuLeft() {
gl::setMatricesWindow( menuFbo1.getSize(), false );
gl::pushMatrices();

menuFbo1.bindFramebuffer(); 
gl::clear( ColorA( 1.0f, 1.0f, 1.0f, 0.0f ) ); 

gl::pushMatrices();
gl::translate( getWindowCenter() );   
gl::rotate(Vec3f(-30,0,0));
gl::rotate( mArcball.getQuat() ); 

float degs = 360.0/menuItemCount;
float rads = (M_PI*2.0f)/menuItemCount;

for(int i = 0; i < menuItemCount; i++) {
    float x = sin(rads*i) * menuLineSize;
    float y = 0;
    float z = cos(rads*i) * menuLineSize; 

    Vec2f textSize = menuFont->measureString(menuItemLabels[i]);

    Matrix44f menuItemMatrix;
    menuItemMatrix.rotate(Vec3f(0,rads*i+rads/2,0));
    menuItemMatrix.translate(Vec3f(menuLineSize,menuTextSize/4,0));
    menuItemMatrix.rotate(Vec3f(0,M_PI,0)); 
    menuItemMatrix.translate(Vec3f(-textSize.x,0,0));

    gl::pushModelView(); 
    gl::multModelView( menuItemMatrix );
    gl::color(Color(1.0f,1.0f,1.0f)); 
    menuFont->drawString(menuItemLabels[i],Vec2f::zero()); 
    gl::popModelView(); 

    gl::color(Color(1.0f,1.0f,1.0f)); 
    glLineWidth(menuLineWidth);
    gl::drawLine(Vec3f::zero(),Vec3f(x,y,z));
}

gl::color(Color(1.0f,1.0f,1.0f)); 
gl::drawSphere(Vec3f::zero(),menuSphereSize,50);
gl::popMatrices();

menuFbo1.unbindFramebuffer();  

gl::popMatrices();
gl::setMatricesWindow( getWindowSize(), true );

menuFbo1.getTexture().enableAndBind(); 
gl::enable(GL_SCISSOR_TEST);
glScissor( 0,0,menuFbo1.getWidth(),menuFbo1.getHeight() );
gl::drawSolidRect( Rectf(0,0,menuFbo1.getWidth(),menuFbo1.getHeight()) );
gl::disable(GL_SCISSOR_TEST);
menuFbo1.unbindTexture(); 

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment