Skip to content

Instantly share code, notes, and snippets.

@lewkoo
Created February 27, 2014 03:18
Show Gist options
  • Save lewkoo/9243736 to your computer and use it in GitHub Desktop.
Save lewkoo/9243736 to your computer and use it in GitHub Desktop.
ofApp.cpp of a very simple Android shader example code
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetLogLevel(OF_LOG_VERBOSE);
ofBackground(34, 34, 34);
ofSetVerticalSync(false);
ofEnableAlphaBlending();
#ifdef TARGET_ANDROID
shader.load("shadersES2/shader");
#else
if(ofIsGLProgrammableRenderer()){
shader.load("shadersGL3/shader");
}else{
shader.load("shadersGL2/shader");
}
#endif
}
//--------------------------------------------------------------
void ofApp::update(){
//
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(255);
shader.begin();
ofRect(0, 0, ofGetWidth(), ofGetHeight());
shader.end();
//draw fps
string msg = "\n\nfps: " + ofToString(ofGetFrameRate(), 2);
ofDrawBitmapStringHighlight(msg, 10, 20);
}
//--------------------------------------------------------------
void ofApp::keyPressed (int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::touchDown(int x, int y, int id){
}
//--------------------------------------------------------------
void ofApp::touchMoved(int x, int y, int id){
}
//--------------------------------------------------------------
void ofApp::touchUp(int x, int y, int id){
}
//--------------------------------------------------------------
void ofApp::touchDoubleTap(int x, int y, int id){
}
//--------------------------------------------------------------
void ofApp::touchCancelled(int x, int y, int id){
}
//--------------------------------------------------------------
void ofApp::swipe(ofxAndroidSwipeDir swipeDir, int id){
}
//--------------------------------------------------------------
void ofApp::pause(){
}
//--------------------------------------------------------------
void ofApp::stop(){
}
//--------------------------------------------------------------
void ofApp::resume(){
}
//--------------------------------------------------------------
void ofApp::reloadTextures(){
}
//--------------------------------------------------------------
bool ofApp::backPressed(){
return false;
}
//--------------------------------------------------------------
void ofApp::okPressed(){
};
//--------------------------------------------------------------
void ofApp::cancelPressed(){
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment