Esempio n. 1
0
//--------------------------------------------------------------
void testApp::draw(){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
	ofPushMatrix();
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(0, 0, -200.0f);
	//ofTranslate(ofGetWidth()/2, ofGetHeight()/2, -200);
	
	//the sun 
	ofSetColor(255,255,0);
	ofSphere(0, 0, 0, 15);

	
	//the earth
	glRotatef(rotaE, 0, 1.0f, 0);
	ofSetColor(255);
	glTranslatef(100, 0, 0);          // this moves the coordinate system to move the earth some distance from the sun..
	                                  //use Translate, dont put 100 in the ofSphere(x, y, z,10) below..becoz then the moon will not be circling the earth
	ofSphere(0, 0, 0, 10);
	
	//the moon
	glRotatef(rotaM, 0, 1.0f, 0);
	ofSetColor(255,0,255);
	glTranslatef(60, 0, 0);
	ofSphere(0, 0, 0, 6);
	
	ofPopMatrix();

}
Esempio n. 2
0
//--------------------------------------------------------------
void testApp::draw(){
    
    std::cout << "counter = " << counter << std::endl;
    cam.begin();
    cam.setTarget(origin);
    
    ofNoFill();
    ofSphere(W/2, H/2, 0, radius); //wireframe base sphere
    
    //orbit around z-axis
    ofSetColor(ofColor::black);
    ofSphere(W/2 + radius * cos(counter), H/2 + radius * sin(counter),0, 10);
    
    //orbit around y-axis
    ofSetColor(ofColor::blue);
    ofSphere(W/2 + radius * cos(counter), H/2 ,radius * sin(counter), 10);
    
    //orbit around x-axis
    ofSetColor(ofColor::red);
    ofSphere(W/2, H/2 + radius * cos(counter) ,radius * sin(counter), 10);
    
    //x-axis - center
    ofSetColor(ofColor::red);    
    ofLine(0, H/2, W, H/2);
    
    //y-axis - center
    ofSetColor(ofColor::blue);
    ofLine(W/2, 0, W/2, H);
    
    //z-axis - center //note - this may not appear
    ofSetColor(ofColor::black);
    ofLine(W/2, H/2, -100, W/2, H/2, 100);
    
    cam.end();
}
Esempio n. 3
0
//--------------------------------------------------------------
void testApp::draw() {
    
    ofSetColor(pointLight.getDiffuseColor());
    ofSphere(pointLight.getPosition(), 20.f);
    
    // enable lighting //
    ofEnableLighting();
    // the position of the light must be updated every frame, 
    // call enable() so that it can update itself //
    pointLight.enable();
    material.begin();
    
    if(bDrawWireframe) ofNoFill();
    else ofFill();
    
    ofPushMatrix();
    ofTranslate(center.x, center.y, 0);
    ofRotate(rotation, 0, 0, 1);
	for(int i = 0; i < numSpheres; i++) {
        float angle = TWO_PI / (float)numSpheres * i;
        float x = cos(angle) * radius;
        float y = sin(angle) * radius;
        ofSphere(x, y, -200, sphereRadius);
    }
    ofPopMatrix();
	material.end();
	// turn off lighting //
    ofDisableLighting();
    
    ofSetColor(255, 255, 255);
    ofDrawBitmapString("Draw Wireframe (w) : "+ofToString(bDrawWireframe, 0), 20, 20);
    
}
Esempio n. 4
0
void testApp::draw() {
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	ofBackgroundGradient(ofColor(64), ofColor(0));
    
	easyCam.begin();
	ofScale(1, -1, -1); // orient the point cloud properly
	ofTranslate(0, 0, -1500); // rotate about z = 1500 mm
	for(int i = 0; i < sensors.size(); i++) {
        ofSetColor(ofColor::fromHsb(((int) ofMap(i, 0, sensors.size(), 0, 255) + 40) % 256, 255, 255));
		sensors[i]->drawCloud();
	}
    ofFill();
    ofSetColor(ofxCv::magentaPrint);
    ofSphere(combined, 25);
    ofSetColor(255);
    ofNoFill();
    ofSphere(filtered, 100);
	easyCam.end();
	
	if(showDebug) {
		ofPushMatrix();
		ofTranslate(320, 0);
        float scale = ((float) ofGetHeight() / sensors.size()) / 480;
        ofScale(scale, scale);
		glDisable(GL_DEPTH_TEST);
		for(int i = 0; i < sensors.size(); i++) {
			sensors[i]->drawDebug();
			ofTranslate(0, 480);
		}
		ofPopMatrix();
	}
}
void ofxOceanCamera::drawDebug(){
	
	ofSphere(frontBuoyant, 2);
	ofSphere(backBuoyant, 2);
	ofSphere(leftBuoyant, 2);
	ofSphere(rightBuoyant,2);
	
	ofNode::draw();
}
Esempio n. 6
0
//--------------------------------------------------------------
// draws the length of the joint and locations of pivots, but if bodies are sprung more than the length,
// will not connect all the way //
void ofxBulletJoint::drawJointConstraints() {
	ofVec3f pa = getPivotAWorldPos();
	ofVec3f pb = getPivotBWorldPos();
	
	glBegin(GL_LINES);
		glVertex3f(pa.x, pa.y, pa.z);
		glVertex3f(pb.x, pb.y, pb.z);
	glEnd();
	
	ofSetColor(255, 0, 0);
	ofSphere(pa, .5);
	ofSetColor(0, 0, 255);
	ofSphere(pb, .5);
}
Esempio n. 7
0
void ofxBone::customDraw(){

	

	ofVec3f p1(0);
	ofVec3f p2(0);

	if (tr1::shared_ptr<ofxBone> p = parent.lock()){
		p1 = p1 * p->getGlobalTransformMatrix() * ofMatrix4x4::getInverseOf(getGlobalTransformMatrix());
	} else {
//		ofMatrix4x4 m4 = getGlobalTransformMatrix();
//		p1 = ofVec3f(0) * m4;
		p1 = p1 * ofMatrix4x4::getInverseOf(getGlobalTransformMatrix()) ;
	}
	
	ofSetColor(ofColor::white);
	ofDrawArrow(p1, p2, 4);
	ofSphere(2);
	
	// draw x axis
	ofSetColor(ofColor::red);
	ofLine(0, 0, 0, 10, 0, 0);
	
	// draw y axis
	ofSetColor(ofColor::green);
	ofLine(0, 0, 0, 0, 10, 0);
	
	// draw z axis
	ofSetColor(ofColor::blue);
	ofLine(0, 0, 0, 0, 0, 10);

	
}
Esempio n. 8
0
void Scene::drawLineSkeleton(SkeletonDataObject skeleton)
{
    ofSetColor(255, 255);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HEAD], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_SHOULDER_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_LEFT], skeleton.skeletonPositions[KINECT_SDK_ELBOW_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_RIGHT], skeleton.skeletonPositions[KINECT_SDK_ELBOW_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ELBOW_LEFT], skeleton.skeletonPositions[KINECT_SDK_WRIST_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ELBOW_RIGHT], skeleton.skeletonPositions[KINECT_SDK_WRIST_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_WRIST_LEFT], skeleton.skeletonPositions[KINECT_SDK_HAND_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_WRIST_RIGHT], skeleton.skeletonPositions[KINECT_SDK_HAND_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_SHOULDER_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_CENTRE], skeleton.skeletonPositions[KINECT_SDK_HIP_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_LEFT], skeleton.skeletonPositions[KINECT_SDK_KNEE_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_HIP_RIGHT], skeleton.skeletonPositions[KINECT_SDK_KNEE_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_KNEE_LEFT], skeleton.skeletonPositions[KINECT_SDK_ANKLE_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_KNEE_RIGHT], skeleton.skeletonPositions[KINECT_SDK_ANKLE_RIGHT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ANKLE_LEFT], skeleton.skeletonPositions[KINECT_SDK_FOOT_LEFT]);
    ofLine(skeleton.skeletonPositions[KINECT_SDK_ANKLE_RIGHT], skeleton.skeletonPositions[KINECT_SDK_FOOT_RIGHT]);
    
    for (int i = 0; i < skeleton.skeletonPositions.size(); i++)
    {
        ofVec3f skelPoint = skeleton.skeletonPositions[i];
        ofSetColor(255, 0, 0);
#ifdef TARGET_OSX
        ofDrawSphere(skelPoint.x, skelPoint.y, skelPoint.z, 1);
#else
		ofSphere(skelPoint.x, skelPoint.y, skelPoint.z, 1);
#endif
    }
}
//--------------------------------------------------------------
void ofxParticle::draw(Boolean _wireframe) {

    ofPushStyle();
    ofSetColor(color);
    
    // draw inner sphere
    // with texture on
    texture.begin();
    ofSphere(position.x, position.y, position.z, mass * 1.3);
    texture.end();
    
    // disable depthmask & enable blending
    // to enable some transparency on the
    // 'debris' outer sphere
    glDepthMask(false);
    glEnable(GL_BLEND);
    
    texture.begin();
    texture.transparency(0.5);
    sphere.drawWireframe();
    texture.end();

    glDisable(GL_BLEND);
    glDepthMask(true);
    
    ofPopStyle();

}
Esempio n. 10
0
void BoneNode::draw()
{
	glPushMatrix();
	ofMatrix4x4 mat = getDerivedTransformMatrix();
	glMultMatrixf(mat.getPtr());

	ofSetColor(255, 255, 255);
	ofSphere(.1);

	ofSetColor(255, 0, 0);
	glPushMatrix();
	glScalef(.5, .1, .1);
	glTranslatef(.5, 0, 0);
	ofBox(1);
	glPopMatrix();

	ofSetColor(0, 255, 0);
	glPushMatrix();
	glScalef(.1, .5, .1);
	glTranslatef(0, .5, 0);
	ofBox(1);
	glPopMatrix();

	ofSetColor(0, 0, 255);
	glPushMatrix();
	glScalef(.1, .1, .5);
	glTranslatef(0, 0, .5);
	ofBox(1);
	glPopMatrix();

	glPopMatrix();
}
Esempio n. 11
0
//--------------------------------------------------------------
void myTrackHand::draw(bool bdrawdebug){

	if (bdrawHand) {
	
		ofSetColor(180, 0, 0);
		
		ofNoFill();
		
		//ofPushView();
		
		//ofRotate(-90, 0, 0, 1);
		//ofTranslate(-(_colsmesh*_distsmesh)*0.5, -(_rowsmesh*_distsmesh)*0.5, 0);
		
		ofSphere(position_hand.x, position_hand.y, position_hand.z, 10);
		
		//ofSphere(0, 0, 0, 20);
		
		//ofPopView();
		
		//ofSetColor(255, 255, 255);
		
		ofFill();

	}
	
	//if (bdrawdebug) {
		//ofSetColor(255); // white
		//ofNoFill();
		//ofRect(ofGetWidth()*0.18, -ofGetHeight()*0.02, ofGetWidth()*0.133*0.5, ofGetHeight()*0.1*0.5); // Rel 4:3
	//}
	ofFill();
}
Esempio n. 12
0
//--------------------------------------------------------------
void testApp::draw(){
    float elapsedTime = ofGetElapsedTimef();
    ofSetWindowTitle( ofToString( ofGetFrameRate() ) );
    
    ssao.begin();
    camera.begin();
	
    float step = PI * 2./float(centers.size());
    for(int i=0; i<centers.size(); i++){
        ofSetColor(colors[i]);
        if(i%2){
            ofSphere(centers[i].x, centers[i].y, centers[i].z, 40 + sin( elapsedTime + float(i) * step)*20 );
        }
        else{
            glPushMatrix();
            glTranslatef( centers[i].x, centers[i].y, centers[i].z );
            glRotatef( (elapsedTime*10 +i)*10, sin(i), 0, cos(i) );
            ofBox(0,0,0, 40 + sin( elapsedTime + float(i) * step)*20 );
            glPopMatrix();
        }
    }
    
    camera.end();
    ssao.end();

    ssao.draw();
}
Esempio n. 13
0
//--------------------------------------------------------------
void testApp::draw3d(){
    
    ofClear(255,255,255, 0);
    
    
    // 3D stuff
	cam.begin();
    
    ofPushMatrix();
    ofTranslate(0,0,0);
    ofNoFill();
    ofSetColor(255,255,255);
    
    sBox(0, 0, 0, 150, 150, 150); // outer case
    sBox(0, -144, position.z, 6, 150, 20); // top move bar
    sBox(position.x, position.y, position.z, 50, 50, 50); // aquarium case
    
    ofSetColor(200, 100, 0);
    ofSphere(ofMap(sideCam->blobX, 0, 320, -125, 125), ofMap(sideCam->blobY, 0, 240, -125, 125), ofMap(topCam->blobY, 0, 240, -125, 125), 5);
    
    ofPopMatrix();
	
	cam.end();
     
}
Esempio n. 14
0
void Torso::formatConnections()
{
    // set connection points. These are used to position the axes of the child body parts
    for (int i = 0; i < connectingPointsAbsolute.size(); i++)
    {
        // rotate and position the absolute connection ponts
        connectingPointsAbsolute[i] = connectingPoints[i];
        connectingPointsAbsolute[i].rotate(qangle, ofVec3f(qaxis.x, qaxis.y, qaxis.z));
        connectingPointsAbsolute[i] += *originPoint; //skelJointPos;
    }

	if (isDrawDebug)
	{
		ofPushStyle();
		ofSetColor(0, 0, 255, 255);

#ifdef TARGET_OSX
		ofDrawSphere(connectingPointsAbsolute[0], 5);
#else
		ofSphere(connectingPointsAbsolute[0], 5);
#endif

		ofPopStyle();
	}
}
Esempio n. 15
0
//--------------------------------------------------------------
void testApp::draw(){


	ofSetColor(225);
	string shaderToggle = ( doShader == true ) ? " toggeled on." : "toggeled off." ; 
	ofDrawBitmapString("'s' toggles shader" + shaderToggle, 10, 20);
    
	ofSetColor( 255 , 255 , 255 );
	ofFill();
	
	if( doShader ){
		shader.begin();
			//we want to pass in some varrying values to animate our type / color 
        ofVec2f normalMouse = ofVec2f( (float)mouseX / (float)ofGetWidth() - 0.5f , (float)mouseY / (float)ofGetHeight() - 0.5f ) ;  
        shader.setUniform3f("lightDir",  0.2f , -normalMouse.x * 6.0f , normalMouse.y * 4.0f ) ; 
        shader.setUniform4f("ambient", 0.1f , 0.65f , 0.95f , 1.0f ) ; 

	}
	
		//finally draw some spheres
        ofTranslate ( 0.0f , ofGetHeight()/2.0f , 80.0f ) ; 
        float step = ofGetWidth() / 10.0f ; 
        for ( int i = 0 ; i < 10 ; i++ ) 
        {
            ofTranslate ( step , 0.0f , 0.0f ) ; 
            ofSphere( 0 , 0 , 0 , 40.0f ) ; 
        }
	
	if( doShader ){
		shader.end();
	}
}
Esempio n. 16
0
//--------------------------------------------------------------
void testApp::draw(){
    ofSetWindowTitle(ofToString(ofGetFrameRate()));
    
    ofPushMatrix();
    ofTranslate(ofGetWidth()/2, ofGetHeight());
    ofSetColor(255, 0, 255);
    
    
    vector<Leap::FingerList> fingers = leap.getFingers();
    if (!fingers.empty()) {
        ofLogNotice("finger detected");
        //ofBox(100, -200, 4, 40, 40, 40);
        ofSphere(100,-200,4, 30);
        
        for (int cnt = 0; cnt < fingers.size(); cnt++) {
            for (int fingerNum = 0; fingerNum < fingers[cnt].count(); fingerNum++) {
                Leap::Vector pt = fingers[cnt][fingerNum].tipPosition();
                Leap::Vector vpt = fingers[cnt][fingerNum].tipVelocity();
                pt.x = pt.x*2;
                pt.y = (pt.y * -1)*2;
                pt.z = pt.z *2;
                ofLogNotice("finger number is " + ofToString(cnt) + ofToString(fingerNum));
                //ofSphere(pt.x,pt.y,pt.z, 10);
                ofBox(pt.x, pt.y, pt.z, 10, 10, 10);
                ofLogNotice("position is " + ofToString(pt.x) + " " + ofToString(pt.y) + " " + ofToString(pt.z));
                ofLogNotice("velocity is " + ofToString(vpt.x) + " " + ofToString(vpt.y) + " " + ofToString(vpt.z));
            }
        }
        Leap::Vector tpt = fingers[0][0].tipPosition();
 
        
        
    }
    ofPopMatrix();
}
Esempio n. 17
0
//--------------------------------------------------------------
void testApp::drawScene() {
	glEnable(GL_DEPTH_TEST);
	
	for (int i = 0; i < numObj; i++) {
		ofVec3f pos = objPos[i];
		ofVec4f col = objCol[i];
		int size = objSize[i];
		ofSetColor(col.x, col.y, col.z);
		ofQuaternion qua = objRot[i];
		float rad = 0.0; ofVec3f rvec;
		qua.getRotate(rad, rvec);
		ofPushMatrix();
		ofTranslate(pos.x, pos.y, pos.z);
		ofRotate(ofRadToDeg(rad), rvec.x, rvec.y, rvec.z);
		int typ = objType[i];
		if (typ == 1) { 
			ofSphere(0,0,0, size);
		}else {
			ofBox(0,0,0, size);
		}
		ofPopMatrix();
	}
	
	ofSetColor(255, 255, 255);
}
Esempio n. 18
0
	void Ray::draw() const {
		if (!this->defined)
			return;
	
		ofPushStyle();
		ofEnableSmoothing();
		ofSetColor(color);
	
		ofPushMatrix();
		ofTranslate(s);
		ofSphere(0.01);
		ofPopMatrix();
	
		if (infinite) {
			//'infinite' line
		
			//inner line
			if (width > 2.0f){
				ofPushStyle();
				ofSetLineWidth(1.0f);
				ofSetColor(255,255,255);
				ofLine(s-100*t, s+100*t);
				ofPopStyle();
			}
		
		
			ofSetLineWidth(width==0.0f ? 1.0f : width);
			ofLine(s-1000*t, s+1000*t);
		}
	
		//arrow
		ofDrawArrow(s, s+t);
	
		ofPopStyle();
	}
Esempio n. 19
0
//--------------------------------------------------------------
void testApp::draw(){
    cam.begin();
    ofEnableLighting();
    lightDir1.enable();
    lightDir2.enable();
    lightDir3.enable();
    
    lightAmb.enable();

    whiteMat.begin();

    ofSphere(0,0,0,120);
    ofSphere(sin(timeCode*0.3)*100,sin(timeCode*0.1)*50,sin(timeCode*0.35)*120,70);
    ofSphere(sin(timeCode*0.45)*120,sin(timeCode*0.05)*80,sin(timeCode*0.25)*50,120);
    whiteMat.end();
    cam.end();
}
Esempio n. 20
0
void testApp::drawStars()
{
    ofSetColor(255, 255, 255);
    
    for(int i=0;i<StarPositions.size();i++)
        ofSphere(StarPositions[i], 1);
    
}
Esempio n. 21
0
void Agent::draw( ) 
{
    ofSetColor ( color ) ; 
    trailRibbon.draw() ; 
    ofPushMatrix() ; 
        ofTranslate( position ) ; 
        ofSetColor( color );
        ofSphere( 0 , 0, 0 , thickness/2 ) ; 
        //ofCircle( 0 , 0, 25 ) ; 
    ofPopMatrix() ; 
}
Esempio n. 22
0
void swarm::customDraw(){
	// We run the update ourselves manually. ofNode does
	//  not do this for us.
	update();



	//--
	// Draw particles

	// We use the position of the first
	//  particle as the position of the
	//  light.
	ofPushStyle();
	light.enable();
	light.setPosition(particles[0].position);

	for(int i = 0; i < particles.size(); i++){
		ofPushStyle();
		ofSetColor(particles[i].color);

		ofSphere(particles[i].position, 1.0);

		ofPopStyle();
	}

	light.disable();
	ofDisableLighting();

	//
	//--



	// Render light as white sphere
	ofSetColor(255, 255, 255);
	ofSphere(light.getPosition(), 2.0);
	ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL);
	ofDrawBitmapString(" light", particles[0].position);
	ofPopStyle();
}
void testApp::draw(){

    ofBackground(0);
    for (int i=0;i<v.size();i++) {
        v[i].boundaries();
        v[i].run();
    }
    
    if (debug) {
        ofSetColor(200, 200);
        ofSphere(circleLocation.x,circleLocation.y,circleLocation.z, circleRadius * 0.6);
    }
}
Esempio n. 24
0
void Light::draw() {
    ofPushMatrix();
    ofTranslate(loc);
    if(active)
        ofSetColor(255);
    else
        ofSetColor(0);
    ofDrawBitmapString("Light" + ofToString(lightId),0,12);
    ofDrawBitmapString("x" + ofToString(loc.x) + " y" + ofToString(loc.z),0,0);
    ofScale(10,10,10);
    ofSphere(1);
    ofPopMatrix();
}
Esempio n. 25
0
//--------------------------------------------------------------
void testApp::drawSphere(ofVec3f vector, float radius){
    ofNoFill();
    ofPushMatrix();
    ofPoint point = ofPoint(vector.x, vector.y, vector.z);
    ofTranslate(point);
    ofRotateX(point.x);
    ofRotateY(point.y);
    ofRotateZ(point.z);
    ofSetColor(0xCC, 0, 0, 255);
    ofSphere(radius);
    ofPopMatrix();
    
}
Esempio n. 26
0
void Particle::draw(){
    if( bIsDead ){
        return;
    }
    float agePct = 1.0 - ( (float)age / (float)lifeSpan );
    float dist = sqrt(pos.x*pos.x + pos.y*pos.y);
    int alpha = 255; //ofMap( dist, 0, 400, 255, 50 );
    //cout<<dist<<endl;
    ofColor ballColor = ofColor( 155, 207, 255, alpha);
    float darkness = ofMap( dist, 0, 1000, 250, 0);
    ballColor.setSaturation(darkness);
    ofSetColor(ballColor);
    ofSphere(pos, 20.0* (agePct));
}
Esempio n. 27
0
//--------------------------------------------------------------
void testApp::draw(){
    
   
    //draw the fbos directly
    if (drawFbos) {
        //draw fbo1 contents in the top left
        ofPushMatrix();
        ofTranslate(0, 0);
        fbo1.draw(0, 0);
        ofPopMatrix();

        //draw fbo2 contents in the underneath it
        ofPushMatrix();
        ofTranslate(0, ofGetHeight()/2.0);
        //here we pass the size arguments as well, so oF will scale it to fit
        fbo2.draw(0, 0, ofGetWidth()/2.0, ofGetHeight()/2.0);
        ofPopMatrix();

        //draw main fbo
        ofPushMatrix();
        ofTranslate(ofGetWidth()/2.0, 0);
        Mainfbo.draw(0,0);
        ofPopMatrix();
        
        //Pointeur souris
        ofFill();
        ofSetColor(255, 0, 0);
        ofSphere(ofGetMouseX(), ofGetMouseY(), 5);
        
        //draw some borders
        ofSetColor(255);
        ofSetLineWidth(3);
        ofLine(ofGetWidth()/2.0, 0, ofGetWidth()/2.0, ofGetHeight());
        ofLine(0, ofGetHeight()/2.0, ofGetWidth()/2.0, ofGetHeight()/2.0);
    } else {
        
        //or you can use getTextureReference() and bind the fbo contents
        //to use as a texture.
        //you will need texture coordinates set in your mesh for this to work

        ofClear(30);
        cam.begin();
        Mainfbo.getTextureReference().bind();
        mesh1.draw();
        Mainfbo.getTextureReference().unbind();
        cam.end();

    }
}
//----------------------------------------
void ofLight::customDraw() {
    ofPushMatrix();
    glMultMatrixf(getGlobalTransformMatrix().getPtr());
    if(getIsPointLight()) {
        ofSphere( 0,0,0, 10);
    } else if (getIsSpotlight()) {
        float coneHeight = (sin(spotCutOff*DEG_TO_RAD) * 30.f) + 1;
        float coneRadius = (cos(spotCutOff*DEG_TO_RAD) * 30.f) + 8;
        ofCone(0, 0, -(coneHeight*.5), coneHeight, coneRadius);
    } else {
        ofBox(10);
    }
    ofDrawAxis(20);
    ofPopMatrix();
}
void testApp::draw(){
	ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
	// カメラ開始
	cam.begin();
	// 描画色を設定
	ofSetHexColor(0xffffff);
	// 塗り潰し無し(ワイヤーフレーム)
	ofNoFill();
	// 立方体の描画
	ofBox(-150, 0, 0, 200);
	// 球体の描画
	ofSphere(150, 0, 0, 100);
	//カメラ終了
	cam.end();
}
void Planet::draw() {
    // dit zorgt er voor dat de texture passend gescaled wordt
    glMatrixMode(GL_TEXTURE);
    glPushMatrix();
    ofScale(image.getWidth(),image.getHeight());
    glMatrixMode(GL_MODELVIEW);

    ofSetColor(red,green,blue);
    image.bind();
    ofRotate(rotation*rotateSpeed);
    ofSphere(distance,0,0,30);

    // dit maakt de texture-schaal-instellingen van boven weer ongedaan
    glMatrixMode(GL_TEXTURE);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
}