Skip to content

Instantly share code, notes, and snippets.

@lewkoo
Created February 27, 2014 03:19
Show Gist options
  • Save lewkoo/9243747 to your computer and use it in GitHub Desktop.
Save lewkoo/9243747 to your computer and use it in GitHub Desktop.
main.cpp of a very simple Android shader example
#include "ofMain.h"
#include "ofApp.h"
// comment out the line below if you want to use a fixed pipeline opengl renderer,
// otherwise leave this line uncommented if you want to use a programmable pipeline opengl renderer.
#define USE_PROGRAMMABLE_RENDERER
#ifdef USE_PROGRAMMABLE_RENDERER
#include "ofGLProgrammableRenderer.h"
#endif
//========================================================================
int main( ){
#ifdef USE_PROGRAMMABLE_RENDERER
ofSetCurrentRenderer(ofGLProgrammableRenderer::TYPE);
#endif
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());
}
#ifdef TARGET_ANDROID
#include <jni.h>
//========================================================================
extern "C"{
void Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jobject thiz ){
main();
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment