public class PGraphicsOpenGL extends PGraphics
Modifier and Type | Field and Description |
---|---|
static boolean |
anisoSamplingSupported |
static boolean |
autoMipmapGenSupported |
static boolean |
blendEqSupported |
PMatrix3D |
camera |
float |
cameraAspect
Aspect ratio of camera's view.
|
float |
cameraFar
Distance of the near and far planes.
|
float |
cameraFOV
Camera field of view.
|
PMatrix3D |
cameraInv |
float |
cameraNear
Distance of the near and far planes.
|
float |
cameraX
Default position of the camera.
|
float |
cameraY
Default position of the camera.
|
float |
cameraZ
Default position of the camera.
|
float |
currentLightFalloffConstant
Current light falloff
|
float |
currentLightFalloffLinear |
float |
currentLightFalloffQuadratic |
float[] |
currentLightSpecular
Current specular color for lighting
|
PGraphicsOpenGL |
currentPG
The renderer currently in use.
|
float |
defCameraAspect |
float |
defCameraFar |
float |
defCameraFOV
Default camera properties.
|
float |
defCameraNear |
float |
defCameraX |
float |
defCameraY |
float |
defCameraZ |
static int |
depthBits |
static boolean |
drawBufferSupported |
static boolean |
fboMultisampleSupported |
static String |
GLSL_VERSION |
boolean |
initialized
Whether the PGraphics object is ready to render or not.
|
float[] |
lightAmbient
Ambient colors for lights.
|
int |
lightCount |
float[] |
lightDiffuse
Diffuse colors for lights.
|
float[] |
lightFalloffCoefficients
Light falloff
|
float[] |
lightNormal
Light direction (normalized vector)
|
float[] |
lightPosition
Light positions
|
boolean |
lights |
float[] |
lightSpecular
Specular colors for lights.
|
float[] |
lightSpotParameters
Light spot parameters: Cosine of light spot angle
and concentration
|
int[] |
lightType
Light types
|
static float |
maxAnisoAmount |
static int |
maxSamples |
static int |
maxTextureSize
Some hardware limits
|
PMatrix3D |
modelview |
PMatrix3D |
modelviewInv |
static boolean |
npotTexSupported
Extensions used by Processing
|
static String |
OPENGL_EXTENSIONS |
static String |
OPENGL_RENDERER |
static String |
OPENGL_VENDOR
OpenGL information strings
|
static String |
OPENGL_VERSION |
static boolean |
packedDepthStencilSupported |
PGL |
pgl
Interface between Processing and OpenGL
|
PMatrix3D |
projection |
PMatrix3D |
projmodelview |
static boolean |
readBufferSupported |
static int |
stencilBits |
A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, B, backgroundColor, BEEN_LIT, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveDetail, curveTightness, DA, DB, DEFAULT_VERTICES, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, fill, fillColor, G, HAS_NORMAL, image, imageMode, normalX, normalY, normalZ, NX, NY, NZ, pixelCount, R, rectMode, SA, SB, setAmbient, SG, shapeMode, SHINE, shininess, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, SPR, SR, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, SW, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ
ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
PGraphicsOpenGL() |
Modifier and Type | Method and Description |
---|---|
void |
ambientLight(float r,
float g,
float b)
Add an ambient light based on the current color mode.
|
void |
ambientLight(float r,
float g,
float b,
float x,
float y,
float z)
Add an ambient light based on the current color mode.
|
void |
applyMatrix(float n00,
float n01,
float n02,
float n10,
float n11,
float n12) |
void |
applyMatrix(float n00,
float n01,
float n02,
float n03,
float n10,
float n11,
float n12,
float n13,
float n20,
float n21,
float n22,
float n23,
float n30,
float n31,
float n32,
float n33)
Apply a 4x4 transformation matrix to the modelview stack.
|
void |
applyMatrix(PMatrix2D source) |
void |
applyMatrix(PMatrix3D source) |
void |
applyProjection(float n00,
float n01,
float n02,
float n03,
float n10,
float n11,
float n12,
float n13,
float n20,
float n21,
float n22,
float n23,
float n30,
float n31,
float n32,
float n33) |
void |
applyProjection(PMatrix3D mat) |
void |
attrib(String name,
boolean... values) |
void |
attrib(String name,
float... values) |
void |
attrib(String name,
int... values) |
void |
attribColor(String name,
int color) |
void |
attribNormal(String name,
float nx,
float ny,
float nz) |
void |
attribPosition(String name,
float x,
float y,
float z) |
void |
beginCamera()
Set matrix mode to the camera matrix (instead of the current transformation
matrix).
|
void |
beginContour() |
void |
beginDraw()
( begin auto-generated from PGraphics_beginDraw.xml )
Sets the default properties for a PGraphics object.
|
PGL |
beginPGL() |
void |
beginShape(int kind)
( begin auto-generated from beginShape.xml )
Using the beginShape() and endShape() functions allow
creating more complex forms.
|
void |
bezierVertex(float x2,
float y2,
float x3,
float y3,
float x4,
float y4) |
void |
bezierVertex(float x2,
float y2,
float z2,
float x3,
float y3,
float z3,
float x4,
float y4,
float z4)
( begin auto-generated from bezierVertex.xml )
Specifies vertex coordinates for Bezier curves.
|
void |
box(float w,
float h,
float d) |
void |
camera()
Set camera to the default settings.
|
void |
camera(float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
More flexible method for dealing with camera().
|
void |
copy(int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh)
( begin auto-generated from PImage_copy.xml )
Copies a region of pixels from one image into another.
|
void |
copy(PImage src,
int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh) |
PSurface |
createSurface() |
void |
curveVertex(float x,
float y)
( begin auto-generated from curveVertex.xml )
Specifies vertex coordinates for curves.
|
void |
curveVertex(float x,
float y,
float z) |
void |
directionalLight(float r,
float g,
float b,
float dx,
float dy,
float dz)
( begin auto-generated from directionalLight.xml )
Adds a directional light.
|
void |
dispose()
Handle any takedown for this graphics context.
|
void |
ellipseImpl(float a,
float b,
float c,
float d) |
void |
endCamera()
Record the current settings into the camera matrix, and set the matrix mode
back to the current transformation matrix.
|
void |
endContour() |
void |
endDraw()
( begin auto-generated from PGraphics_endDraw.xml )
Finalizes the rendering of a PGraphics object so that it can be shown on screen.
|
void |
endPGL() |
void |
endShape(int mode)
( begin auto-generated from endShape.xml )
The endShape() function is the companion to beginShape()
and may only be called after beginShape().
|
void |
filter(int kind)
This is really inefficient and not a good idea in OpenGL.
|
void |
filter(int kind,
float param)
This is really inefficient and not a good idea in OpenGL.
|
void |
filter(PShader shader) |
void |
flush() |
void |
frustum(float left,
float right,
float bottom,
float top,
float znear,
float zfar)
Same as glFrustum(), except that it wipes out (rather than multiplies
against) the current perspective matrix.
|
int |
get(int x,
int y)
( begin auto-generated from PImage_get.xml )
Reads the color of any pixel or grabs a section of an image.
|
Object |
getCache(PImage image)
Get cache storage data for the specified renderer.
|
FrameBuffer |
getFrameBuffer()
Not an approved function, test its use in libraries to grab the FB objects
for offscreen PGraphics.
|
FrameBuffer |
getFrameBuffer(boolean multi) |
PMatrix |
getMatrix() |
PMatrix3D |
getMatrix(PMatrix3D target)
Copy the current transformation matrix into the specified target.
|
Texture |
getTexture()
Not an approved function, this will change or be removed in the future.
|
Texture |
getTexture(boolean load)
Not an approved function either, don't use it.
|
Texture |
getTexture(PImage img)
Not an approved function, this will change or be removed in the future.
|
void |
hint(int which)
( begin auto-generated from hint.xml )
Set various hints and hacks for the renderer.
|
boolean |
isGL()
Return true if this renderer does rendering through OpenGL.
|
void |
lightFalloff(float constant,
float linear,
float quadratic)
Set the light falloff rates for the last light that was created.
|
void |
lights()
Sets up an ambient and directional light using OpenGL.
|
void |
lightSpecular(float x,
float y,
float z)
Set the specular color of the last light created.
|
void |
line(float x1,
float y1,
float x2,
float y2)
( begin auto-generated from line.xml )
Draws a line (a direct path between two points) to the screen.
|
void |
line(float x1,
float y1,
float z1,
float x2,
float y2,
float z2) |
void |
loadPixels()
( begin auto-generated from PImage_loadPixels.xml )
Loads the pixel data for the image into its pixels[] array.
|
PShader |
loadShader(String fragFilename)
( begin auto-generated from loadShader.xml )
This is a new reference entry for Processing 2.0.
|
PShader |
loadShader(String fragFilename,
String vertFilename) |
PShape |
loadShape(String filename) |
void |
loadTexture() |
void |
mask(PImage alpha)
( begin auto-generated from PImage_mask.xml )
Masks part of an image from displaying by loading another image and
using it as an alpha channel.
|
float |
modelX(float x,
float y,
float z)
( begin auto-generated from modelX.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
float |
modelY(float x,
float y,
float z)
( begin auto-generated from modelY.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
float |
modelZ(float x,
float y,
float z)
( begin auto-generated from modelZ.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
void |
noClip()
( begin auto-generated from noClip.xml )
Disables the clipping previously started by the clip() function.
|
void |
noLights()
Disables lighting.
|
void |
ortho()
Calls ortho() with the proper parameters for Processing's standard
orthographic projection.
|
void |
ortho(float left,
float right,
float bottom,
float top)
Calls ortho() with the specified size of the viewing volume along
the X and Z directions.
|
void |
ortho(float left,
float right,
float bottom,
float top,
float near,
float far)
Sets an orthographic projection.
|
void |
perspective()
Calls perspective() with Processing's standard coordinate projection.
|
void |
perspective(float fov,
float aspect,
float zNear,
float zFar)
Similar to gluPerspective().
|
void |
point(float x,
float y)
( begin auto-generated from point.xml )
Draws a point, a coordinate in space at the dimension of one pixel.
|
void |
point(float x,
float y,
float z) |
void |
pointLight(float r,
float g,
float b,
float x,
float y,
float z)
( begin auto-generated from pointLight.xml )
Adds a point light.
|
void |
popMatrix()
( begin auto-generated from popMatrix.xml )
Pops the current transformation matrix off the matrix stack.
|
void |
popProjection() |
void |
popStyle()
( begin auto-generated from popStyle.xml )
The pushStyle() function saves the current style settings and
popStyle() restores the prior settings; these functions are
always used together.
|
void |
printCamera()
Print the current camera matrix.
|
void |
printMatrix()
Print the current model (or "transformation") matrix.
|
void |
printProjection()
Print the current projection matrix.
|
void |
pushMatrix()
( begin auto-generated from pushMatrix.xml )
Pushes the current transformation matrix onto the matrix stack.
|
void |
pushProjection() |
void |
quad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
( begin auto-generated from quad.xml )
A quad is a quadrilateral, a four sided polygon.
|
void |
quadraticVertex(float cx,
float cy,
float x3,
float y3) |
void |
quadraticVertex(float cx,
float cy,
float cz,
float x3,
float y3,
float z3) |
void |
removeCache(PImage image)
Remove information associated with this renderer from the cache, if any.
|
void |
resetMatrix()
( begin auto-generated from resetMatrix.xml )
Replaces the current matrix with the identity matrix.
|
void |
resetProjection() |
void |
resetShader()
( begin auto-generated from resetShader.xml )
This is a new reference entry for Processing 2.0.
|
void |
resetShader(int kind) |
void |
resize(int wide,
int high)
( begin auto-generated from PImage_resize.xml )
Resize the image to a new width and height.
|
void |
rotate(float angle)
Two dimensional rotation.
|
void |
rotate(float angle,
float v0,
float v1,
float v2)
Rotate around an arbitrary vector, similar to glRotate(), except that it
takes radians (instead of degrees).
|
void |
rotateX(float angle)
( begin auto-generated from rotateX.xml )
Rotates a shape around the x-axis the amount specified by the
angle parameter.
|
void |
rotateY(float angle)
( begin auto-generated from rotateY.xml )
Rotates a shape around the y-axis the amount specified by the
angle parameter.
|
void |
rotateZ(float angle)
( begin auto-generated from rotateZ.xml )
Rotates a shape around the z-axis the amount specified by the
angle parameter.
|
boolean |
save(String filename)
( begin auto-generated from PImage_save.xml )
Saves the image into a file.
|
boolean |
saveImpl(String filename) |
void |
scale(float s)
Same as scale(s, s, s).
|
void |
scale(float sx,
float sy)
Same as scale(sx, sy, 1).
|
void |
scale(float sx,
float sy,
float sz)
Scale in three dimensions.
|
float |
screenX(float x,
float y)
( begin auto-generated from screenX.xml )
Takes a three-dimensional X, Y, Z position and returns the X value for
where it will appear on a (two-dimensional) screen.
|
float |
screenX(float x,
float y,
float z) |
float |
screenY(float x,
float y)
( begin auto-generated from screenY.xml )
Takes a three-dimensional X, Y, Z position and returns the Y value for
where it will appear on a (two-dimensional) screen.
|
float |
screenY(float x,
float y,
float z) |
float |
screenZ(float x,
float y,
float z)
( begin auto-generated from screenZ.xml )
Takes a three-dimensional X, Y, Z position and returns the Z value for
where it will appear on a (two-dimensional) screen.
|
void |
set(int x,
int y,
int argb)
( begin auto-generated from PImage_set.xml )
Changes the color of any pixel or writes an image directly into the
display window.
The x and y parameters specify the pixel to change and the color parameter specifies the color value. |
void |
setCache(PImage image,
Object storage)
Store data of some kind for the renderer that requires extra metadata of
some kind.
|
void |
setMatrix(PMatrix2D source)
Set the current transformation to the contents of the specified source.
|
void |
setMatrix(PMatrix3D source)
Set the current transformation to the contents of the specified source.
|
void |
setParent(PApplet parent) |
void |
setPrimary(boolean primary)
Set (or unset) this as the main drawing surface.
|
void |
setProjection(PMatrix3D mat) |
void |
setSize(int iwidth,
int iheight)
The final step in setting up a renderer, set its size of this renderer.
|
void |
shader(PShader shader)
( begin auto-generated from shader.xml )
This is a new reference entry for Processing 2.0.
|
void |
shader(PShader shader,
int kind) |
void |
shearX(float angle)
( begin auto-generated from shearX.xml )
Shears a shape around the x-axis the amount specified by the
angle parameter.
|
void |
shearY(float angle)
( begin auto-generated from shearY.xml )
Shears a shape around the y-axis the amount specified by the
angle parameter.
|
void |
sphere(float r)
( begin auto-generated from sphere.xml )
A sphere is a hollow ball made from tessellated triangles.
|
void |
spotLight(float r,
float g,
float b,
float x,
float y,
float z,
float dx,
float dy,
float dz,
float angle,
float concentration)
( begin auto-generated from spotLight.xml )
Adds a spot light.
|
void |
strokeCap(int cap)
( begin auto-generated from strokeCap.xml )
Sets the style for rendering line endings.
|
void |
strokeJoin(int join)
( begin auto-generated from strokeJoin.xml )
Sets the style of the joints which connect line segments.
|
void |
strokeWeight(float weight)
( begin auto-generated from strokeWeight.xml )
Sets the width of the stroke used for lines, points, and the border
around shapes.
|
float |
textAscent()
( begin auto-generated from textAscent.xml )
Returns ascent of the current font at its current size.
|
float |
textDescent()
( begin auto-generated from textDescent.xml )
Returns descent of the current font at its current size.
|
void |
textureSampling(int sampling) |
void |
textureWrap(int wrap)
( begin auto-generated from textureWrap.xml )
Description to come...
|
void |
translate(float tx,
float ty)
( begin auto-generated from translate.xml )
Specifies an amount to displace objects within the display window.
|
void |
translate(float tx,
float ty,
float tz) |
void |
triangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
( begin auto-generated from triangle.xml )
A triangle is a plane created by connecting three points.
|
void |
updateDisplay() |
void |
updateProjmodelview() |
void |
updateTexture() |
void |
updateTexture(int x,
int y,
int w,
int h) |
void |
vertex(float x,
float y) |
void |
vertex(float x,
float y,
float z) |
void |
vertex(float x,
float y,
float u,
float v) |
void |
vertex(float x,
float y,
float z,
float u,
float v)
( begin auto-generated from vertex.xml )
All shapes are constructed by connecting a series of vertices.
|
alpha, ambient, ambient, ambient, applyMatrix, arc, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, blendMode, blue, box, brightness, circle, clear, clip, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, createShape, createShape, createShape, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, displayable, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getRaw, getStyle, getStyle, green, haveRaw, hue, image, image, image, imageMode, is2D, is2X, is3D, lerpColor, lerpColor, loadShape, noFill, normal, noSmooth, noStroke, noTexture, noTint, pop, push, pushStyle, rect, rect, rect, rectMode, red, saturation, setMatrix, setPath, shape, shape, shape, shapeMode, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, smooth, smooth, specular, specular, specular, sphereDetail, sphereDetail, square, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textWidth, textWidth, textWidth, tint, tint, tint, tint, tint, tint, vertex
blend, blend, blendColor, clone, copy, get, get, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, init, isLoaded, isModified, mask, set, setLoaded, setLoaded, setModified, setModified, updatePixels, updatePixels
public PGL pgl
public PGraphicsOpenGL currentPG
public boolean initialized
public static boolean npotTexSupported
public static boolean autoMipmapGenSupported
public static boolean fboMultisampleSupported
public static boolean packedDepthStencilSupported
public static boolean anisoSamplingSupported
public static boolean blendEqSupported
public static boolean readBufferSupported
public static boolean drawBufferSupported
public static int maxTextureSize
public static int maxSamples
public static float maxAnisoAmount
public static int depthBits
public static int stencilBits
public static String OPENGL_VENDOR
public static String OPENGL_RENDERER
public static String OPENGL_VERSION
public static String OPENGL_EXTENSIONS
public static String GLSL_VERSION
public float cameraFOV
public float cameraX
public float cameraY
public float cameraZ
public float cameraNear
public float cameraFar
public float cameraAspect
public float defCameraFOV
public float defCameraX
public float defCameraY
public float defCameraZ
public float defCameraNear
public float defCameraFar
public float defCameraAspect
public PMatrix3D projection
public PMatrix3D camera
public PMatrix3D cameraInv
public PMatrix3D modelview
public PMatrix3D modelviewInv
public PMatrix3D projmodelview
public boolean lights
public int lightCount
public int[] lightType
public float[] lightPosition
public float[] lightNormal
public float[] lightAmbient
public float[] lightDiffuse
public float[] lightSpecular
public float[] lightFalloffCoefficients
public float[] lightSpotParameters
public float[] currentLightSpecular
public float currentLightFalloffConstant
public float currentLightFalloffLinear
public float currentLightFalloffQuadratic
public void setPrimary(boolean primary)
PGraphics
setPrimary
in class PGraphics
public void setSize(int iwidth, int iheight)
PGraphics
public void dispose()
PGraphics
This is called when a sketch is shut down and this renderer was specified using the size() command, or inside endRecord() and endRaw(), in order to shut things off.
public PSurface createSurface()
createSurface
in class PGraphics
public boolean saveImpl(String filename)
public void setCache(PImage image, Object storage)
PGraphics
public Object getCache(PImage image)
PGraphics
public void removeCache(PImage image)
PGraphics
removeCache
in class PGraphics
image
- The image whose cache data should be removedpublic void beginDraw()
PGraphics
public void endDraw()
PGraphics
public void updateProjmodelview()
public void hint(int which)
PGraphics
hint
in class PGraphics
which
- name of the hint to be enabled or disabledPGraphics
,
PApplet.createGraphics(int, int, String, String)
,
PApplet.size(int, int)
public void beginShape(int kind)
PGraphics
beginShape
in class PGraphics
kind
- Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIPPShape
,
PGraphics.endShape()
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.curveVertex(float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
public void endShape(int mode)
PGraphics
endShape
in class PGraphics
mode
- use CLOSE to close the shapePShape
,
PGraphics.beginShape(int)
public void textureWrap(int wrap)
PGraphics
textureWrap
in class PGraphics
wrap
- Either CLAMP (default) or REPEATPGraphics.texture(PImage)
,
PGraphics.textureMode(int)
public void textureSampling(int sampling)
public void beginContour()
beginContour
in class PGraphics
public void endContour()
endContour
in class PGraphics
public void vertex(float x, float y, float z, float u, float v)
PGraphics
vertex
in class PGraphics
x
- x-coordinate of the vertexy
- y-coordinate of the vertexz
- z-coordinate of the vertexu
- horizontal coordinate for the texture mappingv
- vertical coordinate for the texture mappingPGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float, float)
,
PGraphics.texture(PImage)
public void attribPosition(String name, float x, float y, float z)
attribPosition
in class PGraphics
public void attribNormal(String name, float nx, float ny, float nz)
attribNormal
in class PGraphics
public void attribColor(String name, int color)
attribColor
in class PGraphics
public void noClip()
PGraphics
public void bezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)
bezierVertex
in class PGraphics
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
PGraphics
bezierVertex
in class PGraphics
x2
- the x-coordinate of the 1st control pointy2
- the y-coordinate of the 1st control pointz2
- the z-coordinate of the 1st control pointx3
- the x-coordinate of the 2nd control pointy3
- the y-coordinate of the 2nd control pointz3
- the z-coordinate of the 2nd control pointx4
- the x-coordinate of the anchor pointy4
- the y-coordinate of the anchor pointz4
- the z-coordinate of the anchor pointPGraphics.curveVertex(float, float, float)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
public void quadraticVertex(float cx, float cy, float x3, float y3)
quadraticVertex
in class PGraphics
cx
- the x-coordinate of the control pointcy
- the y-coordinate of the control pointx3
- the x-coordinate of the anchor pointy3
- the y-coordinate of the anchor pointPGraphics.curveVertex(float, float, float)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
public void quadraticVertex(float cx, float cy, float cz, float x3, float y3, float z3)
quadraticVertex
in class PGraphics
cz
- the z-coordinate of the control pointz3
- the z-coordinate of the anchor pointpublic void curveVertex(float x, float y)
PGraphics
curveVertex
in class PGraphics
x
- the x-coordinate of the vertexy
- the y-coordinate of the vertexPGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
public void curveVertex(float x, float y, float z)
curveVertex
in class PGraphics
z
- the z-coordinate of the vertexpublic void point(float x, float y)
PGraphics
point
in class PGraphics
x
- x-coordinate of the pointy
- y-coordinate of the pointPGraphics.stroke(int)
public void point(float x, float y, float z)
public void line(float x1, float y1, float x2, float y2)
PGraphics
line
in class PGraphics
x1
- x-coordinate of the first pointy1
- y-coordinate of the first pointx2
- x-coordinate of the second pointy2
- y-coordinate of the second pointPGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
,
PGraphics.beginShape()
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
PGraphics
triangle
in class PGraphics
x1
- x-coordinate of the first pointy1
- y-coordinate of the first pointx2
- x-coordinate of the second pointy2
- y-coordinate of the second pointx3
- x-coordinate of the third pointy3
- y-coordinate of the third pointPApplet.beginShape()
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
PGraphics
quad
in class PGraphics
x1
- x-coordinate of the first cornery1
- y-coordinate of the first cornerx2
- x-coordinate of the second cornery2
- y-coordinate of the second cornerx3
- x-coordinate of the third cornery3
- y-coordinate of the third cornerx4
- x-coordinate of the fourth cornery4
- y-coordinate of the fourth cornerpublic void ellipseImpl(float a, float b, float c, float d)
public void box(float w, float h, float d)
public void sphere(float r)
PGraphics
Implementation notes:
cache all the points of the sphere in a static array top and bottom are just a bunch of triangles that land in the center point
sphere is a series of concentric circles who radii vary along the shape, based on, er.. cos or something
[toxi 031031] new sphere code. removed all multiplies with radius, as scale() will take care of that anyway [toxi 031223] updated sphere code (removed modulos) and introduced sphereAt(x,y,z,r) to avoid additional translate()'s on the user/sketch side [davbol 080801] now using separate sphereDetailU/V
sphere
in class PGraphics
r
- the radius of the spherePGraphics.sphereDetail(int)
public PShape loadShape(String filename)
loadShape
in class PGraphics
filename
- name of file to load, can be .svg or .objPShape
,
PApplet.createShape()
public float textAscent()
PGraphics
textAscent
in class PGraphics
PGraphics.textDescent()
public float textDescent()
PGraphics
textDescent
in class PGraphics
PGraphics.textAscent()
public void pushMatrix()
PGraphics
public void popMatrix()
PGraphics
popMatrix
in class PGraphics
PGraphics.pushMatrix()
public void translate(float tx, float ty)
PGraphics
translate
in class PGraphics
tx
- left/right translationty
- up/down translationPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
public void translate(float tx, float ty, float tz)
public void rotate(float angle)
rotate
in class PGraphics
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PApplet.radians(float)
public void rotateX(float angle)
PGraphics
rotateX
in class PGraphics
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotateY(float angle)
PGraphics
rotateY
in class PGraphics
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotateZ(float angle)
PGraphics
rotateZ
in class PGraphics
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotate(float angle, float v0, float v1, float v2)
public void scale(float s)
scale
in class PGraphics
s
- percentage to scale the objectPGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.translate(float, float, float)
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
public void scale(float sx, float sy)
public void scale(float sx, float sy, float sz)
public void shearX(float angle)
PGraphics
shearX
in class PGraphics
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearY(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
PApplet.radians(float)
public void shearY(float angle)
PGraphics
shearY
in class PGraphics
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearX(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
PApplet.radians(float)
public void resetMatrix()
PGraphics
resetMatrix
in class PGraphics
PGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.applyMatrix(PMatrix)
,
PGraphics.printMatrix()
public void applyMatrix(PMatrix2D source)
applyMatrix
in class PGraphics
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
applyMatrix
in class PGraphics
n00
- numbers which define the 4x4 matrix to be multipliedn01
- numbers which define the 4x4 matrix to be multipliedn02
- numbers which define the 4x4 matrix to be multipliedn10
- numbers which define the 4x4 matrix to be multipliedn11
- numbers which define the 4x4 matrix to be multipliedn12
- numbers which define the 4x4 matrix to be multipliedpublic void applyMatrix(PMatrix3D source)
applyMatrix
in class PGraphics
public void applyMatrix(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
applyMatrix
in class PGraphics
n03
- numbers which define the 4x4 matrix to be multipliedn13
- numbers which define the 4x4 matrix to be multipliedn20
- numbers which define the 4x4 matrix to be multipliedn21
- numbers which define the 4x4 matrix to be multipliedn22
- numbers which define the 4x4 matrix to be multipliedn23
- numbers which define the 4x4 matrix to be multipliedn30
- numbers which define the 4x4 matrix to be multipliedn31
- numbers which define the 4x4 matrix to be multipliedn32
- numbers which define the 4x4 matrix to be multipliedn33
- numbers which define the 4x4 matrix to be multipliedpublic PMatrix3D getMatrix(PMatrix3D target)
PGraphics
public void setMatrix(PMatrix2D source)
PGraphics
public void setMatrix(PMatrix3D source)
public void printMatrix()
printMatrix
in class PGraphics
PGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.resetMatrix()
,
PGraphics.applyMatrix(PMatrix)
public void pushProjection()
public void popProjection()
public void resetProjection()
public void applyProjection(PMatrix3D mat)
public void applyProjection(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
public void setProjection(PMatrix3D mat)
public void beginCamera()
Note that the camera matrix is *not* the perspective matrix, it contains the values of the modelview matrix immediatly after the latter was initialized with ortho() or camera(), or the modelview matrix as result of the operations applied between beginCamera()/endCamera().
beginCamera() specifies that all coordinate transforms until endCamera() should be pre-applied in inverse to the camera transform matrix. Note that this is only challenging when a user specifies an arbitrary matrix with applyMatrix(). Then that matrix will need to be inverted, which may not be possible. But take heart, if a user is applying a non-invertible matrix to the camera transform, then he is clearly up to no good, and we can wash our hands of those bad intentions.
begin/endCamera clauses do not automatically reset the camera transform matrix. That's because we set up a nice default camera transform in setup(), and we expect it to hold through draw(). So we don't reset the camera transform matrix at the top of draw(). That means that an innocuous-looking clause like
beginCamera(); translate(0, 0, 10); endCamera();at the top of draw(), will result in a runaway camera that shoots infinitely out of the screen over time. In order to prevent this, it is necessary to call some function that does a hard reset of the camera transform matrix inside of begin/endCamera. Two options are
camera(); // sets up the nice default camera transform resetMatrix(); // sets up the identity camera transformSo to rotate a camera a constant amount, you might try
beginCamera(); camera(); rotateY(PI / 8); endCamera();
public void endCamera()
Note that this will destroy any settings to scale(), translate(), or whatever, because the final camera matrix will be copied (not multiplied) into the modelview.
endCamera
in class PGraphics
PGraphics.beginCamera()
,
PGraphics.camera(float, float, float, float, float, float, float, float, float)
public void camera()
Processing camera behavior:
Camera behavior can be split into two separate components, camera transformation, and projection. The transformation corresponds to the physical location, orientation, and scale of the camera. In a physical camera metaphor, this is what can manipulated by handling the camera body (with the exception of scale, which doesn't really have a physcial analog). The projection corresponds to what can be changed by manipulating the lens.
We maintain separate matrices to represent the camera transform and projection. An important distinction between the two is that the camera transform should be invertible, where the projection matrix should not, since it serves to map three dimensions to two. It is possible to bake the two matrices into a single one just by multiplying them together, but it isn't a good idea, since lighting, z-ordering, and z-buffering all demand a true camera z coordinate after modelview and camera transforms have been applied but before projection. If the camera transform and projection are combined there is no way to recover a good camera-space z-coordinate from a model coordinate.
Fortunately, there are no functions that manipulate both camera transformation and projection.
camera() sets the camera position, orientation, and center of the scene. It replaces the camera transform with a new one.
The transformation functions are the same ones used to manipulate the modelview matrix (scale, translate, rotate, etc.). But they are bracketed with beginCamera(), endCamera() to indicate that they should apply (in inverse), to the camera transformation matrix.
camera
in class PGraphics
PGraphics.beginCamera()
,
PGraphics.endCamera()
,
PGraphics.frustum(float, float, float, float, float, float)
public void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
The actual call is like gluLookat. Here's the real skinny on what does what:
camera(); or camera(ex, ey, ez, cx, cy, cz, ux, uy, uz);do not need to be called from with beginCamera();/endCamera(); That's because they always apply to the camera transformation, and they always totally replace it. That means that any coordinate transforms done before camera(); in draw() will be wiped out. It also means that camera() always operates in untransformed world coordinates. Therefore it is always redundant to call resetMatrix(); before camera(); This isn't technically true of gluLookat, but it's pretty much how it's used.
Now, beginCamera(); and endCamera(); are useful if you want to move the camera around using transforms like translate(), etc. They will wipe out any coordinate system transforms that occur before them in draw(), but they will not automatically wipe out the camera transform. This means that they should be at the top of draw(). It also means that the following:
beginCamera(); rotateY(PI / 8); endCamera();will result in a camera that spins without stopping. If you want to just rotate a small constant amount, try this:
beginCamera(); camera(); // sets up the default view rotateY(PI / 8); endCamera();That will rotate a little off of the default view. Note that this is entirely equivalent to
camera(); // sets up the default view beginCamera(); rotateY(PI / 8); endCamera();because camera() doesn't care whether or not it's inside a begin/end clause. Basically it's safe to use camera() or camera(ex, ey, ez, cx, cy, cz, ux, uy, uz) as naked calls because they do all the matrix resetting automatically.
camera
in class PGraphics
eyeX
- x-coordinate for the eyeeyeY
- y-coordinate for the eyeeyeZ
- z-coordinate for the eyecenterX
- x-coordinate for the center of the scenecenterY
- y-coordinate for the center of the scenecenterZ
- z-coordinate for the center of the sceneupX
- usually 0.0, 1.0, or -1.0upY
- usually 0.0, 1.0, or -1.0upZ
- usually 0.0, 1.0, or -1.0public void printCamera()
printCamera
in class PGraphics
PGraphics.camera(float, float, float, float, float, float, float, float, float)
public void ortho()
public void ortho(float left, float right, float bottom, float top)
public void ortho(float left, float right, float bottom, float top, float near, float far)
public void perspective()
Projection functions:
This behavior is pretty much familiar from OpenGL, except where functions replace matrices, rather than multiplying against the previous.
perspective
in class PGraphics
public void perspective(float fov, float aspect, float zNear, float zFar)
perspective
in class PGraphics
fov
- field-of-view angle (in radians) for vertical directionaspect
- ratio of width to heightzNear
- z-position of nearest clipping planezFar
- z-position of farthest clipping planepublic void frustum(float left, float right, float bottom, float top, float znear, float zfar)
Implementation based on the explanation in the OpenGL blue book.
frustum
in class PGraphics
left
- left coordinate of the clipping planeright
- right coordinate of the clipping planebottom
- bottom coordinate of the clipping planetop
- top coordinate of the clipping planeznear
- near component of the clipping plane; must be greater than zerozfar
- far component of the clipping plane; must be greater than the near valuePGraphics.camera(float, float, float, float, float, float, float, float, float)
,
PGraphics.beginCamera()
,
PGraphics.endCamera()
,
PGraphics.perspective(float, float, float, float)
public void printProjection()
printProjection
in class PGraphics
PGraphics.camera(float, float, float, float, float, float, float, float, float)
public float screenX(float x, float y)
PGraphics
screenX
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedPGraphics.screenY(float, float, float)
,
PGraphics.screenZ(float, float, float)
public float screenY(float x, float y)
PGraphics
screenY
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedPGraphics.screenX(float, float, float)
,
PGraphics.screenZ(float, float, float)
public float screenX(float x, float y, float z)
public float screenY(float x, float y, float z)
public float screenZ(float x, float y, float z)
PGraphics
screenZ
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.screenX(float, float, float)
,
PGraphics.screenY(float, float, float)
public float modelX(float x, float y, float z)
PGraphics
modelX
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelY(float, float, float)
,
PGraphics.modelZ(float, float, float)
public float modelY(float x, float y, float z)
PGraphics
modelY
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelX(float, float, float)
,
PGraphics.modelZ(float, float, float)
public float modelZ(float x, float y, float z)
PGraphics
modelZ
in class PGraphics
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelX(float, float, float)
,
PGraphics.modelY(float, float, float)
public void popStyle()
PGraphics
popStyle
in class PGraphics
PGraphics.pushStyle()
public void strokeWeight(float weight)
PGraphics
strokeWeight
in class PGraphics
weight
- the weight (in pixels) of the strokePGraphics.stroke(int, float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
public void strokeJoin(int join)
PGraphics
strokeJoin
in class PGraphics
join
- either MITER, BEVEL, ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeCap(int)
public void strokeCap(int cap)
PGraphics
strokeCap
in class PGraphics
cap
- either SQUARE, PROJECT, or ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
PApplet.size(int, int, String, String)
public void lights()
The Lighting Skinny: The way lighting works is complicated enough that it's worth producing a document to describe it. Lighting calculations proceed pretty much exactly as described in the OpenGL red book. Light-affecting material properties: AMBIENT COLOR - multiplies by light's ambient component - for believability this should match diffuse color DIFFUSE COLOR - multiplies by light's diffuse component SPECULAR COLOR - multiplies by light's specular component - usually less colored than diffuse/ambient SHININESS - the concentration of specular effect - this should be set pretty high (20-50) to see really noticeable specularity EMISSIVE COLOR - constant additive color effect Light types: AMBIENT - one color - no specular color - no direction - may have falloff (constant, linear, and quadratic) - may have position (which matters in non-constant falloff case) - multiplies by a material's ambient reflection DIRECTIONAL - has diffuse color - has specular color - has direction - no position - no falloff - multiplies by a material's diffuse and specular reflections POINT - has diffuse color - has specular color - has position - no direction - may have falloff (constant, linear, and quadratic) - multiplies by a material's diffuse and specular reflections SPOT - has diffuse color - has specular color - has position - has direction - has cone angle (set to half the total cone angle) - has concentration value - may have falloff (constant, linear, and quadratic) - multiplies by a material's diffuse and specular reflections Normal modes: All of the primitives (rect, box, sphere, etc.) have their normals set nicely. During beginShape/endShape normals can be set by the user. AUTO-NORMAL - if no normal is set during the shape, we are in auto-normal mode - auto-normal calculates one normal per triangle (face-normal mode) SHAPE-NORMAL - if one normal is set during the shape, it will be used for all vertices VERTEX-NORMAL - if multiple normals are set, each normal applies to subsequent vertices - (except for the first one, which applies to previous and subsequent vertices) Efficiency consequences: There is a major efficiency consequence of position-dependent lighting calculations per vertex. (See below for determining whether lighting is vertex position-dependent.) If there is no position dependency then the only factors that affect the lighting contribution per vertex are its colors and its normal. There is a major efficiency win if 1) lighting is not position dependent 2) we are in AUTO-NORMAL or SHAPE-NORMAL mode because then we can calculate one lighting contribution per shape (SHAPE-NORMAL) or per triangle (AUTO-NORMAL) and simply multiply it into the vertex colors. The converse is our worst-case performance when 1) lighting is position dependent 2) we are in AUTO-NORMAL mode because then we must calculate lighting per-face * per-vertex. Each vertex has a different lighting contribution per face in which it appears. Yuck. Determining vertex position dependency: If any of the following factors are TRUE then lighting is vertex position dependent: 1) Any lights uses non-constant falloff 2) There are any point or spot lights 3) There is a light with specular color AND there is a material with specular color So worth noting is that default lighting (a no-falloff ambient and a directional without specularity) is not position-dependent. We should capitalize. Simon Greenwold, April 2005
lights
in class PGraphics
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.noLights()
public void noLights()
noLights
in class PGraphics
PGraphics.lights()
public void ambientLight(float r, float g, float b)
ambientLight
in class PGraphics
r
- red or hue value (depending on current color mode)g
- green or saturation value (depending on current color mode)b
- blue or brightness value (depending on current color mode)PGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void ambientLight(float r, float g, float b, float x, float y, float z)
ambientLight
in class PGraphics
x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightpublic void directionalLight(float r, float g, float b, float dx, float dy, float dz)
PGraphics
directionalLight
in class PGraphics
r
- red or hue value (depending on current color mode)g
- green or saturation value (depending on current color mode)b
- blue or brightness value (depending on current color mode)dx
- direction along the x-axisdy
- direction along the y-axisdz
- direction along the z-axisPGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void pointLight(float r, float g, float b, float x, float y, float z)
PGraphics
pointLight
in class PGraphics
r
- red or hue value (depending on current color mode)g
- green or saturation value (depending on current color mode)b
- blue or brightness value (depending on current color mode)x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightPGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void spotLight(float r, float g, float b, float x, float y, float z, float dx, float dy, float dz, float angle, float concentration)
PGraphics
spotLight
in class PGraphics
r
- red or hue value (depending on current color mode)g
- green or saturation value (depending on current color mode)b
- blue or brightness value (depending on current color mode)x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightdx
- direction along the x axisdy
- direction along the y axisdz
- direction along the z axisangle
- angle of the spotlight coneconcentration
- exponent determining the center bias of the conePGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.ambientLight(float, float, float, float, float, float)
public void lightFalloff(float constant, float linear, float quadratic)
lightFalloff
in class PGraphics
constant
- constant value or determining fallofflinear
- linear value for determining falloffquadratic
- quadratic value for determining falloffPGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.lightSpecular(float, float, float)
public void lightSpecular(float x, float y, float z)
lightSpecular
in class PGraphics
x
- red or hue value (depending on current color mode)y
- green or saturation value (depending on current color mode)z
- blue or brightness value (depending on current color mode)PGraphics.specular(float, float, float)
,
PGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public boolean isGL()
PGraphics
public void loadPixels()
PImage
loadPixels
in class PImage
public int get(int x, int y)
PImage
If the image is in RGB format (i.e. on a PVideo object), the value will get its high bits set, just to avoid cases where they haven't been set already.
If the image is in ALPHA format, this returns a white with its alpha value set.
This function is included primarily for beginners. It is quite slow because it has to check to see if the x, y that was provided is inside the bounds, and then has to check to see what image type it is. If you want things to be more efficient, access the pixels[] array directly.
get
in class PImage
x
- x-coordinate of the pixely
- y-coordinate of the pixelPApplet.set(int, int, int)
,
PApplet.pixels
,
PApplet.copy(PImage, int, int, int, int, int, int, int, int)
public void set(int x, int y, int argb)
PImage
set
in class PImage
x
- x-coordinate of the pixely
- y-coordinate of the pixelargb
- any value of the color datatypePImage.get(int, int, int, int)
,
PImage.pixels
,
PImage.copy(PImage, int, int, int, int, int, int, int, int)
public boolean save(String filename)
PImage
As of revision 0100, this function requires an absolute path, in order to avoid confusion. To save inside the sketch folder, use the function savePath() from PApplet, or use saveFrame() instead. As of revision 0116, savePath() is not needed if this object has been created (as recommended) via createImage() or createGraphics() or one of its neighbors.
As of revision 0115, when using Java 1.4 and later, you can write
to several formats besides tga and tiff. If Java 1.4 is installed
and the extension used is supported (usually png, jpg, jpeg, bmp,
and tiff), then those methods will be used to write the image.
To get a list of the supported formats for writing, use:
println(javax.imageio.ImageIO.getReaderFormatNames())
To use the original built-in image writers, use .tga or .tif as the extension, or don't include an extension. When no extension is used, the extension .tif will be added to the file name.
The ImageIO API claims to support wbmp files, however they probably require a black and white image. Basic testing produced a zero-length file with no error.
public void loadTexture()
public void updateTexture()
public void updateTexture(int x, int y, int w, int h)
public void updateDisplay()
public void mask(PImage alpha)
PImage
Strictly speaking the "blue" value from the source image is used as the alpha color. For a fully grayscale image, this is correct, but for a color image it's not 100% accurate. For a more accurate conversion, first use filter(GRAY) which will make the image into a "correct" grayscale by performing a proper luminance-based conversion.
public void filter(int kind)
public void filter(int kind, float param)
public void filter(PShader shader)
public void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
PImage
copy
in class PImage
sx
- X coordinate of the source's upper left cornersy
- Y coordinate of the source's upper left cornersw
- source image widthsh
- source image heightdx
- X coordinate of the destination's upper left cornerdy
- Y coordinate of the destination's upper left cornerdw
- destination image widthdh
- destination image heightPGraphics.alpha(int)
,
PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
public void copy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
public Texture getTexture()
public Texture getTexture(boolean load)
public Texture getTexture(PImage img)
img
- the image to have a texture metadata associated to itpublic FrameBuffer getFrameBuffer()
public FrameBuffer getFrameBuffer(boolean multi)
public void resize(int wide, int high)
PImage
resize
in class PImage
wide
- the resized image widthhigh
- the resized image heightPImage.get(int, int, int, int)
public PShader loadShader(String fragFilename)
PGraphics
loadShader
in class PGraphics
fragFilename
- name of fragment shader filepublic PShader loadShader(String fragFilename, String vertFilename)
loadShader
in class PGraphics
vertFilename
- name of vertex shader filepublic void shader(PShader shader)
PGraphics
public void shader(PShader shader, int kind)
public void resetShader()
PGraphics
resetShader
in class PGraphics
public void resetShader(int kind)
resetShader
in class PGraphics
kind
- type of shader, either POINTS, LINES, or TRIANGLES