ofDocsdocumentation 3d ofSpherePrimitive

ofSpherePrimitive

The ofSpherePrimitive allows you to create an UV sphere, which is a sphere based on UV slices rather than faces like the ofIcoSpherePrimitive. Note this:

IMG

On the left is a UV sphere and on the right is an ICO sphere.

Like all primitives it allows you to set the size (radius), draw it, set positions, etc, as a simple example:


void setup()
{

	sphere.setRadius( width );
}

void draw()
{

	sphere.setPosition(ofGetWidth()*.2, ofGetHeight()*.75, 0);
	sphere.rotate(spinX, 1.0, 0.0, 0.0);
	sphere.rotate(spinY, 0, 1.0, 0.0);

	// get all the faces from the icoSphere, handy when you want to copy
	// individual vertices or tweak them a little ;)
	vector<ofMeshFace

getRadius( )

float getRadius()

getResolution( )

int getResolution()

ofSpherePrimitive( )

ofSpherePrimitive()

ofSpherePrimitive( ... )

ofSpherePrimitive(float radius, int res, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)

set( ... )

void set(float radius, int resolution, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)

setMode( ... )

void setMode(ofPrimitiveMode mode)

setRadius( ... )

void setRadius(float radius)

setResolution( ... )

void setResolution(int res)

~ofSpherePrimitive( )

~ofSpherePrimitive()