Beispiel #1
0
void texturedRect(float width, float height) {
	if(texturedRectMesh.getNumVertices() == 0) {
		texturedRectMesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
		texturedRectMesh.addTexCoord(ofVec2f(0, 0));
		texturedRectMesh.addVertex(ofVec2f(0, 0));
		texturedRectMesh.addTexCoord(ofVec2f(0, 1));
		texturedRectMesh.addVertex(ofVec2f(0, 1));
		texturedRectMesh.addTexCoord(ofVec2f(1, 0));
		texturedRectMesh.addVertex(ofVec2f(1, 0));
		texturedRectMesh.addTexCoord(ofVec2f(1, 1));
		texturedRectMesh.addVertex(ofVec2f(1, 1));
	}
	ofPushMatrix();
	ofScale(width, height);
	texturedRectMesh.drawFaces();
	ofPopMatrix();
}
//----------------------------------------
void ofxSphere(float radius) {
	
	if( sphereScratchMesh.getNumVertices() == 0 ||
	   !lastGeneratedSphereParams.equals( radius, currentSphereParams.numRings, currentSphereParams.numSegments ) ){
		
		ofGenerateSphereMesh( sphereScratchMesh, radius, currentSphereParams.numRings, currentSphereParams.numSegments );
		
		// Save the parameters of what we just generated
		lastGeneratedSphereParams.radius = radius;
		lastGeneratedSphereParams.numRings = currentSphereParams.numRings;
		lastGeneratedSphereParams.numSegments = currentSphereParams.numSegments;
	}
    
	if(ofGetStyle().bFill) {
		sphereScratchMesh.drawFaces();
	} else {
		sphereScratchMesh.drawWireframe(); // this won't really work, but leave it in for now.		
	}
    
}