- java.lang.Object
-
- processing.core.PImage
-
- processing.core.PGraphics
-
- processing.opengl.PGraphicsOpenGL
-
- All Implemented Interfaces:
Cloneable,PConstants
- Direct Known Subclasses:
PGraphics2D,PGraphics3D
public abstract class PGraphicsOpenGL extends PGraphics
OpenGL renderer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classPGraphicsOpenGL.AsyncPixelReaderprotected static classPGraphicsOpenGL.AttributeMapprotected static classPGraphicsOpenGL.DepthSorterprotected static classPGraphicsOpenGL.GLResourceFrameBufferprotected static classPGraphicsOpenGL.GLResourceShaderprotected static classPGraphicsOpenGL.GLResourceTextureprotected static classPGraphicsOpenGL.GLResourceVertexBufferprotected static classPGraphicsOpenGL.IndexCacheprotected static classPGraphicsOpenGL.InGeometryprotected static classPGraphicsOpenGL.Tessellatorprotected static classPGraphicsOpenGL.TessGeometryprotected static classPGraphicsOpenGL.TexCacheprotected static classPGraphicsOpenGL.VertexAttribute-
Nested classes/interfaces inherited from class processing.core.PGraphics
PGraphics.AsyncImageSaver
-
-
Field Summary
Fields Modifier and Type Field Description static booleananisoSamplingSupportedprotected PGraphicsOpenGL.AsyncPixelReaderasyncPixelReaderprotected booleanasyncPixelReaderInitializedstatic booleanautoMipmapGenSupportedstatic booleanblendEqSupportedprotected booleanbreakShapeprotected VertexBufferbufLineAttribprotected VertexBufferbufLineColorprotected VertexBufferbufLineIndexprotected VertexBufferbufLineVertexprotected VertexBufferbufPointAttribprotected VertexBufferbufPointColorprotected VertexBufferbufPointIndexprotected VertexBufferbufPointVertexprotected VertexBufferbufPolyAmbientprotected VertexBufferbufPolyColorprotected VertexBufferbufPolyEmissiveprotected VertexBufferbufPolyIndexprotected VertexBufferbufPolyNormalprotected VertexBufferbufPolyShininessprotected VertexBufferbufPolySpecularprotected VertexBufferbufPolyTexcoordprotected VertexBufferbufPolyVertexPMatrix3DcamerafloatcameraAspectAspect ratio of camera's view.floatcameraFarDistance of the near and far planes.floatcameraFOVCamera field of view.PMatrix3DcameraInvprotected float[][]cameraInvStackInverse camera matrix stackfloatcameraNearDistance of the near and far planes.protected float[][]cameraStackCamera matrix stackfloatcameraXDefault position of the camera.floatcameraYDefault position of the camera.floatcameraZDefault position of the camera.protected booleanclipprotected int[]clipRectClipping rectangle.protected FrameBuffercurrentFramebufferfloatcurrentLightFalloffConstantCurrent light fallofffloatcurrentLightFalloffLinearfloatcurrentLightFalloffQuadraticfloat[]currentLightSpecularCurrent specular color for lightingPGraphicsOpenGLcurrentPGThe renderer currently in use.protected booleandefaultEdgesfloatdefCameraAspectfloatdefCameraFarfloatdefCameraFOVDefault camera properties.floatdefCameraNearfloatdefCameraXfloatdefCameraYfloatdefCameraZprotected PShaderdefColorShaderprotected static URLdefColorShaderFragURLprotected static URLdefColorShaderVertURLprotected PShaderdefLightShaderprotected static URLdefLightShaderFragURLprotected static URLdefLightShaderVertURLprotected PShaderdefLineShaderprotected static URLdefLineShaderFragURLprotected static URLdefLineShaderVertURLprotected PShaderdefPointShaderprotected static URLdefPointShaderFragURLprotected static URLdefPointShaderVertURLprotected PShaderdefTexlightShaderprotected static URLdefTexlightShaderFragURLprotected static URLdefTexlightShaderVertURLprotected PShaderdefTextureShaderprotected static URLdefTextureShaderFragURLprotected static URLdefTextureShaderVertURLstatic intdepthBitsstatic booleandrawBufferSupportedprotected FrameBufferdrawFramebufferprotected booleandrawingTrue if we are inside a beginDraw()/endDraw() block.protected static intEDGE_CLOSEprotected static intEDGE_MIDDLEprotected static intEDGE_SINGLEprotected static intEDGE_STARTprotected static intEDGE_STOPprotected floateyeDistDistance between camera eye and center.protected static intFB_STACK_DEPTHstatic booleanfboMultisampleSupportedprotected FrameBuffer[]fbStackprotected intfbStackDepthprotected PImagefilterImagePImage that wraps filterTexture.protected TexturefilterTexturetexture used to apply a filter on the screen image.protected static FloatBufferfloatBufferprotected static intFLUSH_CONTINUOUSLYFlush modes: continuously (geometry is flushed after each call to endShape) when-full (geometry is accumulated until a maximum size is reached.protected static intFLUSH_WHEN_FULLprotected intflushModeCurrent flush mode.protected WeakHashMap<PFont,processing.opengl.FontTexture>fontMapFont cache for texture objects.protected float[]glModelviewprotected float[]glNormalprotected static booleanglParamsReadprotected float[]glProjectionprotected float[]glProjmodelviewstatic StringGLSL_VERSIONprotected static PMatrix3Didentityprotected static intIMMEDIATEType of geometry: immediate is that generated with beginShape/vertex/ endShape, retained is the result of creating a PShapeOpenGL object with createShape.protected PGraphicsOpenGL.InGeometryinGeoprotected static intINIT_INDEX_BUFFER_SIZEprotected static intINIT_VERTEX_BUFFER_SIZEbooleaninitializedWhether the PGraphics object is ready to render or not.protected static IntBufferintBufferTo get data from OpenGL.protected booleanisDepthSortingEnabledprotected intlastBlendModeUsed to avoid flushing the geometry when blendMode() is called with the same blend mode as the lastprotected intlastSmoothCallfloat[]lightAmbientAmbient colors for lights.intlightCountfloat[]lightDiffuseDiffuse colors for lights.float[]lightFalloffCoefficientsLight fallofffloat[]lightNormalLight direction (normalized vector)float[]lightPositionLight positionsbooleanlightsfloat[]lightSpecularSpecular colors for lights.float[]lightSpotParametersLight spot parameters: Cosine of light spot angle and concentrationint[]lightTypeLight typesprotected intlineBuffersContextprotected booleanlineBuffersCreatedprotected PShaderlineShaderprotected booleanmanipulatingCameraFlag to indicate that we are inside beginCamera/endCamera block.protected PShadermaskShaderprotected static URLmaskShaderFragURLprotected static intMATRIX_STACK_DEPTHprotected static intMAX_POINT_ACCURACYstatic floatmaxAnisoAmountstatic intmaxSamplesstatic intmaxTextureSizeSome hardware limitsprotected static intMIN_POINT_ACCURACYUsed in round point and ellipse tessellation.PMatrix3DmodelviewPMatrix3DmodelviewInvprotected float[][]modelviewInvStackInverse modelview matrix stackprotected float[][]modelviewStackModelview matrix stackprotected intmodelviewStackDepthprotected FrameBuffermultisampleFramebufferprotected IntBuffernativePixelBufferIntBuffer wrapping the native pixels array.protected int[]nativePixelsArray to store pixels in OpenGL format.static booleannpotTexSupportedExtensions used by Processingprotected FrameBufferoffscreenFramebufferprotected booleanoffscreenMultisampleprotected static Set<PGraphicsOpenGL.AsyncPixelReader>ongoingPixelTransfersprotected static List<PGraphicsOpenGL.AsyncPixelReader>ongoingPixelTransfersIterableprotected static intOP_NONEType of pixels operation.protected static intOP_READprotected static intOP_WRITEprotected booleanopenContourstatic StringOPENGL_EXTENSIONSstatic StringOPENGL_RENDERERstatic StringOPENGL_VENDOROpenGL information stringsstatic StringOPENGL_VERSIONstatic booleanpackedDepthStencilSupportedPGLpglInterface between Processing and OpenGLprotected IntBufferpixelBufferIntBuffer wrapping the pixels array.protected intpixelsOpprotected booleanpixOpChangedFBprotected static floatPOINT_ACCURACY_FACTORprotected intpointBuffersContextprotected booleanpointBuffersCreatedprotected PShaderpointShaderprotected PGraphicsOpenGL.AttributeMappolyAttribsprotected intpolyBuffersContextprotected booleanpolyBuffersCreatedprotected PShaderpolyShaderPMatrix3Dprojectionprotected float[][]projectionStackProjection matrix stackprotected intprojectionStackDepthPMatrix3Dprojmodelviewprotected TextureptextureTexture containing the previous frameprotected static float[][]QUAD_POINT_SIGNSUsed in quad point tessellation.static booleanreadBufferSupportedprotected FrameBufferreadFramebufferprotected static intRETAINEDprotected booleansizedMarks when changes to the size have occurred, so that the camera will be reset in beginDraw().protected intsmoothCallCountprotected booleansmoothDisabledUsed to detect continuous use of the smooth/noSmooth functionsprotected PGraphicsOpenGL.DepthSortersorterstatic intstencilBitsprotected PGraphicsOpenGL.Tessellatortessellatorprotected PGraphicsOpenGL.TessGeometrytessGeoprotected PGraphicsOpenGL.TexCachetexCacheprotected TexturetextureTexture containing the current frameprotected inttextureSamplingprotected inttextureWrapprotected IntBufferviewportViewport dimensions.-
Fields inherited from class processing.core.PGraphics
A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, asyncImageSaver, autoNormal, B, backgroundA, backgroundAi, backgroundAlpha, backgroundB, backgroundBi, backgroundColor, backgroundG, backgroundGi, backgroundR, backgroundRi, BEEN_LIT, bezierBasisInverse, bezierBasisMatrix, bezierDetail, bezierDrawMatrix, bezierInited, blendMode, cacheMap, calcA, calcAi, calcAlpha, calcB, calcBi, calcColor, calcG, calcGi, calcR, calcRi, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, cosLUT, curveBasisMatrix, curveDetail, curveDrawMatrix, curveInited, curveTightness, curveToBezierMatrix, curveVertexCount, curveVertices, DA, DB, DEFAULT_STROKE_CAP, DEFAULT_STROKE_JOIN, DEFAULT_STROKE_WEIGHT, DEFAULT_VERTICES, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, fill, fillA, fillAi, fillAlpha, fillB, fillBi, fillColor, fillG, fillGi, fillR, fillRi, G, HAS_NORMAL, hints, image, imageMode, NORMAL_MODE_AUTO, NORMAL_MODE_SHAPE, NORMAL_MODE_VERTEX, normalMode, normalX, normalY, normalZ, NX, NY, NZ, path, pixelCount, primaryGraphics, R, raw, reapplySettings, rectMode, SA, SB, setAmbient, settingsInited, SG, shape, shapeMode, SHINE, shininess, SINCOS_LENGTH, SINCOS_PRECISION, sinLUT, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, sphereX, sphereY, sphereZ, SPR, SR, stroke, strokeA, strokeAi, strokeAlpha, strokeB, strokeBi, strokeCap, strokeColor, strokeG, strokeGi, strokeJoin, strokeR, strokeRi, strokeWeight, surface, SW, textAlign, textAlignY, textBreakCount, textBreakStart, textBreakStop, textBuffer, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, textWidthBuffer, tint, tintA, tintAi, tintAlpha, tintB, tintBi, tintColor, tintG, tintGi, tintR, tintRi, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, vertexCount, vertices, VW, VX, VY, VZ, warnings
-
Fields inherited from class processing.core.PImage
ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, modified, mx1, mx2, my1, my2, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, saveImageFormats, width
-
Fields inherited from interface processing.core.PConstants
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 Summary
Constructors Constructor Description PGraphicsOpenGL()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected TextureaddTexture(PImage img)This utility method creates a texture for the provided image, and adds it to the metadata cache of the image.protected TextureaddTexture(PImage img, Texture.Parameters params)protected voidallocatePixels()voidambientLight(float r, float g, float b)Add an ambient light based on the current color mode.voidambientLight(float r, float g, float b, float x, float y, float z)Add an ambient light based on the current color mode.voidapplyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)voidapplyMatrix(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.voidapplyMatrix(PMatrix2D source)voidapplyMatrix(PMatrix3D source)protected voidapplyMatrixImpl(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)voidapplyProjection(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)voidapplyProjection(PMatrix3D mat)protected voidarcImpl(float x, float y, float w, float h, float start, float stop, int mode)Start and stop are in radians, converted by the parent function.voidattrib(String name, boolean... values)voidattrib(String name, float... values)voidattrib(String name, int... values)voidattribColor(String name, int color)protected PGraphicsOpenGL.VertexAttributeattribImpl(String name, int kind, int type, int size)voidattribNormal(String name, float nx, float ny, float nz)voidattribPosition(String name, float x, float y, float z)protected voidawaitAsyncSaveCompletion(String filename)If there is running async save task for this file, blocks until it completes.protected voidbackgroundImpl()Actual implementation of clearing the background, now that the internal variables for background color have been set.protected voidbackgroundImpl(PImage image)Actually set the background image.protected voidbegin2D()protected voidbeginBindFramebuffer(int target, int framebuffer)voidbeginCamera()Set matrix mode to the camera matrix (instead of the current transformation matrix).voidbeginContour()voidbeginDraw()( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object.protected voidbeginOffscreenDraw()protected voidbeginOnscreenDraw()PGLbeginPGL()protected voidbeginPixelsOp(int op)protected voidbeginReadPixels()voidbeginShape(int kind)( begin auto-generated from beginShape.xml ) Using the beginShape() and endShape() functions allow creating more complex forms.voidbezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)voidbezierVertex(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.protected voidbezierVertexImpl(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)protected voidbindFrontTexture()protected voidblendModeImpl()Allows to set custom blend modes for the entire scene, using openGL.voidbox(float w, float h, float d)voidcamera()Set camera to the default settings.voidcamera(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().protected booleancheckGLThread()protected voidcheckSettings()protected voidcheckTexture(Texture tex)protected voidclipImpl(float x1, float y1, float x2, float y2)protected static voidcompleteAllPixelTransfers()protected static voidcompleteFinishedPixelTransfers()voidcopy(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.voidcopy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)protected voidcreateLineBuffers()protected abstract PGLcreatePGL(PGraphicsOpenGL pg)protected voidcreatePointBuffers()protected voidcreatePolyBuffers()protected voidcreatePTexture()protected PShapecreateShapeFamily(int type)Override this method to return an appropriate shape for your rendererprotected PShapecreateShapePrimitive(int kind, float... p)Override this to have a custom shape object used by your renderer.abstract PSurfacecreateSurface()voidcurveVertex(float x, float y)( begin auto-generated from curveVertex.xml ) Specifies vertex coordinates for curves.voidcurveVertex(float x, float y, float z)protected voidcurveVertexImpl(float x, float y, float z)protected voiddefaultCamera()protected voiddefaultPerspective()protected voiddefaultSettings()Set engine's default values.protected voiddeleteSurfaceTextures()protected static booleandiff(float a, float b)voiddirectionalLight(float r, float g, float b, float dx, float dy, float dz)( begin auto-generated from directionalLight.xml ) Adds a directional light.protected voiddisableLighting()voiddispose()Handle any takedown for this graphics context.protected voiddrawPixels(int x, int y, int w, int h)protected voiddrawPTexture()protected voiddrawTexture()protected voiddrawTexture(int x, int y, int w, int h)voidellipseImpl(float a, float b, float c, float d)protected voidenableLighting()protected voidend2D()protected voidendBindFramebuffer(int target, int framebuffer)voidendCamera()Record the current settings into the camera matrix, and set the matrix mode back to the current transformation matrix.voidendContour()voidendDraw()( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen.protected voidendOffscreenDraw()protected voidendOnscreenDraw()voidendPGL()protected voidendPixelsOp()protected voidendReadPixels()voidendShape(int mode)( begin auto-generated from endShape.xml ) The endShape() function is the companion to beginShape() and may only be called after beginShape().protected voidendShape(int[] indices)protected static intexpandArraySize(int currSize, int newMinSize)protected voidfillFromCalc()voidfilter(int kind)This is really inefficient and not a good idea in OpenGL.voidfilter(int kind, float param)This is really inefficient and not a good idea in OpenGL.voidfilter(PShader shader)voidflush()protected voidflushLines()protected voidflushPixels()protected voidflushPoints()protected voidflushPolys()protected voidflushSortedPolys()voidfrustum(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.intget(int x, int y)( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image.ObjectgetCache(PImage image)Get cache storage data for the specified renderer.protected FrameBuffergetCurrentFB()protected PGraphicsOpenGLgetCurrentPG()protected processing.opengl.FontTexturegetFontTexture(PFont font)FrameBuffergetFrameBuffer()Not an approved function, test its use in libraries to grab the FB objects for offscreen PGraphics.FrameBuffergetFrameBuffer(boolean multi)protected voidgetGLParameters()protected booleangetHint(int which)protected voidgetImpl(int sourceX, int sourceY, int sourceWidth, int sourceHeight, PImage target, int targetX, int targetY)Internal function to actually handle getting a block of pixels that has already been properly cropped to a valid region.protected PShadergetLineShader()PMatrixgetMatrix()PMatrix3DgetMatrix(PMatrix3D target)Copy the current transformation matrix into the specified target.protected PShadergetPointShader()protected PShadergetPolyShader(boolean lit, boolean tex)protected PGraphicsOpenGLgetPrimaryPG()protected PGLgetPrimaryPGL()TexturegetTexture()Not an approved function, this will change or be removed in the future.TexturegetTexture(boolean load)Not an approved function either, don't use it.TexturegetTexture(PImage img)Not an approved function, this will change or be removed in the future.protected voidhandleTextSize(float size)Sets the actual size.voidhint(int which)( begin auto-generated from hint.xml ) Set various hints and hacks for the renderer.protected ObjectinitCache(PImage img)protected voidinitOffscreen()protected voidinitPrimary()protected static voidinvRotate(PMatrix2D matrix, float angle)protected static voidinvRotate(PMatrix3D matrix, float angle, float v0, float v1, float v2)protected static voidinvScale(PMatrix2D matrix, float x, float y)protected static voidinvScale(PMatrix3D matrix, float x, float y, float z)protected static voidinvTranslate(PMatrix2D matrix, float tx, float ty)protected static voidinvTranslate(PMatrix3D matrix, float tx, float ty, float tz)booleanisGL()Return true if this renderer does rendering through OpenGL.protected voidlightAmbient(int num, float r, float g, float b)protected voidlightDiffuse(int num, float r, float g, float b)voidlightFalloff(float constant, float linear, float quadratic)Set the light falloff rates for the last light that was created.protected voidlightFalloff(int num, float c0, float c1, float c2)protected voidlightNormal(int num, float dx, float dy, float dz)protected voidlightPosition(int num, float x, float y, float z, boolean dir)voidlights()Sets up an ambient and directional light using OpenGL.voidlightSpecular(float x, float y, float z)Set the specular color of the last light created.protected voidlightSpecular(int num, float r, float g, float b)protected voidlightSpot(int num, float angle, float exponent)voidline(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.voidline(float x1, float y1, float z1, float x2, float y2, float z2)protected booleanlineBufferContextIsOutdated()protected voidlineImpl(float x1, float y1, float z1, float x2, float y2, float z2)voidloadPixels()( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array.PShaderloadShader(String fragFilename)( begin auto-generated from loadShader.xml ) This is a new reference entry for Processing 2.0.PShaderloadShader(String fragFilename, String vertFilename)PShapeloadShape(String filename)voidloadTexture()protected voidloadTextureImpl(int sampling, boolean mipmap)voidmask(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.protected static floatmatrixScale(PMatrix matrix)floatmodelX(float x, float y, float z)( begin auto-generated from modelX.xml ) Returns the three-dimensional X, Y, Z position in model space.floatmodelY(float x, float y, float z)( begin auto-generated from modelY.xml ) Returns the three-dimensional X, Y, Z position in model space.floatmodelZ(float x, float y, float z)( begin auto-generated from modelZ.xml ) Returns the three-dimensional X, Y, Z position in model space.protected static PGraphicsOpenGL.AttributeMapnewAttributeMap()protected static PGraphicsOpenGL.InGeometrynewInGeometry(PGraphicsOpenGL pg, PGraphicsOpenGL.AttributeMap attr, int mode)protected static PGraphicsOpenGL.TessGeometrynewTessGeometry(PGraphicsOpenGL pg, PGraphicsOpenGL.AttributeMap attr, int mode)protected static PGraphicsOpenGL.TexCachenewTexCache(PGraphicsOpenGL pg)voidnoClip()( begin auto-generated from noClip.xml ) Disables the clipping previously started by the clip() function.protected voidnoLightAmbient(int num)protected voidnoLightDiffuse(int num)protected voidnoLightFalloff(int num)voidnoLights()Disables lighting.protected voidnoLightSpecular(int num)protected voidnoLightSpot(int num)protected booleannonOrthoProjection()protected static booleannonZero(float a)voidortho()Calls ortho() with the proper parameters for Processing's standard orthographic projection.voidortho(float left, float right, float bottom, float top)Calls ortho() with the specified size of the viewing volume along the X and Z directions.voidortho(float left, float right, float bottom, float top, float near, float far)Sets an orthographic projection.protected booleanorthoProjection()voidperspective()Calls perspective() with Processing's standard coordinate projection.voidperspective(float fov, float aspect, float zNear, float zFar)Similar to gluPerspective().voidpoint(float x, float y)( begin auto-generated from point.xml ) Draws a point, a coordinate in space at the dimension of one pixel.voidpoint(float x, float y, float z)protected booleanpointBuffersContextIsOutdated()protected voidpointImpl(float x, float y, float z)voidpointLight(float r, float g, float b, float x, float y, float z)( begin auto-generated from pointLight.xml ) Adds a point light.protected booleanpolyBuffersContextIsOutdated()protected voidpopFramebuffer()voidpopMatrix()( begin auto-generated from popMatrix.xml ) Pops the current transformation matrix off the matrix stack.voidpopProjection()voidpopStyle()( 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.voidprintCamera()Print the current camera matrix.voidprintMatrix()Print the current model (or "transformation") matrix.voidprintProjection()Print the current projection matrix.protected voidprocessImageBeforeAsyncSave(PImage image)protected voidpushFramebuffer()voidpushMatrix()( begin auto-generated from pushMatrix.xml ) Pushes the current transformation matrix onto the matrix stack.voidpushProjection()voidquad(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.voidquadraticVertex(float cx, float cy, float x3, float y3)voidquadraticVertex(float cx, float cy, float cz, float x3, float y3, float z3)protected voidquadraticVertexImpl(float cx, float cy, float cz, float x3, float y3, float z3)protected voidreadPixels()protected voidrectImpl(float x1, float y1, float x2, float y2, float tl, float tr, float br, float bl)voidremoveCache(PImage image)Remove information associated with this renderer from the cache, if any.protected voidremoveFontTexture(PFont font)protected voidreport(String where)Report on anything from glError().voidresetMatrix()( begin auto-generated from resetMatrix.xml ) Replaces the current matrix with the identity matrix.voidresetProjection()voidresetShader()( begin auto-generated from resetShader.xml ) This is a new reference entry for Processing 2.0.voidresetShader(int kind)voidresize(int wide, int high)( begin auto-generated from PImage_resize.xml ) Resize the image to a new width and height.protected voidrestartPGL()protected voidrestoreGL()voidrotate(float angle)Two dimensional rotation.voidrotate(float angle, float v0, float v1, float v2)Rotate around an arbitrary vector, similar to glRotate(), except that it takes radians (instead of degrees).protected voidrotateImpl(float angle, float v0, float v1, float v2)voidrotateX(float angle)( begin auto-generated from rotateX.xml ) Rotates a shape around the x-axis the amount specified by the angle parameter.voidrotateY(float angle)( begin auto-generated from rotateY.xml ) Rotates a shape around the y-axis the amount specified by the angle parameter.voidrotateZ(float angle)( begin auto-generated from rotateZ.xml ) Rotates a shape around the z-axis the amount specified by the angle parameter.protected static booleansame(float a, float b)booleansave(String filename)( begin auto-generated from PImage_save.xml ) Saves the image into a file.booleansaveImpl(String filename)voidscale(float s)Same as scale(s, s, s).voidscale(float sx, float sy)Same as scale(sx, sy, 1).voidscale(float sx, float sy, float sz)Scale in three dimensions.protected voidscaleImpl(float sx, float sy, float sz)Scale in three dimensions.floatscreenX(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.floatscreenX(float x, float y, float z)protected floatscreenXImpl(float x, float y, float z)protected floatscreenXImpl(float x, float y, float z, float w)floatscreenY(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.floatscreenY(float x, float y, float z)protected floatscreenYImpl(float x, float y, float z)protected floatscreenYImpl(float x, float y, float z, float w)floatscreenZ(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.protected floatscreenZImpl(float x, float y, float z)protected floatscreenZImpl(float x, float y, float z, float w)voidset(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.voidsetCache(PImage image, Object storage)Store data of some kind for the renderer that requires extra metadata of some kind.protected voidsetCurrentPG()protected voidsetCurrentPG(PGraphicsOpenGL pg)protected voidsetFlushMode(int mode)protected voidsetFontTexture(PFont font, processing.opengl.FontTexture fontTexture)protected voidsetFramebuffer(FrameBuffer fbo)protected voidsetGLSettings()protected voidsetImpl(PImage sourceImage, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int targetX, int targetY)Internal function to actually handle setting a block of pixels that has already been properly cropped from the image to a valid region.voidsetMatrix(PMatrix2D source)Set the current transformation to the contents of the specified source.voidsetMatrix(PMatrix3D source)Set the current transformation to the contents of the specified source.voidsetParent(PApplet parent)voidsetPrimary(boolean primary)Set (or unset) this as the main drawing surface.voidsetProjection(PMatrix3D mat)voidsetSize(int iwidth, int iheight)The final step in setting up a renderer, set its size of this renderer.protected voidsetViewport()voidshader(PShader shader)( begin auto-generated from shader.xml ) This is a new reference entry for Processing 2.0.voidshader(PShader shader, int kind)protected voidshape(PShape shape, float x, float y, float z)protected voidshape(PShape shape, float x, float y, float z, float c, float d, float e)voidshearX(float angle)( begin auto-generated from shearX.xml ) Shears a shape around the x-axis the amount specified by the angle parameter.voidshearY(float angle)( begin auto-generated from shearY.xml ) Shears a shape around the y-axis the amount specified by the angle parameter.voidsphere(float r)( begin auto-generated from sphere.xml ) A sphere is a hollow ball made from tessellated triangles.voidspotLight(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.voidstrokeCap(int cap)( begin auto-generated from strokeCap.xml ) Sets the style for rendering line endings.voidstrokeJoin(int join)( begin auto-generated from strokeJoin.xml ) Sets the style of the joints which connect line segments.voidstrokeWeight(float weight)( begin auto-generated from strokeWeight.xml ) Sets the width of the stroke used for lines, points, and the border around shapes.protected voidswapOffscreenTextures()protected voidtessellate(int mode)protected voidtessellate(int[] indices)floattextAscent()( begin auto-generated from textAscent.xml ) Returns ascent of the current font at its current size.protected voidtextCharImpl(char ch, float x, float y)protected voidtextCharModelImpl(processing.opengl.FontTexture.TextureInfo info, float x0, float y0, float x1, float y1)protected voidtextCharShapeImpl(char ch, float x, float y)Ported from the implementation of textCharShapeImpl() in 1.5.1 No attempt has been made to optimize this codefloattextDescent()( begin auto-generated from textDescent.xml ) Returns descent of the current font at its current size.protected voidtextLineImpl(char[] buffer, int start, int stop, float x, float y)Implementation of actual drawing for a line of text.protected booleantextModeCheck(int mode)voidtextureSampling(int sampling)voidtextureWrap(int wrap)( begin auto-generated from textureWrap.xml ) Description to come...protected floattextWidthImpl(char[] buffer, int start, int stop)Implementation of returning the text width of the chars [start, stop) in the buffer.voidtranslate(float tx, float ty)( begin auto-generated from translate.xml ) Specifies an amount to displace objects within the display window.voidtranslate(float tx, float ty, float tz)protected voidtranslateImpl(float tx, float ty, float tz)voidtriangle(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.protected voidunbindFrontTexture()protected voidunbindLineBuffers()protected voidunbindPointBuffers()protected voidunbindPolyBuffers()voidupdateDisplay()protected voidupdateGLModelview()protected voidupdateGLNormal()protected voidupdateGLProjection()protected voidupdateGLProjmodelview()protected voidupdateLineBuffers()protected voidupdatePixelSize()protected voidupdatePointBuffers()protected voidupdatePolyBuffers(boolean lit, boolean tex, boolean needNormals, boolean needTexCoords)voidupdateProjmodelview()voidupdateTexture()voidupdateTexture(int x, int y, int w, int h)protected voidupdateTexture(PImage img, Texture tex)voidvertex(float x, float y)voidvertex(float x, float y, float z)voidvertex(float x, float y, float u, float v)voidvertex(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.protected booleanvertexBreak()protected voidvertexImpl(float x, float y, float z, float u, float v)protected PImagewrapTexture(Texture tex)protected static booleanzero(float a)-
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientFromCalc, applyMatrix, arc, arc, background, background, background, background, background, background, background, backgroundFromCalc, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierInit, bezierInitCheck, bezierPoint, bezierTangent, bezierVertexCheck, bezierVertexCheck, blendMode, blue, box, brightness, circle, clear, clip, color, color, color, color, color, color, color, color, color, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalcARGB, colorMode, colorMode, colorMode, colorMode, createDefaultFont, createFont, createShape, createShape, createShape, curve, curve, curveDetail, curveInit, curveInitCheck, curvePoint, curveTangent, curveTightness, curveVertexCheck, curveVertexCheck, curveVertexSegment, curveVertexSegment, defaultFontOrDeath, defaultFontOrDeath, displayable, edge, ellipse, ellipseMode, emissive, emissive, emissive, emissiveFromCalc, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getRaw, getStyle, getStyle, green, haveRaw, hue, image, image, image, imageImpl, imageMode, is2D, is2X, is3D, lerpColor, lerpColor, loadShape, noFill, normal, noSmooth, noStroke, noTexture, noTint, pop, push, pushStyle, reapplySettings, rect, rect, rect, rectImpl, rectMode, red, saturation, setMatrix, setPath, shape, shape, shape, shapeMode, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, smooth, smooth, specular, specular, specular, specularFromCalc, sphereDetail, sphereDetail, splineForward, square, stroke, stroke, stroke, stroke, stroke, stroke, strokeFromCalc, style, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textCharModelImpl, textFont, textFont, textFontImpl, textLeading, textLineAlignImpl, textMode, textSentence, textSentenceBreak, textSize, textSizeImpl, texture, textureMode, textWidth, textWidth, textWidth, tint, tint, tint, tint, tint, tint, tintFromCalc, vertex, vertexCheck, vertexTexture
-
Methods inherited from class processing.core.PImage
blend, blend, blendColor, blurAlpha, blurARGB, blurRGB, buildBlurKernel, checkAlpha, clone, copy, dilate, erode, get, get, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, init, isLoaded, isModified, loadTIFF, mask, opaque, saveImageIO, saveTGA, saveTIFF, set, setLoaded, setLoaded, setModified, setModified, updatePixels, updatePixels
-
-
-
-
Field Detail
-
pgl
public PGL pgl
Interface between Processing and OpenGL
-
currentPG
public PGraphicsOpenGL currentPG
The renderer currently in use.
-
fontMap
protected WeakHashMap<PFont,processing.opengl.FontTexture> fontMap
Font cache for texture objects.
-
initialized
public boolean initialized
Whether the PGraphics object is ready to render or not.
-
FLUSH_CONTINUOUSLY
protected static final int FLUSH_CONTINUOUSLY
Flush modes: continuously (geometry is flushed after each call to endShape) when-full (geometry is accumulated until a maximum size is reached.- See Also:
- Constant Field Values
-
FLUSH_WHEN_FULL
protected static final int FLUSH_WHEN_FULL
- See Also:
- Constant Field Values
-
IMMEDIATE
protected static final int IMMEDIATE
Type of geometry: immediate is that generated with beginShape/vertex/ endShape, retained is the result of creating a PShapeOpenGL object with createShape.- See Also:
- Constant Field Values
-
RETAINED
protected static final int RETAINED
- See Also:
- Constant Field Values
-
flushMode
protected int flushMode
Current flush mode.
-
bufPolyVertex
protected VertexBuffer bufPolyVertex
-
bufPolyColor
protected VertexBuffer bufPolyColor
-
bufPolyNormal
protected VertexBuffer bufPolyNormal
-
bufPolyTexcoord
protected VertexBuffer bufPolyTexcoord
-
bufPolyAmbient
protected VertexBuffer bufPolyAmbient
-
bufPolySpecular
protected VertexBuffer bufPolySpecular
-
bufPolyEmissive
protected VertexBuffer bufPolyEmissive
-
bufPolyShininess
protected VertexBuffer bufPolyShininess
-
bufPolyIndex
protected VertexBuffer bufPolyIndex
-
polyBuffersCreated
protected boolean polyBuffersCreated
-
polyBuffersContext
protected int polyBuffersContext
-
bufLineVertex
protected VertexBuffer bufLineVertex
-
bufLineColor
protected VertexBuffer bufLineColor
-
bufLineAttrib
protected VertexBuffer bufLineAttrib
-
bufLineIndex
protected VertexBuffer bufLineIndex
-
lineBuffersCreated
protected boolean lineBuffersCreated
-
lineBuffersContext
protected int lineBuffersContext
-
bufPointVertex
protected VertexBuffer bufPointVertex
-
bufPointColor
protected VertexBuffer bufPointColor
-
bufPointAttrib
protected VertexBuffer bufPointAttrib
-
bufPointIndex
protected VertexBuffer bufPointIndex
-
pointBuffersCreated
protected boolean pointBuffersCreated
-
pointBuffersContext
protected int pointBuffersContext
-
polyAttribs
protected PGraphicsOpenGL.AttributeMap polyAttribs
-
INIT_VERTEX_BUFFER_SIZE
protected static final int INIT_VERTEX_BUFFER_SIZE
- See Also:
- Constant Field Values
-
INIT_INDEX_BUFFER_SIZE
protected static final int INIT_INDEX_BUFFER_SIZE
- See Also:
- Constant Field Values
-
glParamsRead
protected static boolean glParamsRead
-
npotTexSupported
public static boolean npotTexSupported
Extensions used by Processing
-
autoMipmapGenSupported
public static boolean autoMipmapGenSupported
-
fboMultisampleSupported
public static boolean fboMultisampleSupported
-
packedDepthStencilSupported
public static boolean packedDepthStencilSupported
-
anisoSamplingSupported
public static boolean anisoSamplingSupported
-
blendEqSupported
public static boolean blendEqSupported
-
readBufferSupported
public static boolean readBufferSupported
-
drawBufferSupported
public static boolean drawBufferSupported
-
maxTextureSize
public static int maxTextureSize
Some hardware limits
-
maxSamples
public static int maxSamples
-
maxAnisoAmount
public static float maxAnisoAmount
-
depthBits
public static int depthBits
-
stencilBits
public static int stencilBits
-
OPENGL_VENDOR
public static String OPENGL_VENDOR
OpenGL information strings
-
OPENGL_RENDERER
public static String OPENGL_RENDERER
-
OPENGL_VERSION
public static String OPENGL_VERSION
-
OPENGL_EXTENSIONS
public static String OPENGL_EXTENSIONS
-
GLSL_VERSION
public static String GLSL_VERSION
-
defColorShaderVertURL
protected static URL defColorShaderVertURL
-
defTextureShaderVertURL
protected static URL defTextureShaderVertURL
-
defLightShaderVertURL
protected static URL defLightShaderVertURL
-
defTexlightShaderVertURL
protected static URL defTexlightShaderVertURL
-
defColorShaderFragURL
protected static URL defColorShaderFragURL
-
defTextureShaderFragURL
protected static URL defTextureShaderFragURL
-
defLightShaderFragURL
protected static URL defLightShaderFragURL
-
defTexlightShaderFragURL
protected static URL defTexlightShaderFragURL
-
defLineShaderVertURL
protected static URL defLineShaderVertURL
-
defLineShaderFragURL
protected static URL defLineShaderFragURL
-
defPointShaderVertURL
protected static URL defPointShaderVertURL
-
defPointShaderFragURL
protected static URL defPointShaderFragURL
-
maskShaderFragURL
protected static URL maskShaderFragURL
-
defColorShader
protected PShader defColorShader
-
defTextureShader
protected PShader defTextureShader
-
defLightShader
protected PShader defLightShader
-
defTexlightShader
protected PShader defTexlightShader
-
defLineShader
protected PShader defLineShader
-
defPointShader
protected PShader defPointShader
-
maskShader
protected PShader maskShader
-
polyShader
protected PShader polyShader
-
lineShader
protected PShader lineShader
-
pointShader
protected PShader pointShader
-
inGeo
protected PGraphicsOpenGL.InGeometry inGeo
-
tessGeo
protected PGraphicsOpenGL.TessGeometry tessGeo
-
texCache
protected PGraphicsOpenGL.TexCache texCache
-
tessellator
protected PGraphicsOpenGL.Tessellator tessellator
-
sorter
protected PGraphicsOpenGL.DepthSorter sorter
-
isDepthSortingEnabled
protected boolean isDepthSortingEnabled
-
asyncPixelReader
protected PGraphicsOpenGL.AsyncPixelReader asyncPixelReader
-
asyncPixelReaderInitialized
protected boolean asyncPixelReaderInitialized
-
ongoingPixelTransfers
protected static final Set<PGraphicsOpenGL.AsyncPixelReader> ongoingPixelTransfers
-
ongoingPixelTransfersIterable
protected static final List<PGraphicsOpenGL.AsyncPixelReader> ongoingPixelTransfersIterable
-
cameraFOV
public float cameraFOV
Camera field of view.
-
cameraX
public float cameraX
Default position of the camera.
-
cameraY
public float cameraY
Default position of the camera.
-
cameraZ
public float cameraZ
Default position of the camera.
-
cameraNear
public float cameraNear
Distance of the near and far planes.
-
cameraFar
public float cameraFar
Distance of the near and far planes.
-
cameraAspect
public float cameraAspect
Aspect ratio of camera's view.
-
defCameraFOV
public float defCameraFOV
Default camera properties.
-
defCameraX
public float defCameraX
-
defCameraY
public float defCameraY
-
defCameraZ
public float defCameraZ
-
defCameraNear
public float defCameraNear
-
defCameraFar
public float defCameraFar
-
defCameraAspect
public float defCameraAspect
-
eyeDist
protected float eyeDist
Distance between camera eye and center.
-
manipulatingCamera
protected boolean manipulatingCamera
Flag to indicate that we are inside beginCamera/endCamera block.
-
projection
public PMatrix3D projection
-
camera
public PMatrix3D camera
-
cameraInv
public PMatrix3D cameraInv
-
modelview
public PMatrix3D modelview
-
modelviewInv
public PMatrix3D modelviewInv
-
projmodelview
public PMatrix3D projmodelview
-
glProjection
protected float[] glProjection
-
glModelview
protected float[] glModelview
-
glProjmodelview
protected float[] glProjmodelview
-
glNormal
protected float[] glNormal
-
identity
protected static PMatrix3D identity
-
sized
protected boolean sized
Marks when changes to the size have occurred, so that the camera will be reset in beginDraw().
-
MATRIX_STACK_DEPTH
protected static final int MATRIX_STACK_DEPTH
- See Also:
- Constant Field Values
-
modelviewStackDepth
protected int modelviewStackDepth
-
projectionStackDepth
protected int projectionStackDepth
-
modelviewStack
protected float[][] modelviewStack
Modelview matrix stack
-
modelviewInvStack
protected float[][] modelviewInvStack
Inverse modelview matrix stack
-
cameraStack
protected float[][] cameraStack
Camera matrix stack
-
cameraInvStack
protected float[][] cameraInvStack
Inverse camera matrix stack
-
projectionStack
protected float[][] projectionStack
Projection matrix stack
-
lights
public boolean lights
-
lightCount
public int lightCount
-
lightType
public int[] lightType
Light types
-
lightPosition
public float[] lightPosition
Light positions
-
lightNormal
public float[] lightNormal
Light direction (normalized vector)
-
lightAmbient
public float[] lightAmbient
Ambient colors for lights.
-
lightDiffuse
public float[] lightDiffuse
Diffuse colors for lights.
-
lightSpecular
public float[] lightSpecular
Specular colors for lights. Internally these are stored as numbers between 0 and 1.
-
lightFalloffCoefficients
public float[] lightFalloffCoefficients
Light falloff
-
lightSpotParameters
public float[] lightSpotParameters
Light spot parameters: Cosine of light spot angle and concentration
-
currentLightSpecular
public float[] currentLightSpecular
Current specular color for lighting
-
currentLightFalloffConstant
public float currentLightFalloffConstant
Current light falloff
-
currentLightFalloffLinear
public float currentLightFalloffLinear
-
currentLightFalloffQuadratic
public float currentLightFalloffQuadratic
-
textureWrap
protected int textureWrap
-
textureSampling
protected int textureSampling
-
clip
protected boolean clip
-
clipRect
protected int[] clipRect
Clipping rectangle.
-
FB_STACK_DEPTH
protected static final int FB_STACK_DEPTH
- See Also:
- Constant Field Values
-
fbStackDepth
protected int fbStackDepth
-
fbStack
protected FrameBuffer[] fbStack
-
drawFramebuffer
protected FrameBuffer drawFramebuffer
-
readFramebuffer
protected FrameBuffer readFramebuffer
-
currentFramebuffer
protected FrameBuffer currentFramebuffer
-
offscreenFramebuffer
protected FrameBuffer offscreenFramebuffer
-
multisampleFramebuffer
protected FrameBuffer multisampleFramebuffer
-
offscreenMultisample
protected boolean offscreenMultisample
-
pixOpChangedFB
protected boolean pixOpChangedFB
-
texture
protected Texture texture
Texture containing the current frame
-
ptexture
protected Texture ptexture
Texture containing the previous frame
-
pixelBuffer
protected IntBuffer pixelBuffer
IntBuffer wrapping the pixels array.
-
nativePixels
protected int[] nativePixels
Array to store pixels in OpenGL format.
-
nativePixelBuffer
protected IntBuffer nativePixelBuffer
IntBuffer wrapping the native pixels array.
-
filterTexture
protected Texture filterTexture
texture used to apply a filter on the screen image.
-
filterImage
protected PImage filterImage
PImage that wraps filterTexture.
-
drawing
protected boolean drawing
True if we are inside a beginDraw()/endDraw() block.
-
smoothDisabled
protected boolean smoothDisabled
Used to detect continuous use of the smooth/noSmooth functions
-
smoothCallCount
protected int smoothCallCount
-
lastSmoothCall
protected int lastSmoothCall
-
lastBlendMode
protected int lastBlendMode
Used to avoid flushing the geometry when blendMode() is called with the same blend mode as the last
-
OP_NONE
protected static final int OP_NONE
Type of pixels operation.- See Also:
- Constant Field Values
-
OP_READ
protected static final int OP_READ
- See Also:
- Constant Field Values
-
OP_WRITE
protected static final int OP_WRITE
- See Also:
- Constant Field Values
-
pixelsOp
protected int pixelsOp
-
viewport
protected IntBuffer viewport
Viewport dimensions.
-
openContour
protected boolean openContour
-
breakShape
protected boolean breakShape
-
defaultEdges
protected boolean defaultEdges
-
EDGE_MIDDLE
protected static final int EDGE_MIDDLE
- See Also:
- Constant Field Values
-
EDGE_START
protected static final int EDGE_START
- See Also:
- Constant Field Values
-
EDGE_STOP
protected static final int EDGE_STOP
- See Also:
- Constant Field Values
-
EDGE_SINGLE
protected static final int EDGE_SINGLE
- See Also:
- Constant Field Values
-
EDGE_CLOSE
protected static final int EDGE_CLOSE
- See Also:
- Constant Field Values
-
MIN_POINT_ACCURACY
protected static final int MIN_POINT_ACCURACY
Used in round point and ellipse tessellation. The number of subdivisions per round point or ellipse is calculated with the following formula: n = min(M, max(N, (TWO_PI * size / F))) where size is a measure of the dimensions of the circle when projected on screen coordinates. F just sets the minimum number of subdivisions, while a smaller F would allow to have more detailed circles. N = MIN_POINT_ACCURACY M = MAX_POINT_ACCURACY F = POINT_ACCURACY_FACTOR- See Also:
- Constant Field Values
-
MAX_POINT_ACCURACY
protected static final int MAX_POINT_ACCURACY
- See Also:
- Constant Field Values
-
POINT_ACCURACY_FACTOR
protected static final float POINT_ACCURACY_FACTOR
- See Also:
- Constant Field Values
-
QUAD_POINT_SIGNS
protected static final float[][] QUAD_POINT_SIGNS
Used in quad point tessellation.
-
intBuffer
protected static IntBuffer intBuffer
To get data from OpenGL.
-
floatBuffer
protected static FloatBuffer floatBuffer
-
-
Method Detail
-
setPrimary
public void setPrimary(boolean primary)
Description copied from class:PGraphicsSet (or unset) this as the main drawing surface. Meaning that it can safely be set to opaque (and given a default gray background), or anything else that goes along with that.- Overrides:
setPrimaryin classPGraphics
-
setSize
public void setSize(int iwidth, int iheight)Description copied from class:PGraphicsThe final step in setting up a renderer, set its size of this renderer. This was formerly handled by the constructor, but instead it's been broken out so that setParent/setPrimary/setPath can be handled differently. Important: this is ignored by the Methods task because otherwise it will override setSize() in PApplet/Applet/Component, which will 1) not call super.setSize(), and 2) will cause the renderer to be resized from the event thread (EDT), causing a nasty crash as it collides with the animation thread.
-
dispose
public void dispose()
Description copied from class:PGraphicsHandle any takedown for this graphics context.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.
-
setFlushMode
protected void setFlushMode(int mode)
-
updatePixelSize
protected void updatePixelSize()
-
createPGL
protected abstract PGL createPGL(PGraphicsOpenGL pg)
-
createSurface
public abstract PSurface createSurface()
- Overrides:
createSurfacein classPGraphics
-
saveImpl
public boolean saveImpl(String filename)
-
setCache
public void setCache(PImage image, Object storage)
Description copied from class:PGraphicsStore data of some kind for the renderer that requires extra metadata of some kind. Usually this is a renderer-specific representation of the image data, for instance a BufferedImage with tint() settings applied for PGraphicsJava2D, or resized image data and OpenGL texture indices for PGraphicsOpenGL.
-
getCache
public Object getCache(PImage image)
Description copied from class:PGraphicsGet cache storage data for the specified renderer. Because each renderer will cache data in different formats, it's necessary to store cache data keyed by the renderer object. Otherwise, attempting to draw the same image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
-
removeCache
public void removeCache(PImage image)
Description copied from class:PGraphicsRemove information associated with this renderer from the cache, if any.- Overrides:
removeCachein classPGraphics- Parameters:
image- The image whose cache data should be removed
-
setFontTexture
protected void setFontTexture(PFont font, processing.opengl.FontTexture fontTexture)
-
getFontTexture
protected processing.opengl.FontTexture getFontTexture(PFont font)
-
removeFontTexture
protected void removeFontTexture(PFont font)
-
pushFramebuffer
protected void pushFramebuffer()
-
setFramebuffer
protected void setFramebuffer(FrameBuffer fbo)
-
popFramebuffer
protected void popFramebuffer()
-
getCurrentFB
protected FrameBuffer getCurrentFB()
-
createPolyBuffers
protected void createPolyBuffers()
-
updatePolyBuffers
protected void updatePolyBuffers(boolean lit, boolean tex, boolean needNormals, boolean needTexCoords)
-
unbindPolyBuffers
protected void unbindPolyBuffers()
-
polyBuffersContextIsOutdated
protected boolean polyBuffersContextIsOutdated()
-
createLineBuffers
protected void createLineBuffers()
-
updateLineBuffers
protected void updateLineBuffers()
-
unbindLineBuffers
protected void unbindLineBuffers()
-
lineBufferContextIsOutdated
protected boolean lineBufferContextIsOutdated()
-
createPointBuffers
protected void createPointBuffers()
-
updatePointBuffers
protected void updatePointBuffers()
-
unbindPointBuffers
protected void unbindPointBuffers()
-
pointBuffersContextIsOutdated
protected boolean pointBuffersContextIsOutdated()
-
beginDraw
public void beginDraw()
Description copied from class:PGraphics( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object. It should be called before anything is drawn into the object. ( end auto-generated )Advanced
When creating your own PGraphics, you should call this before drawing anything.
-
endDraw
public void endDraw()
Description copied from class:PGraphics( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen. ( end auto-generated )Advanced
When creating your own PGraphics, you should call this when you're finished drawing.
-
getPrimaryPG
protected PGraphicsOpenGL getPrimaryPG()
-
setCurrentPG
protected void setCurrentPG(PGraphicsOpenGL pg)
-
setCurrentPG
protected void setCurrentPG()
-
getCurrentPG
protected PGraphicsOpenGL getCurrentPG()
-
getPrimaryPGL
protected PGL getPrimaryPGL()
-
updateProjmodelview
public void updateProjmodelview()
-
restartPGL
protected void restartPGL()
-
restoreGL
protected void restoreGL()
-
beginBindFramebuffer
protected void beginBindFramebuffer(int target, int framebuffer)
-
endBindFramebuffer
protected void endBindFramebuffer(int target, int framebuffer)
-
beginReadPixels
protected void beginReadPixels()
-
endReadPixels
protected void endReadPixels()
-
beginPixelsOp
protected void beginPixelsOp(int op)
-
endPixelsOp
protected void endPixelsOp()
-
updateGLProjection
protected void updateGLProjection()
-
updateGLModelview
protected void updateGLModelview()
-
updateGLProjmodelview
protected void updateGLProjmodelview()
-
updateGLNormal
protected void updateGLNormal()
-
defaultSettings
protected void defaultSettings()
Description copied from class:PGraphicsSet engine's default values. This has to be called by PApplet, somewhere inside setup() or draw() because it talks to the graphics buffer, meaning that for subclasses like OpenGL, there needs to be a valid graphics context to mess with otherwise you'll get some good crashing action. This is currently called by checkSettings(), during beginDraw().- Overrides:
defaultSettingsin classPGraphics
-
hint
public void hint(int which)
Description copied from class:PGraphics( begin auto-generated from hint.xml ) Set various hints and hacks for the renderer. This is used to handle obscure rendering features that cannot be implemented in a consistent manner across renderers. Many options will often graduate to standard features instead of hints over time.
hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This can help force anti-aliasing if it has not been enabled by the user. On some graphics cards, this can also be set by the graphics driver's control panel, however not all cards make this available. This hint must be called immediately after the size() command because it resets the renderer, obliterating any settings and anything drawn (and like size(), re-running the code that came before it again).
hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always enables 2x smoothing when the P3D renderer is used. This hint disables the default 2x smoothing and returns the smoothing behavior found in earlier releases, where smooth() and noSmooth() could be used to enable and disable smoothing, though the quality was inferior.
hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are installed, rather than the bitmapped version from a .vlw file. This is useful with the default (or JAVA2D) renderer setting, as it will improve font rendering speed. This is not enabled by default, because it can be misleading while testing because the type will look great on your machine (because you have the font installed) but lousy on others' machines if the identical font is unavailable. This option can only be set per-sketch, and must be called before any use of textFont().
hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on top of everything at will. When depth testing is disabled, items will be drawn to the screen sequentially, like a painting. This hint is most often used to draw in 3D, then draw in 2D on top of it (for instance, to draw GUI controls in 2D on top of a 3D interface). Starting in release 0149, this will also clear the depth buffer. Restore the default with hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, any 3D drawing that happens later in draw() will ignore existing shapes on the screen.
hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and lines in P3D and OPENGL. This can slow performance considerably, and the algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT).
hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT).
hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be downsampled to make PGL#readPixels work with multisampling. Enabling this introduces some overhead, so if you experience bad performance, disable multisampling with noSmooth() instead. This hint is not intended to be enabled and disabled repeatedely, so call this once in setup() or after creating your PGraphics2D/3D. You can restore the default with hint(DISABLE_BUFFER_READING) if you don't plan to read depth from this PGraphics anymore.
hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded by default (works only in P2D/P3D); use this hint to get all the key events (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events only when the key goes physically up or down.
hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame() will not use separate threads for saving and will block until the image is written to the drive. This was the default behavior in 3.0b7 and before. To enable, call hint(ENABLE_ASYNC_SAVEFRAME).
As of release 0149, unhint() has been removed in favor of adding additional ENABLE/DISABLE constants to reset the default behavior. This prevents the double negatives, and also reinforces which hints can be enabled or disabled. ( end auto-generated )- Overrides:
hintin classPGraphics- Parameters:
which- name of the hint to be enabled or disabled- See Also:
PGraphics,PApplet.createGraphics(int, int, String, String),PApplet.size(int, int)
-
getHint
protected boolean getHint(int which)
-
createShapeFamily
protected PShape createShapeFamily(int type)
Description copied from class:PGraphicsOverride this method to return an appropriate shape for your renderer- Overrides:
createShapeFamilyin classPGraphics
-
createShapePrimitive
protected PShape createShapePrimitive(int kind, float... p)
Description copied from class:PGraphicsOverride this to have a custom shape object used by your renderer.- Overrides:
createShapePrimitivein classPGraphics
-
beginShape
public void beginShape(int kind)
Description copied from class:PGraphics( begin auto-generated from beginShape.xml ) Using the beginShape() and endShape() functions allow creating more complex forms. beginShape() begins recording vertices for a shape and endShape() stops recording. The value of the MODE parameter tells it which types of shapes to create from the provided vertices. With no mode specified, the shape can be any irregular polygon. The parameters available for beginShape() are POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. After calling the beginShape() function, a series of vertex() commands must follow. To stop drawing the shape, call endShape(). The vertex() function with two parameters specifies a position in 2D and the vertex() function with three parameters specifies a position in 3D. Each shape will be outlined with the current stroke color and filled with the fill color.
Transformations such as translate(), rotate(), and scale() do not work within beginShape(). It is also not possible to use other shapes, such as ellipse() or rect() within beginShape().
The P3D renderer settings allow stroke() and fill() settings to be altered per-vertex, however the default P2D renderer does not. Settings such as strokeWeight(), strokeCap(), and strokeJoin() cannot be changed while inside a beginShape()/endShape() block with any renderer. ( end auto-generated )- Overrides:
beginShapein classPGraphics- Parameters:
kind- Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP- See Also:
PShape,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)
-
endShape
public void endShape(int mode)
Description copied from class:PGraphics( begin auto-generated from endShape.xml ) The endShape() function is the companion to beginShape() and may only be called after beginShape(). When endshape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer. The constant CLOSE as the value for the MODE parameter to close the shape (to connect the beginning and the end). ( end auto-generated )- Overrides:
endShapein classPGraphics- Parameters:
mode- use CLOSE to close the shape- See Also:
PShape,PGraphics.beginShape(int)
-
endShape
protected void endShape(int[] indices)
-
textureWrap
public void textureWrap(int wrap)
Description copied from class:PGraphics( begin auto-generated from textureWrap.xml ) Description to come... ( end auto-generated from textureWrap.xml )- Overrides:
textureWrapin classPGraphics- Parameters:
wrap- Either CLAMP (default) or REPEAT- See Also:
PGraphics.texture(PImage),PGraphics.textureMode(int)
-
textureSampling
public void textureSampling(int sampling)
-
beginContour
public void beginContour()
- Overrides:
beginContourin classPGraphics
-
endContour
public void endContour()
- Overrides:
endContourin classPGraphics
-
vertex
public void vertex(float x, float y, float z, float u, float v)Description copied from class:PGraphics( begin auto-generated from vertex.xml ) All shapes are constructed by connecting a series of vertices. vertex() is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within the beginShape() and endShape() function.
Drawing a vertex in 3D using the z parameter requires the P3D parameter in combination with size as shown in the above example.
This function is also used to map a texture onto the geometry. The texture() function declares the texture to apply to the geometry and the u and v coordinates set define the mapping of this texture to the form. By default, the coordinates used for u and v are specified in relation to the image's size in pixels, but this relation can be changed with textureMode(). ( end auto-generated )- Overrides:
vertexin classPGraphics- Parameters:
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 mapping- See Also:
PGraphics.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)
-
attribPosition
public void attribPosition(String name, float x, float y, float z)
- Overrides:
attribPositionin classPGraphics
-
attribNormal
public void attribNormal(String name, float nx, float ny, float nz)
- Overrides:
attribNormalin classPGraphics
-
attribColor
public void attribColor(String name, int color)
- Overrides:
attribColorin classPGraphics
-
attribImpl
protected PGraphicsOpenGL.VertexAttribute attribImpl(String name, int kind, int type, int size)
-
vertexImpl
protected void vertexImpl(float x, float y, float z, float u, float v)
-
vertexBreak
protected boolean vertexBreak()
-
clipImpl
protected void clipImpl(float x1, float y1, float x2, float y2)
-
noClip
public void noClip()
Description copied from class:PGraphics( begin auto-generated from noClip.xml ) Disables the clipping previously started by the clip() function. ( end auto-generated )
-
tessellate
protected void tessellate(int mode)
-
tessellate
protected void tessellate(int[] indices)
-
flushPixels
protected void flushPixels()
-
flushPolys
protected void flushPolys()
-
flushSortedPolys
protected void flushSortedPolys()
-
flushLines
protected void flushLines()
-
flushPoints
protected void flushPoints()
-
bezierVertex
public void bezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)- Overrides:
bezierVertexin classPGraphics
-
bezierVertex
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)Description copied from class:PGraphics( begin auto-generated from bezierVertex.xml ) Specifies vertex coordinates for Bezier curves. Each call to bezierVertex() defines the position of two control points and one anchor point of a Bezier curve, adding a new segment to a line or shape. The first time bezierVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). Using the 3D version requires rendering with P3D (see the Environment reference for more information). ( end auto-generated )- Overrides:
bezierVertexin classPGraphics- Parameters:
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 point- See Also:
PGraphics.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)
-
bezierVertexImpl
protected void bezierVertexImpl(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
-
quadraticVertex
public void quadraticVertex(float cx, float cy, float x3, float y3)- Overrides:
quadraticVertexin classPGraphics- Parameters:
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 point- See Also:
PGraphics.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)
-
quadraticVertex
public void quadraticVertex(float cx, float cy, float cz, float x3, float y3, float z3)- Overrides:
quadraticVertexin classPGraphicscz- the z-coordinate of the control pointz3- the z-coordinate of the anchor point
-
quadraticVertexImpl
protected void quadraticVertexImpl(float cx, float cy, float cz, float x3, float y3, float z3)
-
curveVertex
public void curveVertex(float x, float y)Description copied from class:PGraphics( begin auto-generated from curveVertex.xml ) Specifies vertex coordinates for curves. This function may only be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). The first and last points in a series of curveVertex() lines will be used to guide the beginning and end of a the curve. A minimum of four points is required to draw a tiny curve between the second and third points. Adding a fifth point with curveVertex() will draw the curve between the second, third, and fourth points. The curveVertex() function is an implementation of Catmull-Rom splines. Using the 3D version requires rendering with P3D (see the Environment reference for more information). ( end auto-generated )- Overrides:
curveVertexin classPGraphics- Parameters:
x- the x-coordinate of the vertexy- the y-coordinate of the vertex- See Also:
PGraphics.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)
-
curveVertex
public void curveVertex(float x, float y, float z)- Overrides:
curveVertexin classPGraphicsz- the z-coordinate of the vertex
-
curveVertexImpl
protected void curveVertexImpl(float x, float y, float z)
-
point
public void point(float x, float y)Description copied from class:PGraphics( begin auto-generated from point.xml ) Draws a point, a coordinate in space at the dimension of one pixel. The first parameter is the horizontal value for the point, the second value is the vertical value for the point, and the optional third value is the depth value. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example. ( end auto-generated )- Overrides:
pointin classPGraphics- Parameters:
x- x-coordinate of the pointy- y-coordinate of the point- See Also:
PGraphics.stroke(int)
-
point
public void point(float x, float y, float z)
-
pointImpl
protected void pointImpl(float x, float y, float z)
-
line
public void line(float x1, float y1, float x2, float y2)Description copied from class:PGraphics( begin auto-generated from line.xml ) Draws a line (a direct path between two points) to the screen. The version of line() with four parameters draws the line in 2D. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() function will not affect the color of a line. 2D lines are drawn with a width of one pixel by default, but this can be changed with the strokeWeight() function. The version with six parameters allows the line to be placed anywhere within XYZ space. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example. ( end auto-generated )- Overrides:
linein classPGraphics- Parameters:
x1- x-coordinate of the first pointy1- y-coordinate of the first pointx2- x-coordinate of the second pointy2- y-coordinate of the second point- See Also:
PGraphics.strokeWeight(float),PGraphics.strokeJoin(int),PGraphics.strokeCap(int),PGraphics.beginShape()
-
line
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
-
lineImpl
protected void lineImpl(float x1, float y1, float z1, float x2, float y2, float z2)
-
triangle
public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)Description copied from class:PGraphics( begin auto-generated from triangle.xml ) A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point. ( end auto-generated )- Overrides:
trianglein classPGraphics- Parameters:
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 point- See Also:
PApplet.beginShape()
-
quad
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)Description copied from class:PGraphics( begin auto-generated from quad.xml ) A quad is a quadrilateral, a four sided polygon. It is similar to a rectangle, but the angles between its edges are not constrained to ninety degrees. The first pair of parameters (x1,y1) sets the first vertex and the subsequent pairs should proceed clockwise or counter-clockwise around the defined shape. ( end auto-generated )- Overrides:
quadin classPGraphics- Parameters:
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 corner
-
rectImpl
protected void rectImpl(float x1, float y1, float x2, float y2, float tl, float tr, float br, float bl)
-
ellipseImpl
public void ellipseImpl(float a, float b, float c, float d)- Overrides:
ellipseImplin classPGraphics
-
arcImpl
protected void arcImpl(float x, float y, float w, float h, float start, float stop, int mode)Description copied from class:PGraphicsStart and stop are in radians, converted by the parent function. Note that the radians can be greater (or less) than TWO_PI. This is so that an arc can be drawn that crosses zero mark, and the user will still collect $200.
-
box
public void box(float w, float h, float d)
-
sphere
public void sphere(float r)
Description copied from class:PGraphics( begin auto-generated from sphere.xml ) A sphere is a hollow ball made from tessellated triangles. ( end auto-generated )Advanced
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
- Overrides:
spherein classPGraphics- Parameters:
r- the radius of the sphere- See Also:
PGraphics.sphereDetail(int)
-
shape
protected void shape(PShape shape, float x, float y, float z)
-
shape
protected void shape(PShape shape, float x, float y, float z, float c, float d, float e)
-
loadShape
public PShape loadShape(String filename)
- Overrides:
loadShapein classPGraphics- Parameters:
filename- name of file to load, can be .svg or .obj- See Also:
PShape,PApplet.createShape()
-
textModeCheck
protected boolean textModeCheck(int mode)
- Overrides:
textModeCheckin classPGraphics
-
textAscent
public float textAscent()
Description copied from class:PGraphics( begin auto-generated from textAscent.xml ) Returns ascent of the current font at its current size. This information is useful for determining the height of the font above the baseline. For example, adding the textAscent() and textDescent() values will give you the total height of the line. ( end auto-generated )- Overrides:
textAscentin classPGraphics- See Also:
PGraphics.textDescent()
-
textDescent
public float textDescent()
Description copied from class:PGraphics( begin auto-generated from textDescent.xml ) Returns descent of the current font at its current size. This information is useful for determining the height of the font below the baseline. For example, adding the textAscent() and textDescent() values will give you the total height of the line. ( end auto-generated )- Overrides:
textDescentin classPGraphics- See Also:
PGraphics.textAscent()
-
textWidthImpl
protected float textWidthImpl(char[] buffer, int start, int stop)Description copied from class:PGraphicsImplementation of returning the text width of the chars [start, stop) in the buffer. Unlike the previous version that was inside PFont, this will return the size not of a 1 pixel font, but the actual current size.- Overrides:
textWidthImplin classPGraphics
-
handleTextSize
protected void handleTextSize(float size)
Description copied from class:PGraphicsSets the actual size. Called from textSizeImpl and from textFontImpl after setting the font.- Overrides:
handleTextSizein classPGraphics- Parameters:
size- size of the text, greater than zero
-
textLineImpl
protected void textLineImpl(char[] buffer, int start, int stop, float x, float y)Implementation of actual drawing for a line of text.- Overrides:
textLineImplin classPGraphics
-
textCharImpl
protected void textCharImpl(char ch, float x, float y)- Overrides:
textCharImplin classPGraphics
-
textCharModelImpl
protected void textCharModelImpl(processing.opengl.FontTexture.TextureInfo info, float x0, float y0, float x1, float y1)
-
textCharShapeImpl
protected void textCharShapeImpl(char ch, float x, float y)Ported from the implementation of textCharShapeImpl() in 1.5.1 No attempt has been made to optimize this code TODO: Implement a FontShape class where each glyph is tessellated and stored inside a larger PShapeOpenGL object (which needs to be expanded as new glyphs are added and exceed the initial capacity in a similar way as the textures in FontTexture work). When a string of text is to be rendered in shape mode, then the correct sequences of vertex indices are computed (akin to the texcoords in the texture case) and used to draw only those parts of the PShape object that are required for the text. Some issues of the original implementation probably remain, so they are reproduced below: Also a problem where some fonts seem to be a bit slight, as if the control points aren't being mapped quite correctly. Probably doing something dumb that the control points don't map to P5's control points. Perhaps it's returning b-spline data from the TrueType font? Though it seems like that would make a lot of garbage rather than just a little flattening. There also seems to be a bug that is causing a line (but not a filled triangle) back to the origin on some letters (i.e. a capital L when tested with Akzidenz Grotesk Light). But this won't be visible with the stroke shut off, so tabling that bug for now.
-
pushMatrix
public void pushMatrix()
Description copied from class:PGraphics( begin auto-generated from pushMatrix.xml ) Pushes the current transformation matrix onto the matrix stack. Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations. ( end auto-generated )
-
popMatrix
public void popMatrix()
Description copied from class:PGraphics( begin auto-generated from popMatrix.xml ) Pops the current transformation matrix off the matrix stack. Understanding pushing and popping requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations. ( end auto-generated )- Overrides:
popMatrixin classPGraphics- See Also:
PGraphics.pushMatrix()
-
translate
public void translate(float tx, float ty)Description copied from class:PGraphics( begin auto-generated from translate.xml ) Specifies an amount to displace objects within the display window. The x parameter specifies left/right translation, the y parameter specifies up/down translation, and the z parameter specifies translations toward/away from the screen. Using this function with the z parameter requires using P3D as a parameter in combination with size as shown in the above example. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling translate(50, 0) and then translate(20, 0) is the same as translate(70, 0). If translate() is called within draw(), the transformation is reset when the loop begins again. This function can be further controlled by the pushMatrix() and popMatrix(). ( end auto-generated )- Overrides:
translatein classPGraphics- Parameters:
tx- left/right translationty- up/down translation- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float)
-
translate
public void translate(float tx, float ty, float tz)
-
translateImpl
protected void translateImpl(float tx, float ty, float tz)
-
invTranslate
protected static void invTranslate(PMatrix3D matrix, float tx, float ty, float tz)
-
invTranslate
protected static void invTranslate(PMatrix2D matrix, float tx, float ty)
-
matrixScale
protected static float matrixScale(PMatrix matrix)
-
rotate
public void rotate(float angle)
Two dimensional rotation. Same as rotateZ (this is identical to a 3D rotation along the z-axis) but included for clarity -- it'd be weird for people drawing 2D graphics to be using rotateZ. And they might kick our a-- for the confusion.- Overrides:
rotatein classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PApplet.radians(float)
-
rotateX
public void rotateX(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateX.xml ) Rotates a shape around the x-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateX(PI/2) and then rotateX(PI/2) is the same as rotateX(PI). If rotateX() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the example above. ( end auto-generated )- Overrides:
rotateXin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotateY
public void rotateY(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateY.xml ) Rotates a shape around the y-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateY(PI/2) and then rotateY(PI/2) is the same as rotateY(PI). If rotateY() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the examples above. ( end auto-generated )- Overrides:
rotateYin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotateZ
public void rotateZ(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateZ.xml ) Rotates a shape around the z-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateZ(PI/2) and then rotateZ(PI/2) is the same as rotateZ(PI). If rotateZ() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the examples above. ( end auto-generated )- Overrides:
rotateZin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotate
public 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).
-
rotateImpl
protected void rotateImpl(float angle, float v0, float v1, float v2)
-
invRotate
protected static void invRotate(PMatrix3D matrix, float angle, float v0, float v1, float v2)
-
invRotate
protected static void invRotate(PMatrix2D matrix, float angle)
-
scale
public void scale(float s)
Same as scale(s, s, s).- Overrides:
scalein classPGraphics- Parameters:
s- percentage to scale the object- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.translate(float, float, float),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float)
-
scale
public void scale(float sx, float sy)Same as scale(sx, sy, 1).
-
scale
public void scale(float sx, float sy, float sz)Scale in three dimensions.
-
scaleImpl
protected void scaleImpl(float sx, float sy, float sz)Scale in three dimensions.
-
invScale
protected static void invScale(PMatrix3D matrix, float x, float y, float z)
-
invScale
protected static void invScale(PMatrix2D matrix, float x, float y)
-
shearX
public void shearX(float angle)
Description copied from class:PGraphics( begin auto-generated from shearX.xml ) Shears a shape around the x-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always sheared around their relative position to the origin and positive numbers shear objects in a clockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling shearX(PI/2) and then shearX(PI/2) is the same as shearX(PI). If shearX() is called within the draw(), the transformation is reset when the loop begins again.
Technically, shearX() multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by the pushMatrix() and popMatrix() functions. ( end auto-generated )- Overrides:
shearXin classPGraphics- Parameters:
angle- angle of shear specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.shearY(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float),PApplet.radians(float)
-
shearY
public void shearY(float angle)
Description copied from class:PGraphics( begin auto-generated from shearY.xml ) Shears a shape around the y-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always sheared around their relative position to the origin and positive numbers shear objects in a clockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling shearY(PI/2) and then shearY(PI/2) is the same as shearY(PI). If shearY() is called within the draw(), the transformation is reset when the loop begins again.
Technically, shearY() multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by the pushMatrix() and popMatrix() functions. ( end auto-generated )- Overrides:
shearYin classPGraphics- Parameters:
angle- angle of shear specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.shearX(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float),PApplet.radians(float)
-
resetMatrix
public void resetMatrix()
Description copied from class:PGraphics( begin auto-generated from resetMatrix.xml ) Replaces the current matrix with the identity matrix. The equivalent function in OpenGL is glLoadIdentity(). ( end auto-generated )- Overrides:
resetMatrixin classPGraphics- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.applyMatrix(PMatrix),PGraphics.printMatrix()
-
applyMatrix
public void applyMatrix(PMatrix2D source)
- Overrides:
applyMatrixin classPGraphics
-
applyMatrix
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)- Overrides:
applyMatrixin classPGraphics- Parameters:
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 multiplied
-
applyMatrix
public void applyMatrix(PMatrix3D source)
- Overrides:
applyMatrixin classPGraphics
-
applyMatrix
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)Apply a 4x4 transformation matrix to the modelview stack.- Overrides:
applyMatrixin classPGraphicsn03- 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 multiplied
-
applyMatrixImpl
protected void applyMatrixImpl(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)
-
begin2D
protected void begin2D()
-
end2D
protected void end2D()
-
getMatrix
public PMatrix3D getMatrix(PMatrix3D target)
Description copied from class:PGraphicsCopy the current transformation matrix into the specified target. Pass in null to create a new matrix.
-
setMatrix
public void setMatrix(PMatrix2D source)
Description copied from class:PGraphicsSet the current transformation to the contents of the specified source.
-
setMatrix
public void setMatrix(PMatrix3D source)
Set the current transformation to the contents of the specified source.
-
printMatrix
public void printMatrix()
Print the current model (or "transformation") matrix.- Overrides:
printMatrixin classPGraphics- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.resetMatrix(),PGraphics.applyMatrix(PMatrix)
-
pushProjection
public void pushProjection()
-
popProjection
public void popProjection()
-
resetProjection
public void resetProjection()
-
applyProjection
public void applyProjection(PMatrix3D mat)
-
applyProjection
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)
-
setProjection
public void setProjection(PMatrix3D mat)
-
orthoProjection
protected boolean orthoProjection()
-
nonOrthoProjection
protected boolean nonOrthoProjection()
-
same
protected static boolean same(float a, float b)
-
diff
protected static boolean diff(float a, float b)
-
zero
protected static boolean zero(float a)
-
nonZero
protected static boolean nonZero(float a)
-
beginCamera
public void beginCamera()
Set matrix mode to the camera matrix (instead of the current transformation matrix). This means applyMatrix, resetMatrix, etc. will affect the camera.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 arecamera(); // sets up the nice default camera transform resetMatrix(); // sets up the identity camera transform
So to rotate a camera a constant amount, you might trybeginCamera(); camera(); rotateY(PI / 8); endCamera();
-
endCamera
public void endCamera()
Record the current settings into the camera matrix, and set the matrix mode back to the current transformation matrix.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.
- Overrides:
endCamerain classPGraphics- See Also:
PGraphics.beginCamera(),PGraphics.camera(float, float, float, float, float, float, float, float, float)
-
camera
public void camera()
Set camera to the default settings.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.
- Overrides:
camerain classPGraphics- See Also:
PGraphics.beginCamera(),PGraphics.endCamera(),PGraphics.frustum(float, float, float, float, float, float)
-
camera
public 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().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 tocamera(); // 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.- Overrides:
camerain classPGraphics- Parameters:
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.0
-
printCamera
public void printCamera()
Print the current camera matrix.- Overrides:
printCamerain classPGraphics- See Also:
PGraphics.camera(float, float, float, float, float, float, float, float, float)
-
defaultCamera
protected void defaultCamera()
-
ortho
public void ortho()
Calls ortho() with the proper parameters for Processing's standard orthographic projection.
-
ortho
public 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.
-
ortho
public void ortho(float left, float right, float bottom, float top, float near, float far)Sets an orthographic projection.
-
perspective
public void perspective()
Calls perspective() with Processing's standard coordinate projection.Projection functions:
- frustrum()
- ortho()
- perspective()
This behavior is pretty much familiar from OpenGL, except where functions replace matrices, rather than multiplying against the previous.
- Overrides:
perspectivein classPGraphics
-
perspective
public void perspective(float fov, float aspect, float zNear, float zFar)Similar to gluPerspective(). Implementation based on Mesa's glu.c- Overrides:
perspectivein classPGraphics- Parameters:
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 plane
-
frustum
public 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.Implementation based on the explanation in the OpenGL blue book.
- Overrides:
frustumin classPGraphics- Parameters:
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 value- See Also:
PGraphics.camera(float, float, float, float, float, float, float, float, float),PGraphics.beginCamera(),PGraphics.endCamera(),PGraphics.perspective(float, float, float, float)
-
printProjection
public void printProjection()
Print the current projection matrix.- Overrides:
printProjectionin classPGraphics- See Also:
PGraphics.camera(float, float, float, float, float, float, float, float, float)
-
defaultPerspective
protected void defaultPerspective()
-
screenX
public float screenX(float x, float y)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenXin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mapped- See Also:
PGraphics.screenY(float, float, float),PGraphics.screenZ(float, float, float)
-
screenY
public float screenY(float x, float y)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenYin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mapped- See Also:
PGraphics.screenX(float, float, float),PGraphics.screenZ(float, float, float)
-
screenX
public float screenX(float x, float y, float z)
-
screenY
public float screenY(float x, float y, float z)
-
screenZ
public float screenZ(float x, float y, float z)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenZin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mappedz- 3D z-coordinate to be mapped- See Also:
PGraphics.screenX(float, float, float),PGraphics.screenY(float, float, float)
-
screenXImpl
protected float screenXImpl(float x, float y, float z)
-
screenXImpl
protected float screenXImpl(float x, float y, float z, float w)
-
screenYImpl
protected float screenYImpl(float x, float y, float z)
-
screenYImpl
protected float screenYImpl(float x, float y, float z, float w)
-
screenZImpl
protected float screenZImpl(float x, float y, float z)
-
screenZImpl
protected float screenZImpl(float x, float y, float z, float w)
-
modelX
public float modelX(float x, float y, float z)Description copied from class:PGraphics( begin auto-generated from modelX.xml ) Returns the three-dimensional X, Y, Z position in model space. This returns the X value for a given coordinate based on the current set of transformations (scale, rotate, translate, etc.) The X value can be used to place an object in space relative to the location of the original point once the transformations are no longer in use.
In the example, the modelX(), modelY(), and modelZ() functions record the location of a box in space after being placed using a series of translate and rotate commands. After popMatrix() is called, those transformations no longer apply, but the (x, y, z) coordinate returned by the model functions is used to place another box in the same location. ( end auto-generated )- Overrides:
modelXin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mappedz- 3D z-coordinate to be mapped- See Also:
PGraphics.modelY(float, float, float),PGraphics.modelZ(float, float, float)
-
modelY
public float modelY(float x, float y, float z)Description copied from class:PGraphics( begin auto-generated from modelY.xml ) Returns the three-dimensional X, Y, Z position in model space. This returns the Y value for a given coordinate based on the current set of transformations (scale, rotate, translate, etc.) The Y value can be used to place an object in space relative to the location of the original point once the transformations are no longer in use.
In the example, the modelX(), modelY(), and modelZ() functions record the location of a box in space after being placed using a series of translate and rotate commands. After popMatrix() is called, those transformations no longer apply, but the (x, y, z) coordinate returned by the model functions is used to place another box in the same location. ( end auto-generated )- Overrides:
modelYin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mappedz- 3D z-coordinate to be mapped- See Also:
PGraphics.modelX(float, float, float),PGraphics.modelZ(float, float, float)
-
modelZ
public float modelZ(float x, float y, float z)Description copied from class:PGraphics( begin auto-generated from modelZ.xml ) Returns the three-dimensional X, Y, Z position in model space. This returns the Z value for a given coordinate based on the current set of transformations (scale, rotate, translate, etc.) The Z value can be used to place an object in space relative to the location of the original point once the transformations are no longer in use.
In the example, the modelX(), modelY(), and modelZ() functions record the location of a box in space after being placed using a series of translate and rotate commands. After popMatrix() is called, those transformations no longer apply, but the (x, y, z) coordinate returned by the model functions is used to place another box in the same location. ( end auto-generated )- Overrides:
modelZin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mappedz- 3D z-coordinate to be mapped- See Also:
PGraphics.modelX(float, float, float),PGraphics.modelY(float, float, float)
-
popStyle
public void popStyle()
Description copied from class:PGraphics( 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. They allow you to change the style settings and later return to what you had. When a new style is started with pushStyle(), it builds on the current style information. The pushStyle() and popStyle() functions can be embedded to provide more control (see the second example above for a demonstration.) ( end auto-generated )- Overrides:
popStylein classPGraphics- See Also:
PGraphics.pushStyle()
-
strokeWeight
public void strokeWeight(float weight)
Description copied from class:PGraphics( begin auto-generated from strokeWeight.xml ) Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.
When drawing with P3D, series of connected lines (such as the stroke around a polygon, triangle, or ellipse) produce unattractive results when a thick stroke weight is set (see Issue 123). With P3D, the minimum and maximum values for strokeWeight() are controlled by the graphics card and the operating system's OpenGL implementation. For instance, the thickness may not go higher than 10 pixels. ( end auto-generated )- Overrides:
strokeWeightin classPGraphics- Parameters:
weight- the weight (in pixels) of the stroke- See Also:
PGraphics.stroke(int, float),PGraphics.strokeJoin(int),PGraphics.strokeCap(int)
-
strokeJoin
public void strokeJoin(int join)
Description copied from class:PGraphics( begin auto-generated from strokeJoin.xml ) Sets the style of the joints which connect line segments. These joints are either mitered, beveled, or rounded and specified with the corresponding parameters MITER, BEVEL, and ROUND. The default joint is MITER.
This function is not available with the P3D renderer, (see Issue 123). More information about the renderers can be found in the size() reference. ( end auto-generated )- Overrides:
strokeJoinin classPGraphics- Parameters:
join- either MITER, BEVEL, ROUND- See Also:
PGraphics.stroke(int, float),PGraphics.strokeWeight(float),PGraphics.strokeCap(int)
-
strokeCap
public void strokeCap(int cap)
Description copied from class:PGraphics( begin auto-generated from strokeCap.xml ) Sets the style for rendering line endings. These ends are either squared, extended, or rounded and specified with the corresponding parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND.
This function is not available with the P3D renderer (see Issue 123). More information about the renderers can be found in the size() reference. ( end auto-generated )- Overrides:
strokeCapin classPGraphics- Parameters:
cap- either SQUARE, PROJECT, or ROUND- See Also:
PGraphics.stroke(int, float),PGraphics.strokeWeight(float),PGraphics.strokeJoin(int),PApplet.size(int, int, String, String)
-
fillFromCalc
protected void fillFromCalc()
- Overrides:
fillFromCalcin classPGraphics
-
lights
public void lights()
Sets up an ambient and directional light using OpenGL. API taken from PGraphics3D.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- Overrides:
lightsin classPGraphics- See Also:
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()
-
noLights
public void noLights()
Disables lighting.- Overrides:
noLightsin classPGraphics- See Also:
PGraphics.lights()
-
ambientLight
public void ambientLight(float r, float g, float b)Add an ambient light based on the current color mode.- Overrides:
ambientLightin classPGraphics- Parameters:
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)- See Also:
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)
-
ambientLight
public void ambientLight(float r, float g, float b, float x, float y, float z)Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.- Overrides:
ambientLightin classPGraphicsx- x-coordinate of the lighty- y-coordinate of the lightz- z-coordinate of the light
-
directionalLight
public void directionalLight(float r, float g, float b, float dx, float dy, float dz)Description copied from class:PGraphics( begin auto-generated from directionalLight.xml ) Adds a directional light. Directional light comes from one direction and is stronger when hitting a surface squarely and weaker if it hits at a a gentle angle. After hitting a surface, a directional lights scatters in all directions. Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The affect of the v1, v2, and v3 parameters is determined by the current color mode. The nx, ny, and nz parameters specify the direction the light is facing. For example, setting ny to -1 will cause the geometry to be lit from below (the light is facing directly upward). ( end auto-generated )- Overrides:
directionalLightin classPGraphics- Parameters:
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-axis- See Also:
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)
-
pointLight
public void pointLight(float r, float g, float b, float x, float y, float z)Description copied from class:PGraphics( begin auto-generated from pointLight.xml ) Adds a point light. Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The affect of the v1, v2, and v3 parameters is determined by the current color mode. The x, y, and z parameters set the position of the light. ( end auto-generated )- Overrides:
pointLightin classPGraphics- Parameters:
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 light- See Also:
PGraphics.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)
-
spotLight
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)Description copied from class:PGraphics( begin auto-generated from spotLight.xml ) Adds a spot light. Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The affect of the v1, v2, and v3 parameters is determined by the current color mode. The x, y, and z parameters specify the position of the light and nx, ny, nz specify the direction or light. The angle parameter affects angle of the spotlight cone. ( end auto-generated )- Overrides:
spotLightin classPGraphics- Parameters:
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 cone- See Also:
PGraphics.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)
-
lightFalloff
public void lightFalloff(float constant, float linear, float quadratic)Set the light falloff rates for the last light that was created. Default is lightFalloff(1, 0, 0).- Overrides:
lightFalloffin classPGraphics- Parameters:
constant- constant value or determining fallofflinear- linear value for determining falloffquadratic- quadratic value for determining falloff- See Also:
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),PGraphics.lightSpecular(float, float, float)
-
lightSpecular
public void lightSpecular(float x, float y, float z)Set the specular color of the last light created.- Overrides:
lightSpecularin classPGraphics- Parameters:
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)- See Also:
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)
-
enableLighting
protected void enableLighting()
-
disableLighting
protected void disableLighting()
-
lightPosition
protected void lightPosition(int num, float x, float y, float z, boolean dir)
-
lightNormal
protected void lightNormal(int num, float dx, float dy, float dz)
-
lightAmbient
protected void lightAmbient(int num, float r, float g, float b)
-
noLightAmbient
protected void noLightAmbient(int num)
-
lightDiffuse
protected void lightDiffuse(int num, float r, float g, float b)
-
noLightDiffuse
protected void noLightDiffuse(int num)
-
lightSpecular
protected void lightSpecular(int num, float r, float g, float b)
-
noLightSpecular
protected void noLightSpecular(int num)
-
lightFalloff
protected void lightFalloff(int num, float c0, float c1, float c2)
-
noLightFalloff
protected void noLightFalloff(int num)
-
lightSpot
protected void lightSpot(int num, float angle, float exponent)
-
noLightSpot
protected void noLightSpot(int num)
-
backgroundImpl
protected void backgroundImpl(PImage image)
Description copied from class:PGraphicsActually set the background image. This is separated from the error handling and other semantic goofiness that is shared across renderers.- Overrides:
backgroundImplin classPGraphics
-
backgroundImpl
protected void backgroundImpl()
Description copied from class:PGraphicsActual implementation of clearing the background, now that the internal variables for background color have been set. Called by the backgroundFromCalc() method, which is what all the other background() methods call once the work is done.- Overrides:
backgroundImplin classPGraphics
-
report
protected void report(String where)
Report on anything from glError(). Don't use this inside glBegin/glEnd otherwise it'll throw an GL_INVALID_OPERATION error.
-
isGL
public boolean isGL()
Description copied from class:PGraphicsReturn true if this renderer does rendering through OpenGL. Defaults to false.
-
loadPixels
public void loadPixels()
Description copied from class:PImage( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array. This function must always be called before reading from or writing to pixels[].
renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must first call loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. ( end auto-generated )Advanced
Call this when you want to mess with the pixels[] array. For subclasses where the pixels[] buffer isn't set by default, this should copy all data into the pixels[] array- Overrides:
loadPixelsin classPImage
-
allocatePixels
protected void allocatePixels()
-
readPixels
protected void readPixels()
-
drawPixels
protected void drawPixels(int x, int y, int w, int h)
-
get
public int get(int x, int y)Description copied from class:PImage( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Use the x and y parameters to get the value of one pixel. Get a section of the display window by specifying an additional width and height parameter. When getting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. For example, even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB format.
Getting the color of a single pixel with get(x, y) is easy, but not as fast as grabbing the data directly from pixels[]. The equivalent statement to get(x, y) using pixels[] is pixels[y*width+x]. See the reference for pixels[] for more information. ( end auto-generated )Advanced
Returns an ARGB "color" type (a packed 32 bit int with the color. If the coordinate is outside the image, zero is returned (black, but completely transparent).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.
- Overrides:
getin classPImage- Parameters:
x- x-coordinate of the pixely- y-coordinate of the pixel- See Also:
PApplet.set(int, int, int),PApplet.pixels,PApplet.copy(PImage, int, int, int, int, int, int, int, int)
-
getImpl
protected void getImpl(int sourceX, int sourceY, int sourceWidth, int sourceHeight, PImage target, int targetX, int targetY)Description copied from class:PImageInternal function to actually handle getting a block of pixels that has already been properly cropped to a valid region. That is, x/y/w/h are guaranteed to be inside the image space, so the implementation can use the fastest possible pixel copying method.
-
set
public void set(int x, int y, int argb)Description copied from class:PImage( 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. The color parameter is affected by the current color mode (the default is RGB values from 0 to 255). When setting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
Setting the color of a single pixel with set(x, y) is easy, but not as fast as putting the data directly into pixels[]. The equivalent statement to set(x, y, #000000) using pixels[] is pixels[y*width+x] = #000000. See the reference for pixels[] for more information. ( end auto-generated )- Overrides:
setin classPImage- Parameters:
x- x-coordinate of the pixely- y-coordinate of the pixelargb- any value of the color datatype- See Also:
PImage.get(int, int, int, int),PImage.pixels,PImage.copy(PImage, int, int, int, int, int, int, int, int)
-
setImpl
protected void setImpl(PImage sourceImage, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int targetX, int targetY)
Description copied from class:PImageInternal function to actually handle setting a block of pixels that has already been properly cropped from the image to a valid region.
-
save
public boolean save(String filename)
Description copied from class:PImage( begin auto-generated from PImage_save.xml ) Saves the image into a file. Append a file extension to the name of the file, to indicate the file format to be used: either TIFF (.tif), TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu.
To save an image created within the code, rather than through loading, it's necessary to make the image with the createImage() function so it is aware of the location of the program and can therefore save the file to the right place. See the createImage() reference for more information. ( end auto-generated )Advanced
Save this image to disk.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.
-
processImageBeforeAsyncSave
protected void processImageBeforeAsyncSave(PImage image)
- Overrides:
processImageBeforeAsyncSavein classPGraphics
-
completeFinishedPixelTransfers
protected static void completeFinishedPixelTransfers()
-
completeAllPixelTransfers
protected static void completeAllPixelTransfers()
-
awaitAsyncSaveCompletion
protected void awaitAsyncSaveCompletion(String filename)
Description copied from class:PGraphicsIf there is running async save task for this file, blocks until it completes. Has to be called on main thread because OpenGL overrides this and calls GL.- Overrides:
awaitAsyncSaveCompletionin classPGraphics
-
loadTexture
public void loadTexture()
-
updateTexture
public void updateTexture()
-
updateTexture
public void updateTexture(int x, int y, int w, int h)
-
updateDisplay
public void updateDisplay()
-
loadTextureImpl
protected void loadTextureImpl(int sampling, boolean mipmap)
-
createPTexture
protected void createPTexture()
-
swapOffscreenTextures
protected void swapOffscreenTextures()
-
drawTexture
protected void drawTexture()
-
drawTexture
protected void drawTexture(int x, int y, int w, int h)
-
drawPTexture
protected void drawPTexture()
-
mask
public void mask(PImage alpha)
Description copied from class:PImage( 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. This mask image should only contain grayscale data, but only the blue color channel is used. The mask image needs to be the same size as the image to which it is applied.
In addition to using a mask image, an integer array containing the alpha channel data can be specified directly. This method is useful for creating dynamically generated alpha masks. This array must be of the same length as the target image's pixels array and should contain only grayscale data of values between 0-255. ( end auto-generated )Advanced
Set alpha channel for an image. Black colors in the source image will make the destination image completely transparent, and white will make things fully opaque. Gray values will be in-between steps.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.
-
filter
public void filter(int kind)
This is really inefficient and not a good idea in OpenGL. Use get() and set() with a smaller image area, or call the filter on an image instead, and then draw that.
-
filter
public void filter(int kind, float param)This is really inefficient and not a good idea in OpenGL. Use get() and set() with a smaller image area, or call the filter on an image instead, and then draw that.
-
filter
public void filter(PShader shader)
-
copy
public void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)Description copied from class:PImage( begin auto-generated from PImage_copy.xml ) Copies a region of pixels from one image into another. If the source and destination regions aren't the same size, it will automatically resize source pixels to fit the specified target region. No alpha information is used in the process, however if the source image has an alpha channel set, it will be copied as well.
As of release 0149, this function ignores imageMode(). ( end auto-generated )- Overrides:
copyin classPImage- Parameters:
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 height- See Also:
PGraphics.alpha(int),PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
-
copy
public void copy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
-
blendModeImpl
protected void blendModeImpl()
Allows to set custom blend modes for the entire scene, using openGL. Reference article about blending modes: http://www.pegtop.net/delphi/articles/blendmodes/ DIFFERENCE, HARD_LIGHT, SOFT_LIGHT, OVERLAY, DODGE, BURN modes cannot be implemented in fixed-function pipeline because they require conditional blending and non-linear blending equations.- Overrides:
blendModeImplin classPGraphics
-
getTexture
public Texture getTexture()
Not an approved function, this will change or be removed in the future. This utility method returns the texture associated to the renderer's. drawing surface, making sure is updated to reflect the current contents off the screen (or offscreen drawing surface).
-
getTexture
public Texture getTexture(boolean load)
Not an approved function either, don't use it.
-
getTexture
public Texture getTexture(PImage img)
Not an approved function, this will change or be removed in the future. This utility method returns the texture associated to the image. creating and/or updating it if needed.- Parameters:
img- the image to have a texture metadata associated to it
-
getFrameBuffer
public FrameBuffer getFrameBuffer()
Not an approved function, test its use in libraries to grab the FB objects for offscreen PGraphics.
-
getFrameBuffer
public FrameBuffer getFrameBuffer(boolean multi)
-
bindFrontTexture
protected void bindFrontTexture()
-
unbindFrontTexture
protected void unbindFrontTexture()
-
addTexture
protected Texture addTexture(PImage img)
This utility method creates a texture for the provided image, and adds it to the metadata cache of the image.- Parameters:
img- the image to have a texture metadata associated to it
-
addTexture
protected Texture addTexture(PImage img, Texture.Parameters params)
-
checkTexture
protected void checkTexture(Texture tex)
-
deleteSurfaceTextures
protected void deleteSurfaceTextures()
-
checkGLThread
protected boolean checkGLThread()
-
resize
public void resize(int wide, int high)Description copied from class:PImage( begin auto-generated from PImage_resize.xml ) Resize the image to a new width and height. To make the image scale proportionally, use 0 as the value for the wide or high parameter. For instance, to make the width of an image 150 pixels, and change the height using the same proportion, use resize(150, 0).
Even though a PGraphics is technically a PImage, it is not possible to rescale the image data found in a PGraphics. (It's simply not possible to do this consistently across renderers: technically infeasible with P3D, or what would it even do with PDF?) If you want to resize PGraphics content, first get a copy of its image data using the get() method, and call resize() on the PImage that is returned. ( end auto-generated )- Overrides:
resizein classPImage- Parameters:
wide- the resized image widthhigh- the resized image height- See Also:
PImage.get(int, int, int, int)
-
initPrimary
protected void initPrimary()
-
beginOnscreenDraw
protected void beginOnscreenDraw()
-
endOnscreenDraw
protected void endOnscreenDraw()
-
initOffscreen
protected void initOffscreen()
-
beginOffscreenDraw
protected void beginOffscreenDraw()
-
endOffscreenDraw
protected void endOffscreenDraw()
-
setViewport
protected void setViewport()
-
checkSettings
protected void checkSettings()
- Overrides:
checkSettingsin classPGraphics
-
setGLSettings
protected void setGLSettings()
-
getGLParameters
protected void getGLParameters()
-
loadShader
public PShader loadShader(String fragFilename)
Description copied from class:PGraphics( begin auto-generated from loadShader.xml ) This is a new reference entry for Processing 2.0. It will be updated shortly. ( end auto-generated )- Overrides:
loadShaderin classPGraphics- Parameters:
fragFilename- name of fragment shader file
-
loadShader
public PShader loadShader(String fragFilename, String vertFilename)
- Overrides:
loadShaderin classPGraphicsvertFilename- name of vertex shader file
-
shader
public void shader(PShader shader)
Description copied from class:PGraphics( begin auto-generated from shader.xml ) This is a new reference entry for Processing 2.0. It will be updated shortly. ( end auto-generated )
-
shader
public void shader(PShader shader, int kind)
-
resetShader
public void resetShader()
Description copied from class:PGraphics( begin auto-generated from resetShader.xml ) This is a new reference entry for Processing 2.0. It will be updated shortly. ( end auto-generated )- Overrides:
resetShaderin classPGraphics
-
resetShader
public void resetShader(int kind)
- Overrides:
resetShaderin classPGraphics- Parameters:
kind- type of shader, either POINTS, LINES, or TRIANGLES
-
getPolyShader
protected PShader getPolyShader(boolean lit, boolean tex)
-
getLineShader
protected PShader getLineShader()
-
getPointShader
protected PShader getPointShader()
-
expandArraySize
protected static int expandArraySize(int currSize, int newMinSize)
-
newAttributeMap
protected static PGraphicsOpenGL.AttributeMap newAttributeMap()
-
newInGeometry
protected static PGraphicsOpenGL.InGeometry newInGeometry(PGraphicsOpenGL pg, PGraphicsOpenGL.AttributeMap attr, int mode)
-
newTessGeometry
protected static PGraphicsOpenGL.TessGeometry newTessGeometry(PGraphicsOpenGL pg, PGraphicsOpenGL.AttributeMap attr, int mode)
-
newTexCache
protected static PGraphicsOpenGL.TexCache newTexCache(PGraphicsOpenGL pg)
-
-