//-------------------------------------------------------------- void testApp::draw(){ ofEnableSmoothing(); ofSetupScreenOrtho(ofGetWindowWidth(), ofGetWindowHeight(), OF_ORIENTATION_DEFAULT, true, -10, 10); ofTranslate(ofGetWindowWidth()*0.5, ofGetWindowHeight()*0.5); ofScale(ofGetWindowWidth()*scale,-ofGetWindowHeight()*scale,-scale); /* ofRotateY(-15); ofRotateX(15); ofRotateZ(15); */ //ofDrawGrid(10, 100, false, false, false, true); //ofDrawAxis(1); //ofDrawRotationAxes(0.2); //ofDrawGridPlane(10); ofVec3f axis; float angle; qrot.getRotate(angle, axis); //apply the quaternion's rotation to the viewport and draw the sphere ofRotate(angle, axis.x, axis.y, axis.z); ofSetColor(255,0,0); ofLine(ofPoint(0,0,0), px); ofDrawBitmapString("x", px+0.1); ofSetColor(0,255,0); ofLine(ofPoint(0,0,0),py); ofDrawBitmapString("y", py-0.1); ofSetColor(0,0,255); ofLine(ofPoint(0,0,0),pz); ofDrawBitmapString("z", pz+0.1); }
void cyrilApp::toggleOrtho(void * _o) { ((cyrilApp *)_o)->isOrtho = !((cyrilApp *)_o)->isOrtho; if (((cyrilApp *)_o)->isOrtho) { //ofSetupScreenOrtho(); ofSetupScreenOrtho(1200,1200,0,10); } else { ofSetupScreenPerspective(1200,1200,0,0,0); } }
void MissingControl::drawPlan(float x, float y, float side) { ofPushView(); ofViewport(x, y, side, side); ofSetupScreenOrtho(side, side, OF_ORIENTATION_DEFAULT, false, -stageHeight, stageHeight); ofTranslate(side / 2, side / 2); float scale = side / stageSize; ofScale(scale, scale, scale); drawScene(false); ofPopView(); }
static int lua_graphics_set_ortho(lua_State *L) { float w = lua_isnumber(L, 1) ? lua_tonumber(L, 1): ofGetWidth(); float h = lua_isnumber(L, 2) ? lua_tonumber(L, 2): ofGetHeight(); float nearDist = lua_isnumber(L, 3) ? lua_tonumber(L, 3) : -1; float farDist = lua_isnumber(L, 4) ? lua_tonumber(L, 4) : -1; ofSetupScreenOrtho(w, h, OF_ORIENTATION_UNKNOWN, true, nearDist, farDist); return 0; }
void ofApp::draw(){ ofDisableAlphaBlending(); ofBackground(7, 17, 40); ofSetupScreenOrtho(); all_containers.draw(); if(dt_config::DT_SHOW_LINER_DRAWER) linear_drawer.draw(canvas.x+30, canvas.y+30, canvas.width-60, canvas.height-60, 1); config.draw(); }
//---------------------------------------- void ofx2DCam::begin(ofRectangle _viewport){ viewport = _viewport; ofPushView(); ofViewport(viewport); ofSetupScreenOrtho(viewport.width, viewport.height, nearClip, farClip); ofPushMatrix(); ofRotateX(orientation.x); ofRotateY(orientation.y); ofTranslate(translation*orientationMatrix); ofScale(scale,scale,scale); }
void ofApp::draw(){ exporter.begin();{ ofEnableAlphaBlending(); ofBackground( 255, 255, 255, 255 ); grav_wall.draw(); }exporter.end(); ofPushMatrix();{ ofSetupScreenOrtho(); ofBackground(0); ofSetColor(255); exporter.draw(0, 0); draw_info(); gpu_noise.draw(300, 10, 0.2); }ofPopMatrix(); }
void draw() { ofSetupScreenOrtho(0,0,OF_ORIENTATION_UNKNOWN,true,-200,200); ofScale(globalScale,globalScale); ofSetColor(255); bg.draw(0,0); //ofSetColor(0); //ofDrawBitmapString("?",ofGetWidth()-16,ofGetHeight()-16); ofSetColor(255); canvas.draw(); if (debug) canvas.drawDebug(); side.draw(); shapes.draw(shapeButtons.x,shapeButtons.y); if (ultimaker.isStartTagFound) thermometer.draw(); ofSetColor(0); ofSetColor(255); btnHelp.draw(btnHelpPos); if (debug) drawConsole(); }
//-------------------------------------------------------------- void testApp::setup(){ // saver.setup(ofGetWidth() ,ofGetHeight(),30); // image.allocate(ofGetWidth() ,ofGetHeight(), OF_IMAGE_COLOR_ALPHA); // ofSetLogLevel(OF_LOG_VERBOSE); ofSetFrameRate(60); ofEnableSmoothing(); ofBackground(0); center.set(ofGetWidth()/2,ofGetHeight()/2); SIZE = (ofGetWidth()/GRID_WIDTH*1.0f)*0.5; space = sin((1/6.0f)*2*M_PI)*SIZE*2.5; float space2 = sin((1/6.0f)*2*M_PI)*SIZE*2.5; float minX = center.x - (GRID_WIDTH * space); float minY = center.y - (GRID_HEIGHT * space); float maxWidth = (GRID_WIDTH * space+((GRID_HEIGHT%2)*0.5)*space) + center.x - (GRID_WIDTH * space)*0.5 - minX; float maxHeight = (GRID_HEIGHT * space) + center.y - (GRID_HEIGHT * space)*0.5 - minY; for (int j=0; j<GRID_HEIGHT; j++) { for (int i=0; i<GRID_WIDTH; i++) { int index = (j*GRID_WIDTH+i) * LENGTH; int index2 = (j*GRID_WIDTH+i); // center_pos[index2].y = ofRandom(-10000,-800); center_pos[index2].y = (j * space2) + center.y - (GRID_HEIGHT * space2)*0.5; // center_pos[index2].z = ofRandom(-RANGE,RANGE); center_pos[index2].z = 0; int x = (i * space+((j%2)*0.5)*space) + center.x - (GRID_WIDTH * space)*0.5f;// int y = center_pos[index2].y;// int z = center_pos[index2].z; bStart[index2] = false; // now we are at each line int hex_index = 0; float rdnSize = 1; float hue = 1; // float hue = ofRandom(1); center_pos[index2].set(x,y,z); start[index2]= center_pos[index2]; acc[index2].set(0,ofRandom(1,2),0); for (int k=0; k<LENGTH; k++) { color[index + k] = ofFloatColor::fromHsb(1,0,1); pos[index +k].x = x+sin((hex_index/6.0f)*2*M_PI)*SIZE*rdnSize; pos[index +k].y = y+cos((hex_index/6.0f)*2*M_PI)*SIZE*rdnSize; // tex_coord[index +k].x = ofMap(pos[index +k].x,minX , maxWidth , 0,640); // tex_coord[index +k].y = ofMap(pos[index +k].y,minY , maxHeight, 0,480); hex_index++; pos[index +k].z = z; loc[index +k] = pos[index +k]; } } } total = GRID_WIDTH*GRID_HEIGHT*LENGTH; vbo.setVertexData(pos, total, GL_DYNAMIC_DRAW); // vbo.setColorData(color, total, GL_DYNAMIC_DRAW); // vbo.setTexCoordData(tex_coord, total, GL_DYNAMIC_DRAW); // glEnable(GL_DEPTH_TEST); ofSetupScreenOrtho(); count = 0; timeCount = 0; // startThread(); // light.setPosition(1000, 1000, 2000); // Setup post-processing chain // post.init(ofGetWidth(), ofGetHeight()); // post.createPass<FxaaPass>()->setEnabled(true); // post.createPass<BloomPass>()->setEnabled(true); // post.createPass<DofPass>()->setEnabled(true); // post.createPass<KaleidoscopePass>()->setEnabled(false); // post.createPass<NoiseWarpPass>()->setEnabled(false); // post.createPass<PixelatePass>()->setEnabled(false); // post.createPass<EdgePass>()->setEnabled(false); // server.setName("hexSnow"); }