Skip to content

Instantly share code, notes, and snippets.

@julapy
Created February 2, 2015 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julapy/abef5208d492fa1fd273 to your computer and use it in GitHub Desktop.
Save julapy/abef5208d492fa1fd273 to your computer and use it in GitHub Desktop.
#include "ofMain.h"
#include "ofAppiOSWindow.h"
class ofApp : public ofBaseApp{
public:
ofFbo fbo;
void setup(){
ofSetSphereResolution(3);
ofFbo::Settings settings;
settings.numSamples = 0;
settings.numColorbuffers = 3;
settings.internalformat = GL_RGBA;
settings.textureTarget = GL_TEXTURE_2D;
settings.width = 256;
settings.height = 256;
fbo.allocate(settings);
}
//--------------------------------------------------------------
void drawScene() {
glEnable(GL_MULTISAMPLE);
ofNoFill();
ofPushMatrix();
ofTranslate(128,128,0);
ofRotate(360 * (ofGetFrameNum() % 720) / 720.);
ofDrawSphere(100);
ofPopMatrix();
ofFill();
glDisable(GL_MULTISAMPLE);
}
void draw(){
fbo.begin();
ofClear(ofColor::black);
ofSetColor(ofColor::white);
drawScene();
fbo.end();
ofSetColor(ofColor::white);
fbo.getTexture(0).draw(20, 20);
}
};
int main() {
// here are the most commonly used iOS window settings.
//------------------------------------------------------
ofiOSWindowSettings settings;
settings.enableRetina = true; // enables retina resolution if the device supports it.
settings.enableDepth = true; // enables depth buffer for 3d drawing.
settings.enableAntiAliasing = true; // enables anti-aliasing which smooths out graphics on the screen.
settings.numOfAntiAliasingSamples = 4; // number of samples used for anti-aliasing.
settings.enableHardwareOrientation = false; // enables native view orientation.
settings.enableHardwareOrientationAnimation = false; // enables native orientation changes to be animated.
settings.glesVersion = OFXIOS_RENDERER_ES1; // type of renderer to use, ES1, ES2, etc.
ofCreateWindow(settings);
ofRunApp(new ofApp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment