#include "viewport.h" //make viewport oversample viewport::viewport() { //ctor } 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,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); } void viewport::drawport(vpcontrol &control){ rb1.begin(); //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); for (int i=startx;iw){ 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(); rb2.begin(); ofSetColor(255,255,255); rb1.draw(0,0); rb2.end(); } void viewport::draw(uint8_t b,float s){ ofSetColor(b,b,b); rb2.draw(ox*s,oy*s,w*s,h*s); } viewport::~viewport() { //dtor }