diff options
Diffstat (limited to 'src/viewport.cpp')
| -rwxr-xr-x | src/viewport.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index c660ede..5a246e0 100755 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -13,11 +13,13 @@ viewport::viewport(int _w,int _h,int _ox,int _oy,int _num) { void viewport::setup(int _w,int _h,int _ox,int _oy,int _num) {
w=_w;
h=_h;
+ bw=w*oversample;
+ bh=h*oversample;
ox=_ox;
oy=_oy;
num=_num;
- rb1.allocate(w,h,GL_RGB);
- rb2.allocate(w,h,GL_RGB);
+ rb1.allocate(bw,bh,GL_RGB);
+ rb2.allocate(bw,bh,GL_RGB);
seed=ofRandom(1.0f);
}
@@ -27,17 +29,24 @@ void viewport::drawport(vpcontrol &control){ //can be done with texture offset?
- int startx=((w-(w*control.fscale))/2)+control.xshift;
- while (startx>0) startx-=(w*control.fscale);
- int starty=((h-(h*control.fscale))/2)+control.yshift;
- while (starty>0) starty-=(h*control.fscale);
+ int startx=((bw-(bw*control.fscale))/2)+control.xshift;
+ while (startx>0) startx-=(bw*control.fscale);
+ int starty=((bh-(bh*control.fscale))/2)+control.yshift;
+ while (starty>0) starty-=(bh*control.fscale);
- for (int i=startx;i<w*2;i+=(w*control.fscale)) {
- for (int j=starty;j<h*2;j+=(h*control.fscale)) {
- rb2.draw(i,j,w*control.fscale,h*control.fscale);
+ for (int i=startx;i<bw*2;i+=(bw*control.fscale)) {
+ for (int j=starty;j<bh*2;j+=(bh*control.fscale)) {
+ rb2.draw(i,j,bw*control.fscale,bh*control.fscale);
}
}
+ if (control.fade>0){
+ ofEnableAlphaBlending();
+ ofSetColor(0,0,0,control.fade);
+ ofRect(0,0,bw,bh);
+ ofDisableAlphaBlending();
+ }
+
//do whatever with feedback
//set draw colour from palette
@@ -51,7 +60,7 @@ void viewport::drawport(vpcontrol &control){ }
if (control.fill){
- ofRect(0,0,w,h);
+ ofRect(0,0,bw,bh);
}
ofSetLineWidth(3); //control.thickness);
@@ -59,15 +68,15 @@ void viewport::drawport(vpcontrol &control){ if(control.wave){
if (h>w){
ofBeginShape();
- for (int i = 0; i < h; i++){
- ofVertex((w/2) -(control.right[i+(num*h)]*w),i);
+ for (int i = 0; i < bh; i++){
+ ofVertex((bw/2) -(control.right[i+(num*bh)]*bw),i);
}
ofEndShape(false);
}
else {
ofBeginShape();
- for (int i = 0; i < w; i++){
- ofVertex(i, (h/2) -(control.right[i+(num*w)]*h) );
+ for (int i = 0; i < bw; i++){
+ ofVertex(i, (bh/2) -(control.right[i+(num*bw)]*bh) );
}
ofEndShape(false);
}
|
