diff options
Diffstat (limited to 'src/testApp.cpp')
| -rw-r--r-- | src/testApp.cpp | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp index 6091759..629ffce 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -84,30 +84,39 @@ void testApp::setup(){ } - //bgimg.allocate(256,256,OF_IMAGE_COLOR); - // - /* + bgimg.allocate(256,256,OF_IMAGE_COLOR); + + cols=new ofColor[4]; - cols[0]=ofColor(80,80,80); + cols[0]=ofColor(80,80,120); cols[1]=ofColor(80,80,80); cols[2]=ofColor(0,0,0); cols[3]=ofColor(0,0,0); - float fi,fj,ifi,ifj; - float si=1.0f/bgimg.width; - float sj=1.0f/bgimg.height; - for (int i=0,fi=0.0f,ifi=1.0f;i<bgimg.width;i++,fi+=si,ifi-=si){ - for (int j=0,fj=0.0f,ifj=1.0f;j<bgimg.width;j++,fj+=sj,ifj-=sj){ - bgimg.getPixels()[(j*bgimg.width+i)*3]=(unsigned char)((ifj*((ifi*cols[0].r)+(fi*cols[1].r)))+(fj*((ifi*cols[2].r)+(fi*cols[3].r)))); - bgimg.getPixels()[(j*bgimg.width+i)*3+1]=(unsigned char)((ifj*((ifi*cols[0].g)+(fi*cols[1].g)))+(fj*((ifi*cols[2].g)+(fi*cols[3].g)))); - bgimg.getPixels()[(j*bgimg.width+i)*3+2]=(unsigned char)((ifj*((ifi*cols[0].b)+(fi*cols[1].b)))+(fj*((ifi*cols[2].b)+(fi*cols[3].b)))); - } + float fi,fj,ifi,ifj; + fi=0.0f; + ifi=1.0f; + float si=1.0f/bgimg.width; + float sj=1.0f/bgimg.height; + unsigned char* px=bgimg.getPixels(); + for (int i=0;i<bgimg.width;i++,fi+=si,ifi-=si){ + fj=0.0f; + ifj=1.0f; + for (int j=0;j<bgimg.height;j++,fj+=sj,ifj-=sj){ + px[(j*bgimg.width+i)*3]=(unsigned char)((ifj*((ifi*cols[0].r)+(fi*cols[1].r)))+(fj*((ifi*cols[2].r)+(fi*cols[3].r)))); + px[(j*bgimg.width+i)*3+1]=(unsigned char)((ifj*((ifi*cols[0].g)+(fi*cols[1].g)))+(fj*((ifi*cols[2].g)+(fi*cols[3].g)))); + px[(j*bgimg.width+i)*3+2]=(unsigned char)((ifj*((ifi*cols[0].b)+(fi*cols[1].b)))+(fj*((ifi*cols[2].b)+(fi*cols[3].b)))); + } } - */ - bgimg.loadImage("TextureTrapdoor.jpg"); + + bgimg.setUseTexture(true); bgimg.update(); - + + icons=new ofImage[3]; + icons[0].loadImage("Phone.png"); + icons[1].loadImage("iPhone.png"); + icons[2].loadImage("Tablet.png"); } @@ -122,7 +131,7 @@ void testApp::update(){ void testApp::draw(){ glDisable(GL_LIGHTING); - bgimg.draw(0,0,256,256); //windowWidth,windowHeight); + bgimg.draw(0,0,windowWidth,windowHeight); camera.begin(); @@ -139,8 +148,10 @@ void testApp::draw(){ float rt=((ofGetElapsedTimef()*.25f)-floor(ofGetElapsedTimef()*.25f)); for (float f=rt*(windowWidth/10);f<windowWidth*0.9;f+=windowWidth/10) { float rf=sin((f/(windowWidth*0.9))*TWO_PI); - ofSetColor(0x7f*rf,0x7f*rf,0xff*rf); + ofSetColor(0x7f*rf,0x7f*rf,0xff*rf,0xff*rf); + ofEnableAlphaBlending(); ofCircle(0,0,0,f); + ofDisableAlphaBlending(); } |
