void SingleBrush::selfSetup(){ ofSetCircleResolution(36); ofEnableAlphaBlending(); ofDisableSmoothing(); ofSetFullscreen(true); video.initGrabber(640, 480); colorAddShader.loadFrag(getDataPath()+"shaders/colorAdd.frag"); noiseShader.loadFrag(getDataPath()+"shaders/noise.frag"); absorveShader.loadFrag(getDataPath()+"shaders/absorve.frag"); displaceShader.loadFrag(getDataPath()+"shaders/displace.frag"); edge.loadFrag(getDataPath()+"shaders/edge.frag"); ofDisableArbTex(); ofLoadImage(brushTexture, getDataPath()+"brush.png"); ofEnableArbTex(); int width = ofGetScreenWidth(); int height = ofGetScreenHeight(); colorAdded.allocate(width,height); water.allocate(width, height,GL_RGB); flow.allocate(width, height); noise.allocate(width,height); canvas.allocate(width, height); edgeFbo.allocate(640, 480); bColorSample = true; color.set(0); }
//-------------------------------------------------------------- void testApp::setup(){ light.setDirectional(); ofEnableArbTex(); fbo.allocate(ofGetWidth()*2, ofGetHeight()*2); fxaa.load("v002.FXAA.vert","v002.FXAA.frag"); ofSetFrameRate(30); }
// ------------ Setup void wavesScene::setup(){ // size int w = RM->getWidth(); int h = RM->getHeight(); // setup parameters stencilWaves.setupGui(); gradientWaves.setupGui(); // setup gui setupGui(); // setup obj gradientWaves.setup(w, h); gradientWaves.screenLeft = RM->getRectForScreen(SCREEN_LEFT); stencilWaves.screenLeft = RM->getRectForScreen(SCREEN_LEFT); stencilWaves.screenRight = RM->getRectForScreen(SCREEN_RIGHT); stencilWaves.screenCenter = RM->getRectForScreen(SCREEN_CENTER); stencilWaves.setup(w, h); // who is first gradientWaves.setIn(); stencilWaves.setIn(); stencilWaves.isEnabled = false; gradientWaves.fadeIn(); // glow ofDisableArbTex(); glow.load("assets/glow.png"); ofEnableArbTex(); }
// selfSetup is called when the visual system is first instantiated // This will be called during a "loading" screen, so any big images or // geometry should be loaded here void CloudsVisualSystemFlocking::selfSetup() { debugGridSize = 4096; ps = new ofxBoidSystem(); pointSize = 5.0; redColor = 1.0; greenColor = 0.0; blueColor = 0.0; bUpdateVel = true; bUpdateAcc = true; bUpdatePos = true; resolution = 72; rows = resolution; cols = resolution; ofDisableArbTex(); ofLoadImage(glow, getVisualSystemDataPath()+"images/glow.png"); spriteSize = glow.getWidth(); cout << spriteSize << endl; ofEnableArbTex(); loadShaders(); setupFbos(); setupVbo(); }
// --------------------------------------------------------------------------------------------------------------------------------------------------- // bool ofxOculusRift::init( int _width, int _height, int _fboNumSamples ) { initFBO( _width, _height ); hmdWarpShader.load("Shaders/HmdWarp"); ofDisableArbTex(); ofFbo::Settings tmpSettings = ofFbo::Settings(); tmpSettings.width = _width/2; tmpSettings.height = _height; tmpSettings.internalformat = GL_RGB; tmpSettings.textureTarget = GL_TEXTURE_2D; tmpSettings.numSamples = _fboNumSamples; eyeFboLeft.allocate( tmpSettings ); eyeFboRight.allocate( tmpSettings ); ofEnableArbTex(); setNearClip( 0.001f ); setFarClip( 2048.0f ); setFov( 90.0f ); setInterOcularDistance( -0.6f ); setShaderScaleFactor( 1.0f ); setDoWarping( true ); return initSensor(); }
//-------------------------------------------------------------- void testApp::setup() { // setup pointsprite texture // NOTES: the texture size must be Power of Two, // and turn off arb texture option while loading ofDisableArbTex(); sprite.loadImage("image.jpg"); ofEnableArbTex(); ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground(0); sys.setup(); group.setup(sys); group.setColor(ofxSPK::RangeC(ofColor(255, 255), ofColor(255, 255)), ofxSPK::RangeC(ofColor(0, 0), ofColor(255, 0))); group.setLifeTime(0.5, 5); group.setFriction(0.1); group.setSize(0, ofxSPK::RangeF(30, 250)); group.setGravity(ofVec3f(0, -10, 0)); group.setMass(0.1, 1); rot.setup(SPK::Vortex::create(SPK::Vector3D(ofGetWidth()/2, ofGetHeight()/2), SPK::Vector3D(0, 1, 0), 200, 10), group); group.reserve(10000); }
void ofApp::setupSPK() { ofDisableArbTex(); sprite.loadImage("image.jpg"); ofEnableArbTex(); ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground(0); sys.setup(); group.setup(sys); group.setColor(ofxSPK::RangeC(ofColor(255, 255), ofColor(255, 255)), ofxSPK::RangeC(ofColor(0, 0), ofColor(255, 0))); group.setLifeTime(0.5, 2); group.setFriction(0.1); group.setSize(0, ofxSPK::RangeF(30, 100)); group.setGravity(ofVec3f(0, -10, 0)); group.setMass(0.1, 1); rot.setup(SPK::Vortex::create(SPK::Vector3D(ofGetWidth()/2, ofGetHeight()/2), SPK::Vector3D(0, 1, 0), 200, 10), group); group.reserve(10000); }
//-------------------------------------------------------------- void ofApp::setup(){ ofDisableArbTex(); ofLoadImage(tex, "heightmap.png"); ofEnableArbTex(); shader.load("","shader.frag"); }
GLuint ofxImGui::loadTexture(string imagePath) { ofDisableArbTex(); ofTexture* texture = new ofTexture(); ofLoadImage(*texture, imagePath); ofEnableArbTex(); loadedTextures.push_back(texture); return texture->getTextureData().textureID; }
void TexFlow::setup() { cni = ofPtr<CurlNoiseInstanced>(new CurlNoiseInstanced()); cni->setup(true, 32); ofDisableArbTex(); ofLoadImage(Globals::testTex, "imgs/deform/23e.png"); ofEnableArbTex(); }
void MarineSnow::init(const string& dataPath) { mesh.setMode(OF_PRIMITIVE_POINTS); shader.load(dataPath + "shaders/snow"); ofDisableArbTex(); tex.setCompression(OF_COMPRESS_ARB); tex.loadImage(dataPath + "images/snow2.png"); ofEnableArbTex(); }
void pbVertexRender::setup( string pointImageFile, string shaderVert, string shaderFrag ) { ofDisableArbTex(); ofLoadImage( texture, pointImageFile ); ofEnableArbTex(); useShader_ = (shaderVert!="" && shaderFrag!=""); if ( useShader_ ) { shader_.load( shaderVert, shaderFrag ); } }
//-------------------------------------------------------------- void ofApp::setup(){ // // // string hostname = ofxNet::NetworkUtils::getNodeName(); #ifdef _DEBUG printf("hostname: %s\n", hostname.c_str()); #endif // // // ofSetBackgroundAuto(false); ofEnableAntiAliasing(); ofSetCircleResolution( 24 ); //m_default_font.loadFont("fonts/verdana.ttf",false,0.3, 144.0); m_default_font.setup("fonts/verdana.ttf"); m_buttons[0].loadImage("ui/PhotoCollection.png"); m_buttons[1].loadImage("ui/BusinessModel.png"); m_buttons[2].loadImage("ui/Save.png"); m_buttons[3].loadImage("ui/Close.png"); ofDisableArbTex(); m_background_tile.loadImage("ui/background_tile.png"); m_background_tile.getTextureReference().setTextureWrap(GL_REPEAT, GL_REPEAT); ofEnableArbTex(); layout(); // // // m_db.setup(); vector< openTableDocument* > sessions = m_db.getDocumentsOfType("session"); if (sessions.size() > 0 ) { m_current_session = ( openTableSession* ) sessions[ 0 ]; } else { m_current_session = ( openTableSession* ) m_db.add("session"); m_db.save(); } // // start server // m_server.setup(); // // // m_show_keyboard = false; if ( !m_multitouch.setup() ) { ofShowCursor(); } }
//-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); ofEnableDepthTest(); ofDisableArbTex(); ofLoadImage(heightMap, "heightmap.png"); normalFbo.allocate(ofGetWidth(), ofGetHeight()); ofEnableArbTex(); normalShader.load("","normal.frag"); terrainShader.load("terrain"); int scale = 15; int w = ofGetWidth()/scale; int h = ofGetHeight()/scale; for (int y = 0; y < h; y++){ for (int x = 0; x<w; x++){ float offsetX = 0; float offsetY = (x%2==1)?0.5:0.0; terrain.addVertex(ofPoint((x+offsetX)*scale,(y+offsetY)*scale,0)); terrain.addNormal(ofPoint(1,0,0)); terrain.addTexCoord(ofVec2f((float)(x+offsetX)/(float)w,(float)(y+offsetY)/(float)h)); } } for (int y = 0; y<h-1; y++){ for (int x=0; x<w-1; x++){ if(x%2==0){ terrain.addIndex(x+y*w); // a terrain.addIndex((x+1)+y*w); // b terrain.addIndex(x+(y+1)*w); // d terrain.addIndex((x+1)+y*w); // b terrain.addIndex((x+1)+(y+1)*w); // c terrain.addIndex(x+(y+1)*w); // d } else { terrain.addIndex((x+1)+y*w); // b terrain.addIndex(x+y*w); // a terrain.addIndex((x+1)+(y+1)*w); // c terrain.addIndex(x+y*w); // a terrain.addIndex(x+(y+1)*w); // d terrain.addIndex((x+1)+(y+1)*w); // c } } } bWireframe = false; light.setDiffuseColor(ofFloatColor(1.,1.,0.9)); light.setPosition(100, 100, 1000); }
//-------------------------------------------------------------- void testApp::loadShader(){ cloudShader.load("shaders/Cloud"); cloudShader.begin(); cloudShader.setUniform1i("tex0", 0 ); cloudShader.end(); ofDisableArbTex(); crossSprite.loadImage("shaders/cross.png"); ofEnableArbTex(); ambientShader.load("shaders/Ambient"); }
void ofxWaterRipple::setup(int w, int h) { _height=h/FACTOR; _width=w/FACTOR; ofEnableArbTex(); pDamping = 0.99f; //Factor de damping setupGPU(); }
//-------------------------------------------------------------- void ofApp::setup(){ ofDisableArbTex(); ofLoadImage(tex,"ocean.png"); ofEnableArbTex(); width = ofGetWidth(); height = ofGetHeight(); shader.load("","shader.frag"); fbo.allocate(width, height); }
//======================================================================== int main( ){ ofSetLogLevel(OF_LOG_VERBOSE); ofEnableArbTex(); ofSetupOpenGL(1280, 1024, OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunApp(new testApp()); }
void ofxInkSim::setup(int width, int height, string grainPath, string alumPath, string pinningPath) { this->width = width; this->height = height; ofDisableArbTex(); pxSize = ofVec2f::one() / ofVec2f(width, height); offset = pxSize; ofLoadImage(grain, grainPath); ofLoadImage(alum, alumPath); ofLoadImage(pinning, pinningPath); ofFbo::Settings settings; settings.width = width; settings.height = height; settings.textureTarget = GL_TEXTURE_2D; settings.internalformat = GL_RGBA32F_ARB; screen.allocate(settings); depositionBuffer.allocate(settings); disorder.allocate(settings); surfInk.allocate(settings); misc.allocate(settings); velDen.allocate(settings); flowInk.allocate(settings); fixInk.allocate(settings); dist1.allocate(settings); dist2.allocate(settings); sinkInk.allocate(settings); depositionBuffer.begin(); ofClear(0, 0); depositionBuffer.end(); disorder.begin(); ofClear(0, 0); disorder.end(); // make disorder buffer fillDisorderBuffer(); drawMode = INKFIX; ofEnableArbTex(); // debug bDebug = false; }
//-------------------------------------------------------------- void ofApp::setup(){ ofBackground(0); earth_radius = 100; distance = 250; tokyoCl = ofColor(255,255,0); sydneyCl = ofColor(0,255,255); tokyoPos = ofVec3f(sin(tokyo_lat)*cos(tokyo_lon), sin(tokyo_lat)*sin(tokyo_lon), cos(tokyo_lat)) * earth_radius*1.001; sydneyPos = ofVec3f(sin(sydney_lat)*cos(sydney_lon), sin(sydney_lat)*sin(sydney_lon), cos(sydney_lat)) * earth_radius*1.001; camPos = ofVec3f(0,0,distance); mCam.setPosition(camPos); mCam.lookAt(ofVec3f(0,0,0)); defaultCameraVec = ofVec3f(0,0,0)-mCam.getPosition(); defaultCameraVec.normalize(); defaultCameraUpDir = mCam.getUpDir(); mSphere.set(earth_radius,32); mSphereMesh = mSphere.getMesh(); ofDisableArbTex(); earthTexture.load("gebco_08_rev_bath_720x360_color.jpg"); ofEnableArbTex(); gui.setup(); gui.add(cameraRotX.setup("camera rot x", 0, 0,2*PI)); gui.add(useLookAt.setup("use lookAt func",false)); gui.add(autoRotate.setup("Auto Rotation",true)); gui.add(autoRotateSpeed.setup("Auto Rotation Speed",0.5,0.0,2.0)); gui.add(lookAtCenter.setup("Look at center",false)); gui.add(lookAtTokyo.setup("Look at Tokyo",true)); gui.add(lookAtSydney.setup("Look at Sydnes",false)); gui.add(useMakeRotateOrig.setup("use makeRotate_original func",false)); }
//-------------------------------------------------------------- void testApp::loadShader(){ billboard.load("shaders/Billboard"); billboard.begin(); billboard.setUniform1i("tex", 0); billboard.end(); ofDisableArbTex(); nodeSprite.loadImage("shaders/dot.png"); nodeSpriteBasic.loadImage("shaders/dot_no_ring.png"); ofEnableArbTex(); lineAttenuate.load("shaders/attenuatelines"); gaussianBlur.load("shaders/gaussianblur"); }
GLuint ofxImGui::loadTexture(ofTexture& texture, string imagePath) { bool isUsingArb = ofGetUsingArbTex(); if (isUsingArb) { ofDisableArbTex(); } ofLoadImage(texture, imagePath); if (isUsingArb) { ofEnableArbTex(); } return texture.getTextureData().textureID; }
void CloudsIntroSequence::selfSetup(){ ofDisableArbTex(); sprite.loadImage(getVisualSystemDataPath() + "images/dot.png"); ofEnableArbTex(); currentFontExtrusion = -1; currentFontSize = -1; introNodes.push_back( &introNodeOne ); introNodes.push_back( &introNodeTwo ); introNodes.push_back( &introNodeThree ); reloadShaders(); }
void CloudsVisualSystemFireworks::selfBegin() { //shader shader.begin(); shader.setUniform3f( "gravity", gravity.x, gravity.y, gravity.z ); shader.end(); //particle rendering bUpdateVbo = true; indexCount = 0; nextIndex = 0; numSprites = 0; nextFireworkExplosionTime = ofGetElapsedTimef() + 1; ofEnableArbTex(); getCameraRef().setPosition(0, 0, 0); camTarget.set( 0,0,spawnDistance); }
void FluidBrush::selfSetup(){ ofSetCircleResolution(36); ofEnableAlphaBlending(); ofDisableSmoothing(); ofSetFullscreen(true); ofDisableArbTex(); ofLoadImage(brushTexture, getDataPath()+"brush.png"); ofEnableArbTex(); int width = ofGetScreenWidth(); int height = ofGetScreenHeight(); colorAdded.allocate(width,height); water.allocate(width, height,GL_RGB); flow.allocate(width, height); fluid.allocate(width, height,0.5,false); fluid.setGravity(ofVec2f(0.0,0.0)); fluid.setUseObstacles(false); color.set(255); }
void faceColorToTexture(ofMesh& mesh, ofImage& image) { vector<ofFloatColor> &color = mesh.getColors(); int num_face = color.size() / 3; int tex_size = ofNextPow2(ceil(sqrt(num_face))); bool arb = ofGetUsingArbTex(); ofDisableArbTex(); image.allocate(tex_size, tex_size, OF_IMAGE_COLOR); if (arb) ofEnableArbTex(); mesh.clearTexCoords(); image.getPixelsRef().set(0); float texel_size = (1. / image.getWidth()) * 0.5; for (int i = 0; i < num_face; i++) { int u = (i % tex_size); int v = (i / tex_size); ofColor c = color[i * 3]; image.setColor(u, v, c); float uu = (float)u / image.getWidth() + texel_size; float vv = (float)v / image.getHeight() + texel_size; mesh.addTexCoord(ofVec2f(uu, vv)); mesh.addTexCoord(ofVec2f(uu, vv)); mesh.addTexCoord(ofVec2f(uu, vv)); } image.update(); mesh.clearColors(); }
ParticleSystem::ParticleSystem() { currentImage = 0; curIndex = 0; useGravity = true; maxSpriteSize = 96.0; //setWindowSize( ofVec2f( 1, 1 ) ); shader.setup("shader/pointShader.vs", "shader/pointShader.fs" ); ofDisableArbTex(); //dustParticle.loadImage("shader/pointSpriteImg.png"); interviewPointSprite.loadImage("shader/InterviewSpriteImg_001.png"); buzzPointSprite.loadImage("shader/BuzzSpriteImg_001.png"); votePointSprite.loadImage("shader/VoteSpriteImg_002.png"); performancePointSprite.loadImage("shader/PerformanceSpriteImg_001.png"); inspirationPointSprite.loadImage("shader/InspirationSpriteImg_002.png"); ofEnableArbTex(); drawingType = SHADED_POINT_SPRITE; setInteractionMode(MODE_INTERVIEW); }
void CloudsVisualSystemFireworks::selfBegin() { //particle behavior // fireworkGravity.set(0, -6 / 120., 0 ); // particleGravity.set( 0, 40, 0); // minVel = 4; // maxVel = 60; // maxFWVel = 2.4; //shader shader.begin(); shader.setUniform3f( "gravity", particleGravity.x, particleGravity.y, particleGravity.z ); shader.end(); // startColor.set( .9, .95, 1.95, 1 ); // endColor.set( .6, 1.3, .2, 1 ); // // minLifeSpan = .1; // maxLifeSpan = 1; // // //camera // camSpeed = 1; //particle rendering bUpdateVbo = true; indexCount = 0; nextIndex = 0; numSprites = 0; nextFireworkExplosionTime = ofGetElapsedTimef() + 1; ofEnableArbTex(); camera.setPosition(0, 0, 0); camTarget.set( 0,0,300); }
//-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); gui.setup("panel"); // most of the time you don't need a name but don't forget to call setup gui.add(speed.set( "speed", 200, 10, 300 )); gui.add(cameraXRadius.set( "cameraXRadius", 150, 0, 5000 )); gui.add(cameraZRadius.set( "cameraZRadius", 1000, 0, 5000 )); // GL_REPEAT for texture wrap only works with NON-ARB textures // ofDisableArbTex(); texture.loadImage("Meat0016_thumbhuge.jpg"); // texture: http://www.cgtextures.com/ texture.getTextureReference().setTextureWrap( GL_REPEAT, GL_REPEAT ); ofEnableArbTex(); for (int i = 0; i < NUM; i++) { boxes[i].set( w, h, d ); boxes[i].setPosition(0, (h * hMargin) * i - (h * hMargin) * NUM / 2, 0); } ofSetSmoothLighting(true); pointLight.setDiffuseColor( ofFloatColor(.85, .85, .55) ); pointLight.setSpecularColor( ofFloatColor(1.f, 1.f, 1.f)); pointLight2.setDiffuseColor( ofFloatColor( 238.f/255.f, 57.f/255.f, 135.f/255.f )); pointLight2.setSpecularColor(ofFloatColor(.8f, .8f, .9f)); pointLight3.setDiffuseColor( ofFloatColor(19.f/255.f,94.f/255.f,77.f/255.f) ); pointLight3.setSpecularColor( ofFloatColor(18.f/255.f,150.f/255.f,135.f/255.f) ); // shininess is a value between 0 - 128, 128 being the most shiny // material.setShininess( 120 ); // the light highlight of the material // material.setSpecularColor(ofColor(255, 255, 255, 255)); }
//-------------------------------------------------------------- void ofApp::setup(){ // initialize variables: isShaderDirty = true; // this flag will tell us whether to reload our shader from disk. // this allows you to change your shaders without having to restart // your app. we'll set it up so that pressing the SPACE key on your // keyboard will reload the shader. // initialize screen, lock framerate to vsync: ofSetFrameRate(0); ofSetVerticalSync(true); // generate a box vboMesh from a primitive. ofBoxPrimitive tmpBox; // set the size to be 2 units. tmpBox.set(2); mVboBox = tmpBox.getMesh(); // load depth image ofDisableArbTex(); // note that we disable arb tex, meaning we will use normalized texture coordinates, // where a texture's x and y coordinate are each expressed as a normalized float. // this makes things slightly easier in the shader. // load the depth image into our texture ofLoadImage(mTexDepth, "depth_image.png"); ofEnableArbTex(); mCamMain.setupPerspective(false,60,0,10000); }