diff options
Diffstat (limited to 'src/viewport.cpp')
| -rwxr-xr-x | src/viewport.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 875b439..c660ede 100755 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1,18 +1,21 @@ #include "viewport.h"
+//make viewport oversample
+
viewport::viewport()
{
//ctor
}
-viewport::viewport(int _w,int _h,int _ox,int _oy) {
- setup(_w,_h,_ox,_oy);
+viewport::viewport(int _w,int _h,int _ox,int _oy,int _num) {
+ setup(_w,_h,_ox,_oy,_num);
}
-void viewport::setup(int _w,int _h,int _ox,int _oy) {
+void viewport::setup(int _w,int _h,int _ox,int _oy,int _num) {
w=_w;
h=_h;
ox=_ox;
oy=_oy;
+ num=_num;
rb1.allocate(w,h,GL_RGB);
rb2.allocate(w,h,GL_RGB);
seed=ofRandom(1.0f);
@@ -37,11 +40,38 @@ void viewport::drawport(vpcontrol &control){ //do whatever with feedback
- if (control.fillgrey){
- uint8_t f=(uint8_t)((sin((ofGetElapsedTimef()*control.fillgreyfreq)/seed)+1.0f)*127.50f);
+ //set draw colour from palette
+
+ if (Palette.isLoaded()){
+ ofSetColor(Palette.getBlend((ofGetElapsedTimef()*control.freq*0.0318)/seed));
+ }
+ else {
+ uint8_t f=(uint8_t)((sin((ofGetElapsedTimef()*control.freq)/seed)+1.0f)*127.50f);
ofSetColor(f,f,f);
+ }
+
+ if (control.fill){
ofRect(0,0,w,h);
}
+
+ ofSetLineWidth(3); //control.thickness);
+
+ if(control.wave){
+ if (h>w){
+ ofBeginShape();
+ for (int i = 0; i < h; i++){
+ ofVertex((w/2) -(control.right[i+(num*h)]*w),i);
+ }
+ ofEndShape(false);
+ }
+ else {
+ ofBeginShape();
+ for (int i = 0; i < w; i++){
+ ofVertex(i, (h/2) -(control.right[i+(num*w)]*h) );
+ }
+ ofEndShape(false);
+ }
+ }
rb1.end();
@@ -52,10 +82,10 @@ void viewport::drawport(vpcontrol &control){ rb2.end();
}
-void viewport::draw(uint8_t b){
+void viewport::draw(uint8_t b,float s){
ofSetColor(b,b,b);
- rb2.draw(ox,oy);
+ rb2.draw(ox*s,oy*s,w*s,h*s);
}
|
