2010 October 12 / j|d|a|v|i|s|@|c|a|r|l|e|t|o|n|.|e|d|u

**__init__(self)**

Initializes the renderer with its default material settings.

**getBodies(self)**

Returns the renderer's list of Body2Ds, which the user can alter (append, pop, etc.) as desired, as long as they remain compatible with the rendering settings.

**setTextureCoordinateCodes(self, codes)**

Sets the GLSL vertex shader expressions for texture coordinates, to those given in the sequence codes. That is, codes[i] indicates where the texture coordinates for sampler i come from. For example, if codes[0] is the string 'a2', then the bodies must supply 2D texture coordinates as attribute 2. Can refer to uniform and attribute variables. The default is the empty sequence.

**getTextureCoordinateCodes(self)**

Returns the tuple of texture coordinate codes.

**setVaryingCodesSizes(self, codes, sizes)**

Sets the GLSL vertex shader expressions for varying variables, to those given in the sequence codes, with sizes given in the sequence sizes. That is, sizes[i] indicates how many floats are in the ith varying variable and codes[i] indicates how the value of that variable is set. For example, suppose sizes[0] is 3 and codes[0] is 'a2'. Then the bodies supply 3-vectors as attribute 2; these 3-vectors are interpolated and appear in the fragment shader as v0. Can refer to uniform and attribute variables. The default for both codes and sizes is the empty sequence.

**getVaryingCodes(self)**

Returns the tuple of varying variable codes.

**getVaryingSizes(self)**

Returns the tuple of varying variable sizes.

**setVertexCode(self, code)**

Sets the GLSL vertex shader expression for the 4D homogeneous vertex before the viewing and projection transformations. Can refer to uniform and attribute variables. The default is the string 'modelingMatrix * vec4(a0, 0.0, 1.0)', meaning that the bodies' meshes supply 2D vertices as attribute 0.

**getVertexCode(self)**

Returns the vertex code.

**setColorCode(self, code)**

Sets the GLSL fragment shader expression for the RGBA coloration. Can refer to uniform, varying, and sampler variables. The default is the string 'vec4(1.0, 1.0, 1.0, 1.0)', meaning opaque white.

**getColorCode(self)**

Returns the color code.

**pick(self, xy)**

The input xy is a screen coordinate pair (with the origin in the bottom left corner). Returns the index of the body that is topmost at that xy, or None.

**updateShaderPrograms(self, body)**

Rewrites/compiles/links the underlying OpenGL shader programs for drawing and picking. This method is called automatically when a frame is drawn, if the rendering conditions (material codes) have changed since the previous frame. Alternatively, the user can call this method after setting the rendering conditions, if she prefers to choose the Body2D used to construct the shader programs.