sphereDetail() \ Language (API) \ Processing 1.0
Author: Casey Reas & Ben Fry
Description: Processing is an electronic sketchbook for developing ideas. It is a context for learning fundamentals of computer programming within the context of the electronic arts.
Keywords: Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas

Reference for Processing version 1.5. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name | ### sphereDetail()
Examples |
    void setup() {
      size(100, 100, P3D);
    }

    void draw() {
      background(200);
      stroke(255, 50);
      translate(50, 50, 0);
      rotateX(mouseY * 0.05);
      rotateY(mouseX * 0.05);
      fill(mouseX * 2, 0, 160);
      sphereDetail(mouseX / 4);
      sphere(40);
    }
Description | Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. The default resolution is 30, which creates a fairly detailed sphere definition with vertices every 360/30 = 12 degrees. If you're going to render a great number of spheres per frame, it is advised to reduce the level of detail using this function. The setting stays active until sphereDetail() is called again with a new parameter and so should not be called prior to every sphere() statement, unless you wish to render spheres with different settings, e.g. using less detail for smaller spheres or ones further away from the camera. To control the detail of the horizontal and vertical resolution independently, use the version of the functions with two parameters.
Syntax |
    sphereDetail(res);
    sphereDetail(ures, vres);
Parameters |
res | int: number of segments (minimum of 3) used per full circle revolution
ures | int: number of segments used longitudinally per full circle revolution
vres | int: number of segments used latitudinally from top to bottom
Returns | None
Usage | Web & Application
Related | sphere()

Updated on August 30, 2010 04:29:39pm EDT