Skip to content

Commit

Permalink
Merge pull request #3 from smallfly/feature-programmable_renderer
Browse files Browse the repository at this point in the history
Support for programmable renderer
  • Loading branch information
musiko committed Dec 4, 2015
2 parents 5882d59 + 534b24c commit d9a96d8
Show file tree
Hide file tree
Showing 7 changed files with 579 additions and 47 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# don't push project files
*.cbp
*.sln
*.vcx*
*.workspace*
config.make
Makefile
*.xcodeproj
*.plist
*.xcconfig
*.suo

*.depend
*.layout
*.mode*v3
*.pbxuser
*.app*
*.DS_*
*.xcworkspacedata
xcuserdata/
project.xcworkspace

*.opensdf
*.sdf
*.suo
*.ipch

.svn/
obj/
bin/
build/
!data/
13 changes: 6 additions & 7 deletions example-with-ofxGui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

//========================================================================
int main( ){
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());

ofGLWindowSettings settings;
settings.setGLVersion(3, 2); // Using programmable renderer. Comment out this line to use the 'standard' GL renderer.
settings.width = 1024;
settings.height = 768;
ofCreateWindow(settings);
ofRunApp(new ofApp());
}
30 changes: 22 additions & 8 deletions example-with-ofxGui/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,28 @@ void ofApp::drawDebugMasks() {

//--------------------------------------------------------------
void ofApp::drawCheckerboard(float x, float y, int width, int height, int size) {
int numWidth = width/size;
int numHeight = height/size;
for(int h=0; h<numHeight; h++) {
for(int w=0; w<numWidth; w++) {
((h+w)%2 == 0) ? ofSetColor(0, 255) : ofSetColor(255, 255);
ofRect(x + w*size, y + h*size, size, size);
}
}
if (!checkerboardTex.isAllocated()) {
checkerboardTex.allocate(width, height);

ofPushStyle();
checkerboardTex.begin();
ofClear(255, 255, 255, 255);
int numWidth = width/size;
int numHeight = height/size;
for(int h=0; h<numHeight; h++) {
for(int w=0; w<numWidth; w++) {
if ((h+w)%2 == 0) {
ofSetColor(ofColor::black);
ofDrawRectangle(w*size, h*size, size, size);
}
}
}
checkerboardTex.end();
ofPopStyle();
}

ofSetColor(255, 255);
checkerboardTex.draw(x, y);
}

//--------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions example-with-ofxGui/src/ofApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ofApp : public ofBaseApp{
ofxChromaKeyShader *chromakey;
ofVideoGrabber webcam;
int camW, camH;

ofFbo checkerboardTex;

ofxPanel chromaGui;
bool bShowGui;
Expand Down
Loading

0 comments on commit d9a96d8

Please sign in to comment.