Skip to content

Instantly share code, notes, and snippets.

@tgfrerer
Created October 2, 2014 16:08
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 tgfrerer/bce463cfa2213b7bf23f to your computer and use it in GitHub Desktop.
Save tgfrerer/bce463cfa2213b7bf23f to your computer and use it in GitHub Desktop.
opengl optimisations testcase
#include "ofMain.h"
class ofApp : public ofBaseApp{
ofVboMesh mMshSphere;
ofCamera mCam1;
public:
void setup(){
ofSetFrameRate(0);
ofSetVerticalSync(true);
mCam1.setupPerspective(false, 60, 0.5, 2000);
mCam1.setPosition(0,0, 600);
mCam1.lookAt(ofVec3f(0),ofVec3f(0,1,0));
mMshSphere = ofSpherePrimitive(300,12).getMesh();
};
void draw(){
ofBackground(ofColor::black);
mCam1.begin();
ofRotate(ofGetFrameNum() % 360, 0, 1, 0);
for (int i =0; i< 360; i+=5){
ofPushMatrix();
ofRotate( i, 1, 0, 0);
ofSetColor(ofColor::white);
mMshSphere.drawWireframe();
ofPopMatrix();
}
mCam1.end();
};
};
//========================================================================
int main( ){
ofSetOpenGLVersion(4,1);
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment