void doTrails(Player *p) { static QuadBuffer *q = NULL; int size; int *index; if(q == NULL) { size = getTrailCount() + 12; printf("allocating QuadBuffer, size %d\n", size); q = createQuadBuffer(size); } else { size = getTrailCount() + 12; if(size > q->size) { printf("reallocating QuadBuffer, size %d\n", size); freeQuadBuffer(q); /* we don't want to reallocate immediately, no make it a bit larger */ q = createQuadBuffer(size + 36); } } q->current = 0; clearState(); if(game2->settingsCache.alpha_trails) { /* depth sort everything */ int i; for(i = 0; i < game->players; i++) { bufferPlayerTrail(game->player + i, q); bufferPlayerBow(game->player + i, q); } index = getSortedQuads(q, p->camera->cam); glEnable(GL_BLEND); drawTrails(q, index); glDisable(GL_BLEND); if(index != NULL) free(index); } else { /* draw non-transparent trails first (unsorted), then draw bows */ int i; /* flat shaded, no blending */ for(i = 0; i < game->players; i++) { bufferPlayerTrail(game->player + i, q); } drawTrails(q, NULL); for(i = 0; i < game->players; i++) { bufferPlayerBow(game->player + i, q); } /* bows are transparent, so sort back-to-front */ index = getSortedQuads(q, p->camera->cam); glEnable(GL_BLEND); drawTrails(q, index); glDisable(GL_BLEND); if(index != NULL) free(index); } /* printf("%d texture bounds\n", state->binds); printf("%d texture mod changes\n", state->mod_changes); */ }
void DrawTouchView::drawLocalClient(){ if(mTouchTrailsUse) { drawTrails(); } else { Sprite::drawLocalClient(); } }
void NoisePixelFactory::draw(){ ofPushStyle(); ofSetColor(fgColor.x, fgColor.y, fgColor.z); texColour.draw(0,0,settings.OUTPUT_CROP_W,settings.OUTPUT_CROP_H); ofPopStyle(); drawTrails(); }
//-------------------------------------------------------------- void ofApplication::update(){ float elapsedTime = ofGetElapsedTimef(); audioLowEnergy = ofMap(audioAnalyzer.getSignalEnergyInRegion(AA_FREQ_REGION_LOW)*audioSensitivity, 0.25f, 3.0f, 0.0f, 1.0f, true); audioMidEnergy = audioAnalyzer.getSignalEnergyInRegion(AA_FREQ_REGION_MID)*audioSensitivity; audioHiPSF = ofMap(audioAnalyzer.getPSFinRegion(AA_FREQ_REGION_HIGH)*audioSensitivity, 0.3f, 4.0f, 0.0f, 1.0f, true); elapsedPhase = 2.0*M_PI*elapsedTime; processOscMessages(); #ifdef USE_KINECT kinectOpenNI.update(); handPhysics->update(); if(bDrawUserOutline) updateUserOutline(); #endif // don't draw if frame freeze is turned on bool shouldDrawNew = true; if (strobeIntervalMs > 1000.0f/60.0f){ shouldDrawNew = (elapsedTime - strobeLastDrawTime >= strobeIntervalMs/1000.0f); if (shouldDrawNew){ strobeLastDrawTime = elapsedTime; } } // draw to FBOs glDisable(GL_DEPTH_TEST); beginTrails(); if (shouldDrawNew){ if (bDrawUserOutline && bTrailUserOutline) drawUserOutline(); if (bDrawHands && bTrailHands) drawHandSprites(); if (bDrawPoi && bTrailPoi) drawPoiSprites(); drawTouches(); } endTrails(); mainFbo.begin(); ofClear(0,0,0,0); if (bDrawUserOutline && !bTrailUserOutline && shouldDrawNew) drawUserOutline(); drawTrails(); if (shouldDrawNew){ if (bDrawHands && !bTrailHands) drawHandSprites(); if (bDrawPoi && !bTrailPoi) drawPoiSprites(); } mainFbo.end(); }
void ImagePixelFactory::draw(){ if(inited){ ofPushStyle(); ofFill(); ofSetColor(255, 255, 255); images[imageIndexToUse].draw(0, 0, settings.OUTPUT_CROP_W, settings.OUTPUT_CROP_H); ofPopStyle(); drawTrails(); } }
void SinglePanelImagePixelFactory::draw(){ if(inited){ ofPushStyle(); ofFill(); ofSetColor(255, 255, 255); for(int i = 0; i<5; i++){ int indexThisTime = getPanelIndex(); images[indexThisTime].draw(i*192, 0, 192, 64); } ofPopStyle(); drawTrails(); } }
void StringPixelFactory::draw(){ ofPushStyle(); bool bActive = panel.getValueB("VIS_COLORED_BACKGROUND"); bool bInvert = panel.getValueB("VIS_INVERT"); bool bTrails = panel.getValueB("VIS_TRAILS"); if (bActive){ if (bInvert) { ofSetColor(fgColor.x, fgColor.y, fgColor.z, bTrails ? 100 : 255); } else { ofSetColor(bgColor.x, bgColor.y, bgColor.z, bTrails ? 100 : 255); } ofRect(0,0,settings.OUTPUT_CROP_W, settings.OUTPUT_CROP_H); } glPushMatrix(); ofSetColor(0xffffff); if (bInvert) { ofSetColor(bgColor.x, bgColor.y, bgColor.z, bTrails ? 190 : 255); } else { ofSetColor(fgColor.x, fgColor.y, fgColor.z, bTrails ? 190 : 255); } ofFill(); ofBeginShape(); ofVertex(particles[0].pos.x, particles[0].pos.y); for (int i = 0; i < particles.size(); i++){ //particles[i].draw(); ofCurveVertex(particles[i].pos.x, particles[i].pos.y); } ofCurveVertex(particles[particles.size()-1].pos.x, particles[particles.size()-1].pos.y); ofEndShape(true); glPopMatrix(); ofPopStyle(); drawTrails(); }
void SlitStretchFactory::draw(){ if(inited){ ofPushStyle(); ofFill(); ofSetColor(255, 255, 255); bool vertical = panel.getValueB("SLIT_VERTICAL"); if(vertical){ //make vertical bars, so take a horizontal strip out of the image textureToStretchVertically.draw(0,0, settings.OUTPUT_CROP_W, settings.OUTPUT_CROP_H); }else{ //make horizontal bars, so take a vertical strip out of the image textureToStretchHorizontally.draw(0,0, settings.OUTPUT_CROP_W, settings.OUTPUT_CROP_H); } ofPopStyle(); drawTrails(); } }
void BlockPixelFactory::draw(){ numDivisions = panel.getValueF("VIS_DIV"); filled = panel.getValueB("VIS_FILLED"); xSpacing = tWidth / ((float)SCREEN_HORIZ_RATIO * numDivisions); ySpacing = tHeight / ((float)SCREEN_VERT_RATIO * numDivisions); ofPushStyle(); //draw bg ofFill(); ofSetColor(bgColor.x, // red bgColor.y, // green bgColor.z); // blue ofRect(0,0,settings.OUTPUT_CROP_W,settings.OUTPUT_CROP_H); ofSetColor(fgColor.x, // red fgColor.y, // green fgColor.z); // blue if(filled) ofFill(); else ofNoFill(); for(int i = 0; i < (numDivisions * SCREEN_HORIZ_RATIO); i++){ for(int j = 0; j < (numDivisions * SCREEN_VERT_RATIO); j++){ if(ofRandom(0.0, 1.0) < level){ ofRect((i+0.5)*xSpacing-size/2, (j+0.5)*ySpacing-size/2, size, size); } } } ofPopStyle(); drawTrails(); }