Skip to content

Instantly share code, notes, and snippets.

@mruegenberg
Created May 18, 2016 09:58
Show Gist options
  • Save mruegenberg/24a895b70c6f4e1168f2bc44392bb2b7 to your computer and use it in GitHub Desktop.
Save mruegenberg/24a895b70c6f4e1168f2bc44392bb2b7 to your computer and use it in GitHub Desktop.
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
gl->background(255,255,255);
camera.setEvents(window->events());
camera.setRenderer(gl);
gui->radius.addListener(this,&ofApp::radiusChanged);
gui->radius=200;
fbo1.allocate(100,100);
}
void ofApp::radiusChanged(float & radius){
sphere.set(radius,radius*0.08);
}
//--------------------------------------------------------------
void ofApp::update(){
gl->begin(fbo1, false);
gl->clear();
gl->setFillMode(OF_FILLED);
gl->setColor(255,0,0);
gl->drawRectangle(0,0,0,100,100);
gl->end(fbo1);
}
//--------------------------------------------------------------
void ofApp::draw(){
gl->bind(camera,gl->getCurrentViewport());
gl->setColor(gui->color);
gl->draw(sphere,OF_MESH_WIREFRAME);
gl->setColor(gui->color,gui->color->a*0.1);
gl->draw(sphere,OF_MESH_FILL);
gl->unbind(camera);
gl->setColor(0);
gl->drawString(ofToString(window->events().getFrameRate()),20,20,0);
gl->draw(fbo1.getTexture(), 0,0,0,100,100,0,0,100,100);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment