void World::drawModel(bool showCameraFrustrums, bool rightEye, bool showOrigin, bool showPlaneOutlines) {
     
     for(std::pair<string, shared_ptr<Plane>> p : planes){
         ofPushStyle();
         ofEnableBlendMode(OF_BLENDMODE_ALPHA);
         ofSetColor(127*0.9, 127, 127*0.9, 255);
         p.second->drawPlaneModel(!rightEye, false);
         
         ofDisableDepthTest();
         ofSetColor(255, 255*0.9, 255, 127);
         ofEnableBlendMode(OF_BLENDMODE_ADD);
         p.second->drawPlaneModel(rightEye, showPlaneOutlines);
         ofPopStyle();
     }
     
     if(showCameraFrustrums){
         for(std::pair<string, shared_ptr<Plane>> p : planes){
             p.second->drawCamerasModel();
         }
     }
     if(showOrigin){
         ofDisableDepthTest();
         ofDrawAxis(100);
         ofDrawBitmapString("+X", 100, 0, 0);
         ofDrawBitmapString("+Y", 0, 100, 0);
         ofDrawBitmapString("+Z", 0, 0, 100);
     }
     //ofDrawSphere(audienceFrontLeft, 10);
     //ofDrawSphere(audienceBackRight, 10);
     //audiencePlane.draw();
 }
Exemplo n.º 2
0
void Panel::display() {
    if(bFlipping) {
        if(curr != NULL && next != NULL) {
            ofPushStyle();
            ofEnableDepthTest();
            ofSetColor(255);
            ofPushMatrix();
            ofTranslate(bounds.getX(), bounds.getY());
            next->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, 0);
            curr->drawSubsection(0, bounds.getHeight()/2, bounds.getWidth(), bounds.getHeight()/2, 0, bounds.getHeight()/2);
            if(rot > rotThreshold) {
                ofPushMatrix();
                ofTranslate(0, bounds.getHeight()/2);
                ofRotateX(rot);
                ofTranslate(0, -bounds.getHeight()/2);
                curr->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, 0);
                ofPopMatrix();
            }
            else {
                ofPushMatrix();
                ofTranslate(0, bounds.getHeight()/2);
                ofRotateX(180 + rot);
                next->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, bounds.getHeight()/2);
                ofPopMatrix();
            }
            ofPopMatrix();
            ofDisableDepthTest();
            ofPopStyle();
        }
        else {
            ofLogWarning("Panel::display()", "one or more of you images have not been set");
        }
    }
    else {
        if(curr != NULL && next != NULL) {
            ofEnableDepthTest();
            ofPushMatrix();
            ofSetColor(255);
            ofTranslate(bounds.getX(), bounds.getY());
            curr->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight(), 0, 0);
            //            cout<<bounds.getWidth()<<endl;
            ofPopMatrix();
            ofDisableDepthTest();
        }
        else {
            ofLogWarning("Panel::display()", "one of more of your images have not been set");
        }
    }
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackground(0);
	ofDisableDepthTest();
	ofEnableAlphaBlending();
	rgbd.selfPostDraw();
	ofSetColor(255);

#ifndef OCULUS_RIFT
	hud.draw();
	CloudsVisualSystem::getRGBDVideoPlayer().drawSubtitles();
#endif

	ofDisableDepthTest();
	//rgbd.getRGBDVideoPlayer().getPlayer().draw(0,0);
}
void ofxKsmrParallellinkDelta::draw(){

	ofEnableDepthTest();
	for (int i = 0;i < 3;i++){
		ofSetColor(255);
		actuator[i].setScale(0.3);
		arm[i].setScale(0.3);
		actuator[i].draw();
		arm[i].draw();

		ofLine(actuator[i].getGlobalPosition(),
			   arm[i].getGlobalPosition());

		if (fabs(arm[i].getGlobalPosition().distance(plots[i]) - arm2_length/2) > 0.5) ofSetColor(255, 0, 0);
		else ofSetColor(255);
		ofLine(arm[i].getGlobalPosition(),
			   plots[i]);
	}

	ofSetColor(255);
	plot.setScale(0.5);
	plot.draw();
	ofDisableDepthTest();
	
}
Exemplo n.º 5
0
void ofApp::draw(){
    //背景
    ofBackgroundGradient(ofColor(90, 90, 90), ofColor(30, 30, 30),  OF_GRADIENT_BAR);
    
    //ログ表示
    ofSetColor(200);
    ofDrawBitmapString("ofxLeapMotion - Example App\nLeap Connected? " + ofToString(leap.isConnected()), 20, 20);
    
    ofEnableDepthTest();
    cam.begin();
    
    //地面のグリッドを描画
    ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
    ofPopMatrix();
    
    //検出した手を描画
    for(int i = 0; i < simpleHands.size(); i++){
        simpleHands[i].debugDraw();
    }
    
    cam.end();
    ofDisableDepthTest();
}
Exemplo n.º 6
0
//--------------------------------------------------------------
void ofApp::draw() {
    ofDrawBitmapString("ofxKinectV2: Work in progress addon.\nBased on the excellent work by the OpenKinect libfreenect2 team\n\n-Only supports one Kinect v2 at a time. \n-Requires USB 3.0 port ( superspeed )\n-Requires patched libusb. If you have the libusb from ofxKinect ( v1 ) linked to your project it will prevent superspeed on Kinect V2", 10, 14);

    texDepth.draw(10, 100);
    texRGB.draw(10, 110 + texDepth.getHeight(), 1920/4, 1080/4);

    // draw mesh
    camera.begin();
    {
        ofPushMatrix();
        {
            ofScale(1, -1, -1);
            ofTranslate(-100, -200, -500);
            ofEnableDepthTest();
            {
                kinectMesh.setMode(OF_PRIMITIVE_TRIANGLES);
                glLineWidth(int(1));
                kinectMesh.drawWireframe();
            }
            ofDisableDepthTest();
        }
        ofPopMatrix();
    }
    camera.end();

    // gui
    panel.draw();

    // debug
    ofSetWindowTitle(ofToString(ofGetFrameRate(), 0));
}
Exemplo n.º 7
0
void testApp::drawScene() {

	ofPushStyle();
	ofEnableDepthTest();

    ofPushMatrix();    
	ofTranslate(0, 0, 10);
	ofRotate(90, 0, 1, 0);
    ofSetColor(0,200,0);
    ofDrawGridPlane(12.0f, 8.0f, false);
	ofPopMatrix();

    ofPushMatrix();    
	ofTranslate(0, 0, -3);
	ofRotate(90, 0, 1, 0);    
	ofSetColor(200,0,0);
    ofDrawGridPlane(12.0f, 8.0f, false);
	ofPopMatrix();

    ofPushMatrix();    
	ofTranslate(0, 0, -6);
	ofRotate(90, 0, 1, 0);    
	ofSetColor(100,100,0);
    ofDrawGridPlane(12.0f, 8.0f, false);
	ofPopMatrix();

	ofDisableDepthTest();

	ofPopStyle();
}
Exemplo n.º 8
0
//--------------------------------------------------------------
void ofApp::renderScene() {
    ofEnableDepthTest();

    pbr.begin(&cam, &particlesShader);
    pbr.getShader()->setUniformTexture("posTex", *tf.getTexture(0), 11);
    pbr.getShader()->setUniformTexture("velTex", *tf.getTexture(1), 12);
    pbr.getShader()->setUniformTexture("ageTex", *tf.getTexture(2), 13);
    pbr.getShader()->setUniformTexture("lifetimeTex", *tf.getTexture(3), 14);
    pbr.getShader()->setUniform3f("maxSize", boxSize);
    material1.begin(&pbr);
    mesh.drawInstanced(OF_MESH_FILL, numParticles);
    material1.end();
    pbr.end();

    pbr.begin(&cam);
    jointMaterial.begin(&pbr);
    for (int i = 0; i < bvh.getNumJoints(); i++) {
        ofMatrix4x4 m = bvh.getJoint(i)->getMatrix();
        ofPushMatrix();
        float angle;
        ofVec3f axis;
        m.getRotate().getRotate(angle, axis);
        ofTranslate(bvh.getJoint(i)->getPosition() * 10);
        ofRotate(angle, axis.x, axis.y, axis.z);
        ofDrawSphere(0, 0, 0, 10);
        ofPopMatrix();
    }
    jointMaterial.end();
    floorMaterial.begin(&pbr);
    ofDrawBox(0, -25, 0, 5000, 1, 5000);
    floorMaterial.end();
    pbr.end();

    ofDisableDepthTest();
}
Exemplo n.º 9
0
//--------------------------------------------------------------
void ofApp::draw(){
    //隠面消去
    ofEnableDepthTest();
    //テクスチャー適用
    image.getTexture().bind();
    
    
    
    cam.begin();
    
    //球から生成したメッシュを描画
    ofSetColor(255);
    sphereMesh.drawFaces();

    
    //メッシュの頂点の数だけくりかえし
    for (int i = 0; i < sphereMesh.getVertices().size(); i++) {
        
        ofPushMatrix();
        //メッシュのそれぞれの頂点の位置を取得
        ofTranslate(sphereMesh.getVertices()[i]);
        //頂点番号を表示
        ofDrawBitmapString(ofToString(i), 0, 0);
        ofPopMatrix();
        
        
        
    }
    cam.end();

    image.getTexture().unbind();
    ofDisableDepthTest();
}
//--------------------------------------------------------------
void EnvironmentMapping::draw(){
    ofBackgroundGradient(ofColor(50), ofColor(255));
    
    ofEnableDepthTest();
 
    cam.begin();
    //texture[0].getTexture().bind();
    shader.begin();
    shader.setUniformMatrix3f("normalMatrix", mat4ToMat3(ofGetCurrentNormalMatrix()));
    shader.setUniformTexture("EnvMap", texture[0].getTexture(), 0);
    shader.setUniform3f("BaseColor",baseColor->x/255,baseColor->y/255,baseColor->z/255);
    shader.setUniform1f("MixRatio", mixRatio);

    shader.setUniform3f("LightPosition",lightPos->x,lightPos->y,lightPos->z);
    
    //cout<<ofGetCurrentNormalMatrix()<<endl;
    //model.drawFaces();
    sphere.draw();
    shader.end();
    //texture[0].getTexture().unbind();
    cam.end();
    
    ofDisableDepthTest();
    gui.draw();
    
    
}
Exemplo n.º 11
0
//-----------------------------------------------------------------------------------------
//
void ofApp::draw()
{
	ofBackgroundGradient( ofColor(40,40,40), ofColor(0,0,0), OF_GRADIENT_CIRCULAR);	
	
	ofEnableDepthTest();
	
	camera.begin();
	
		// draw a grid on the floor
		ofSetColor( ofColor(60) );
		ofPushMatrix();
			ofRotate(90, 0, 0, -1);
			ofDrawGridPlane( 12 );
		ofPopMatrix();

		ofPushMatrix(); //rotate and translate the mesh
		ofRotate(90, 1, 0, 0);
		ofTranslate(0, 0, -3);
			mesh.draw();
		ofPopMatrix();
	
	camera.end();

	ofSetColor( ofColor::white );
	ofDisableDepthTest();


	fontSmall.drawStringShadowed(ofToString(ofGetFrameRate(),2), ofGetWidth()-35, ofGetHeight() - 6, ofColor::whiteSmoke, ofColor::black );
}
Exemplo n.º 12
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofEnableDepthTest();
    cam.begin();
    ibl.begin(&cam, &cubemap[environment]);
    ibl.drawEnvironment(4000.0, 0.2);

    
    material.roughness = 0.5 /9.0;
    material.metallic = 5.0 / 9.0;
    
    material.begin(ibl.getShaderPtr());
    //dibujar el objeto
    for(int i=0; i<limonModel.getNumMeshes(); i++){
        ofPushMatrix();
        ofMultMatrix(limonModel.getMeshHelper(i).matrix);
        
        ofScale(limonModel.getModelMatrix().getScale());
        limonModel.getCurrentAnimatedMesh(i).draw();
        ofPopMatrix();
    }

    material.end();

    ibl.end();
    cam.end();
    ofDisableDepthTest();
   
    gui.draw();
    
}
// selfDraw draws in 3D using the default ofEasyCamera
// you can change the camera by returning getCameraRef()
void CloudsVisualSystemRandomDigits2::selfDraw(){
    
	ofPushMatrix();
    glPushAttrib(GL_FOG_BIT);
    
    glEnable(GL_FOG);
	glFogi(GL_FOG_COORD_SRC, GL_FRAGMENT_DEPTH);
	glFogi(GL_FOG_MODE, GL_EXP);
	glFogf(GL_FOG_DENSITY, powf(fogDensity, 2));
    GLfloat fogColor[4] = { bgColor.r / 255.,bgColor.g / 255.,bgColor.b / 255., 1.0 };
    glFogfv(GL_FOG_COLOR, fogColor);
    ofEnableDepthTest();
    ofEnableAlphaBlending();
    
    ofPushStyle();
	if(rotationFix){
		ofRotate(90, 1, 0, 0);
	}
    
    numbersImg.bind();
    ofSetColor(255, 255, 255);
    ofDisableDepthTest();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    vbo.drawElements(GL_TRIANGLES, numbers.size()*6);

    numbersImg.unbind();
    
    ofPopStyle();
    
    glPopAttrib();
	ofPopMatrix();
    
}
Exemplo n.º 14
0
//--------------------------------------------------------------
void ofApp::draw(){
    // Clear screen
    ofColor centerColor(85, 78, 68);
    ofColor edgeColor(0, 0, 0);
    ofBackgroundGradient(centerColor, edgeColor, OF_GRADIENT_CIRCULAR);

    ofEnableDepthTest();

    // Use the camera
    easyCam.begin();
        ofPushMatrix();
            if (state == 0) {
                sphereMesh.draw();
            } else if (state == 1) {
                // Place the camera to view the middle of the screen
                ofTranslate(-ofGetWidth()/2, -ofGetHeight()/2);
                // Draw content
                genMesh.draw();
            }
        ofPopMatrix();
    easyCam.end();

    ofDisableDepthTest();

    // Draw ui
    frame.draw();
}
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor(255), ofColor(212));
    ofEnableDepthTest();
    ofEnableLighting();
    cam.begin();
    light1.enable();
    vtfShader.begin();
    vtfShader.setUniform4f("COMMON_Ambient",0.1,0.1,0.1,1.0);
    vtfShader.setUniform4f("COMMON_Diffuse",0.5,0.5,0.5,1.0);
    vtfShader.setUniform4f("COMMON_Specular",0.5,0.5,0.5,1.0);
    vtfShader.setUniform1f("COMMON_Shininess",100.0);
    vtfShader.setUniform1i("ADS_NumLights",ofGetLightingEnabled());
    vtfShader.setUniformTexture("posTex", posTex,0);
    vtfShader.setUniformTexture("sizeTex", sizeTex,1);
    vtfShader.setUniformTexture("rotTex", rotTex,2);
    vtfShader.setUniformTexture("colorTex", colorTex,3);
    vtfShader.setUniform1f("iCount", textureRes);
    object.drawInstanced(OF_MESH_FILL, textureRes*textureRes);
    vtfShader.end();
    if(lookAtSphere)ofDrawSphere(target, 50);
    light1.disable();
    cam.end();
    ofDisableLighting();
    ofDisableDepthTest();
}
Exemplo n.º 16
0
void testApp::drawLines() {
    
	int w = 640;
	int h = 480;
	ofMesh mesh;
	mesh.setMode(OF_PRIMITIVE_TRIANGLES);
	int step = 2;
    
	for(int y = 0; y < h; y += step) {
		for(int x = 0; x < w; x += step) {
			if(kinect.getDistanceAt(x, y) > 0) {
                
                ofColor realColor = ofColor(kinect.getColorAt(x,y));
                // how to add random?
				mesh.addColor(realColor);
                mesh.addVertex(kinect.getWorldCoordinateAt(x, y));
			}
		}
	}
	glLineWidth(2);
    ofPushMatrix();
    ofScale(-1, -1, -1);
	ofTranslate(0, 0, -1000); // center the points a bit
	ofEnableDepthTest();
    //mesh.draw();
    mesh.drawFaces();
	ofDisableDepthTest();
	ofPopMatrix();
}
Exemplo n.º 17
0
void ofxPBR::drawEnvironment(){

	glm::mat4 projectionMatrix = ofGetCurrentMatrix(OF_MATRIX_PROJECTION);
	float m22 = projectionMatrix[2][2];
	float m32 = projectionMatrix[3][2];
\
	float nearClip = (2.0f*m32) / (2.0f*m22 - 2.0f);
	float farClip = ((m22 - 1.0f) * nearClip) / (m22 + 1.0);

	if (enableCubemap && cubeMap != nullptr && cubeMap->isAllocated()) {
		float scale = (farClip - nearClip) / 2;
		glm::mat4 invCurrentViewMatrix = glm::inverse(ofGetCurrentViewMatrix());
		glm::vec3 translate = glm::vec3(invCurrentViewMatrix[3][0], invCurrentViewMatrix[3][1], invCurrentViewMatrix[3][2]);

		ofDisableDepthTest();
		ofPushMatrix();
		ofTranslate(translate);
		cubeMap->bind(1);
		envShader->begin();
		envShader->setUniform1f("envLevel", cubeMap->getEnvLevel());
		envShader->setUniform1i("envMap", 1);
		envShader->setUniform1i("numMips", cubeMap->getNumMips());
		envShader->setUniform1f("cubeMapExposure", cubeMap->getExposure());
		envShader->setUniform1f("cubeMapRotation", cubeMap->getRotation());
		ofPushMatrix();
		ofScale(scale, scale, scale);
		sphereMesh.draw();
		ofPopMatrix();
		envShader->end();
		cubeMap->unbind();
		ofPopMatrix();
		ofEnableDepthTest();
	}
}
Exemplo n.º 18
0
void ofApp::draw() {
  ofEnableDepthTest();
  ofEnableAlphaBlending();

  cam.begin();

  light.enable();

  if (drawGrid) ofDrawGrid(200);
  if (drawLight) light.draw();
  if (drawBox) {
    //    ofNoFill();
    //    ofSetColor(ofColor::white);
    ofSetColor(255, 255, 255, 20);
    ofDrawBox(BOX_MAX * 2, BOX_MAX * 2, BOX_MAX * 2);
    //    ofFill();
  }

  ball.draw();
    ball2.draw();

  light.disable();

  cam.end();

  ofDisableAlphaBlending();
  ofDisableDepthTest();
}
Exemplo n.º 19
0
void ofApp::draw(){

    if (!bDrawPointCloud) {
        ofSetColor(ofColor::white);
        astra.draw(0, 0);
        astra.drawDepth(640, 0);
    } else {
        cam.begin();
        ofEnableDepthTest();
        ofRotateY(180);
        ofScale(1.5, 1.5);

        mesh.draw();

        ofDisableDepthTest();
        cam.end();
    }

    stringstream ss;
    ss << "r: toggle registration between color & depth images (";
    ss << (bUseRegistration ? "on)" : "off)") << endl;
    ss << "p: switch between images and point cloud" << endl;
    ss << "c: toggle point cloud using color image or gradient (";
    ss << (bPointCloudUseColor ? "color image)" : "gradient)") << endl;
    ss << "rotate the point cloud with the mouse";

    ofSetColor(ofColor::white);
    ofDrawBitmapStringHighlight(ss.str(), 20, 500);
}
Exemplo n.º 20
0
//--------------------------------------------------------------
void ofApp::draw(){
    fbo.begin();
    ofEnableLighting();
    ofEnableDepthTest();


    pointLight.enable();
    pointLight.draw();
    
    //somehow this allows the light color and material color to blend
    glDisable(GL_COLOR_MATERIAL);
    if(applyMaterial){
        material.begin();
    }
    
    sphere.draw();
    
    pointLight.disable();
    if(applyMaterial){
        material.end();
    }
    ofDisableDepthTest();
    ofDisableLighting();
    fbo.end();

    //prevents strange layering of gui
    fbo.draw(0, 0);
    if(!hideGui){
        gui.draw();
    }
}
Exemplo n.º 21
0
void testApp::drawPointCloud() {
	int w = 640;
	int h = 480;
	ofMesh mesh;
	mesh.setMode(OF_PRIMITIVE_POINTS);
	int step = 2;
	for(int y = 0; y < h; y += step) {
		for(int x = 0; x < w; x += step) {
			if(kinect.getDistanceAt(x, y) > 0) {
			    if(colorize)
                    mesh.addColor(kinect.getColorAt(x,y));
				mesh.addVertex(kinect.getWorldCoordinateAt(x, y));
			}
		}
	}
	glPointSize(size);
	ofPushMatrix();
	// the projected points are 'upside down' and 'backwards'
	ofScale(1, -1, -1);
	ofTranslate(0, 0, -1000); // center the points a bit
	ofEnableDepthTest();
	mesh.drawVertices();
	ofDisableDepthTest();
	ofPopMatrix();
}
Exemplo n.º 22
0
void ofApp::draw(){
    //背景
    ofBackgroundGradient(ofColor(90, 90, 90), ofColor(30, 30, 30),  OF_GRADIENT_BAR);
    
    //ログ表示
    ofSetColor(200);
    ofDrawBitmapString("ofxLeapMotion - Example App\nLeap Connected? " + ofToString(leap.isConnected()), 20, 20);
    
    ofEnableDepthTest();
    cam.begin();
    
    //地面のグリッドを描画
    ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
    ofPopMatrix();
    
    //検出した手を描画
    fingerType fingerTypes[] = {THUMB, INDEX, MIDDLE, RING, PINKY};
    
    for(int i = 0; i < simpleHands.size(); i++){
        bool isLeft = simpleHands[i].isLeft;
        ofPoint handPos = simpleHands[i].handPos;
        ofPoint handNormal = simpleHands[i].handNormal;
        
        //手の中心位置を描画
        ofSetColor(0, 0, 255);
        ofDrawSphere(handPos.x, handPos.y, handPos.z, 20);
        
        //手の平の向きを描画
        ofSetColor(255, 255, 0);
        ofDrawArrow(handPos, handPos + 100*handNormal);
        
        //5本の指をそれぞれ描画
        for (int f=0; f<5; f++) {
            ofPoint mcp = simpleHands[i].fingers[ fingerTypes[f] ].mcp;  // 関節1
            ofPoint pip = simpleHands[i].fingers[ fingerTypes[f] ].pip;  // 関節2
            ofPoint dip = simpleHands[i].fingers[ fingerTypes[f] ].dip;  // 関節3
            ofPoint tip = simpleHands[i].fingers[ fingerTypes[f] ].tip;  // 指先
            
            //関節と指先を描画
            ofSetColor(0, 255, 0);
            ofDrawSphere(mcp.x, mcp.y, mcp.z, 12);
            ofDrawSphere(pip.x, pip.y, pip.z, 12);
            ofDrawSphere(dip.x, dip.y, dip.z, 12);
            ofDrawSphere(tip.x, tip.y, tip.z, 12);
            
            //線で結ぶ
            ofSetColor(255, 0, 0);
            ofSetLineWidth(20);
            ofDrawLine(mcp.x, mcp.y, mcp.z, pip.x, pip.y, pip.z);
            ofDrawLine(pip.x, pip.y, pip.z, dip.x, dip.y, dip.z);
            ofDrawLine(dip.x, dip.y, dip.z, tip.x, tip.y, tip.z);
        }
    }
    
    cam.end();
    ofDisableDepthTest();
}
Exemplo n.º 23
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofBackgroundGradient(ofColor::skyBlue, colorSlider);


	ofEnableDepthTest();
	sun.enable();
	cam.begin();
	if(loadedMesh.hasMeshes())
	{
		loadedMesh.enableMaterials();
		loadedMesh.enableNormals();
		loadedMesh.enableTextures();
		loadedMesh.enableColors();
		loadedMesh.drawFaces();
		loadedMesh.disableMaterials();
		loadedMesh.disableNormals();
		loadedMesh.disableTextures();
		loadedMesh.disableColors();
	}
	cam.end();
	sun.disable();

	ofDisableDepthTest();
	gui.draw();
}
//--------------------------------------------------------------
void ofApp::draw() {

	ofEnableDepthTest(); 

	cam.begin();
	light.enable(); 

	if (drawGrid)
	{
		ofDrawGrid(200);
	}

	if (drawBox)
	{
		//ofNoFill(); 
		ofSetColor(255,255,255,100);
		ofDrawBox(800, 800, 800);
		ofFill(); 
	}

	ball.draw();
	ball2.draw(); 

	light.disable();
	cam.end(); 
	ofDisableDepthTest(); 
}
Exemplo n.º 25
0
//--------------------------------------------------------------
void ofApp::draw() {

	ofEnableDepthTest();
	cam.begin();
	light.enable();
	if (drawGrid) ofDrawGrid(200);
	if (drawBox) {

		ofNoFill();
		ofSetColor(ofColor::white);
		ofDrawBox( BoxSize_X , BoxSize_Y , BoxSize_Z );
	}
        ball_1.draw();
		ball_2.draw();
		ball_3.draw();
		ball_4.draw();
		ball_5.draw();
		ball_6.draw();
		ball_7.draw();
		ball_8.draw();
		ball_9.draw();
		ball_10.draw();
		light.disable();
		cam.end();
		ofDisableDepthTest();
		
}
Exemplo n.º 26
0
//--------------------------------------------------------------
void ofApp::draw()
{
    // start drawing the 3d scene from the point of view
    // of the camera
    camera.begin();
    
    // enable depth testing so that the box mesh masks
    // the wireframe at the back of the box
    ofEnableDepthTest();
    
    // draw our box mesh in black
    ofSetColor(0);
    boxMesh.draw();
    
    // now draw a the wireframe
    ofSetColor(255);
    wireframeMesh.drawWireframe();
    
    // disable depth testing
    ofDisableDepthTest();
    
    // finish drawing the 3d scene from the point of view
    // of the projector
    camera.end();
}
Exemplo n.º 27
0
//--------------------------------------------------------------
void SceneSurfaceBezier::Draw()
{
	if (!isPlaying)
		startGui.draw();
	else {
		ofEnableDepthTest();
		cam.begin();

		surfaceBezier.Draw();

		ofPushMatrix();
		ofTranslate(surfaceBezier.controlPoints[selectedControlX][selectedControlY]);
		ofFill();
		ofSetColor(ofColor::white);
		ofDrawBox(10);
		ofNoFill();
		ofSetColor(ofColor::black);
		ofDrawBox(10);
		ofPopMatrix();

		cam.end();
		ofDisableDepthTest();

		mainGui.draw();
	}
}
Exemplo n.º 28
0
//--------------------------------------------------------------
void ofApp::drawFboParticles() {

    fboParticles.begin();
    ofClear(255,255,255, 0);
    //----------------------------
    if(gUseLight) {
        ofEnableLighting();
        light.enable();
    }

    if(gUseCam)cam.begin();


    ofEnableDepthTest();
    ofEnableAlphaBlending();

    ///DRAW pair
    pair.drawScene();


    if(gUseCam)cam.end();

    if(gUseLight) {
        light.disable();
        ofDisableLighting();
    }

    ofDisableDepthTest();
    //----------------------------
    fboParticles.end();
}
Exemplo n.º 29
0
//--------------------------------------------------------------
void ofApp::drawScene()
{
    ofPushStyle();
    //billboard and draw the mouse
   //if(oculusRift.isSetup())
    {
        /*
        ofPushMatrix();
        oculusRift.multBillboardMatrix();
        ofSetColor(255, 0, 0);
        ofCircle(0,0,.5);
        ofPopMatrix();
        */
        
        
        ofScale(1, -1, -1);
        //ofTranslate( 0 ,0 ,0);
        
        //ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
        ofEnableDepthTest();
        mesh.draw();
        //kinect.draw(0, 0, 640, 480);
        //kinect.drawDepth(0, 0, 640, 480);
        
        
        ofDisableDepthTest();
        ofPopMatrix();

        
    }
    
    ofPopStyle();
    
}
Exemplo n.º 30
0
void WorldBox::draw(void)
{
    double width = ofGetWidth();
    double height = ofGetHeight();
    
	ofEnableDepthTest();
	ofSetFrameRate(60);
    
    
	//worldCell.setPosition(boxx, boxy, boxz);
    world.setPosition(width/2, height/2, boxz);
    xwing.SetPosition(boxx, boxy, boxz);
    
	//vector<ofMeshFace> triangles = world.getMesh().getUniqueFaces();
    //ofSetColor(255,0,0);
    //world.draw();
    ofSetColor(255,255,255);
    world.drawWireframe();
    
    
    
    ofSetColor(255,0,0);
    worldCell.drawWireframe();
    
    xwing.Draw();
    
	ofDisableDepthTest();
	
}