Class OGL11Graphics
- All Implemented Interfaces:
OGLVersioned
- Direct Known Subclasses:
OGL12Graphics
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classInformation about this context implementation.Nested classes/interfaces inherited from class OGLGraphics
OGLGraphics.ErrorHandlingType, OGLGraphics.Info, OGLGraphics.Options -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(AccumOperation operation, float value) Performs an accumulation buffer operation.voidRestores attributes from the attribute stack.voidattribPush(AttribType... attribs) Pushes an array of attributes onto the attribute stack.protected voidcheckLightId(int sourceId) Verifies that the light source id is valid.voidclear(boolean clearColorBuffer, boolean clearDepthBuffer, boolean clearStencilBuffer) Clears a bunch of current framebuffers.voidclear(boolean clearColorBuffer, boolean clearDepthBuffer, boolean clearAccumulationBuffer, boolean clearStencilBuffer) Clears a bunch of the current framebuffers.voidRestores attributes from the client attribute stack.voidclientAttribPush(ClientAttribType... attribs) Pushes a series of attributes onto the client attribute stack.protected OGLGraphics.InfoCalled once in order to fetch context info.Creates a new texture object.Creates a texture builder.voiddestroyTexture(OGLTexture texture) Destroys a texture object.voiddrawBitmap(OGLBitmap b, float offsetX, float offsetY, float incX, float incY) Draws a Bitmap at the current raster position and increments the raster position.voiddrawGeometryArray(GeometryType geometryType, int offset, int elementCount) Draws geometry using the current bound, enabled coordinate arrays/buffers as data.voiddrawGeometryElements(GeometryType geometryType, DataType dataType, int count, int offset) Draws geometry using the current bound, enabled coordinate arrays/buffers as data, plus an element buffer to describe the ordering.protected voidendFrame()Called on frame end - mostly does cleanup of objects that were abandoned in OpenGL.voidfinish()Tells the OpenGL implementation to finish all pending commands, and waits for it to do so.voidflush()Tells the OpenGL implementation to finish all pending commands in finite time.protected OGLTexturegetCurrentActiveTextureState(int targetId) Gets the current texture state.protected intprotected Integerprotected MatrixStackprotected MatrixStackgetCurrentMatrixStack(int id) intGets the current pixel packing alignment value (GL-to-application).intGets the current pixel unpacking alignment value (application-to-GL).getTexture(TextureTargetType target) Gets a texture currently bound to a target.voidmatrixAspectOrtho(float targetAspect, float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by an aspect-adjusted orthographic projection matrix using the canvas dimensions.voidmatrixFrustum(float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by a frustum projection matrix.voidmatrixGet(MatrixMode matrixType, float[] outArray) Reads a current matrix into an array.voidmatrixGet(MatrixMode matrixType, Matrix4F matrix) Reads a current matrix into a matrix.voidmatrixLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) Multiplies a "look at" matrix to the current matrix.voidmatrixMode(MatrixMode mode) Sets the current matrix for matrix operations.voidmatrixMultiply(float[] matrixArray) Multiplies a matrix into the current selected matrix from a column-major array into.voidmatrixMultiply(Matrix4F matrix) Multiplies a matrix into the current selected matrix.voidmatrixOrtho(float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by an orthographic projection matrix.voidmatrixPerspective(float fov, float aspect, float near, float far) Multiplies the current matrix by a symmetric perspective projection matrix.voidPops the current matrix off of the current selected stack.voidPushes a copy of the current matrix onto the current selected stack.voidLoads the identity matrix into the current selected matrix.voidmatrixRotateX(float degrees) Rotates the current matrix by an amount of DEGREES around the X-Axis.voidmatrixRotateY(float degrees) Rotates the current matrix by an amount of DEGREES around the Y-Axis.voidmatrixRotateZ(float degrees) Rotates the current matrix by an amount of DEGREES around the Z-Axis.voidmatrixScale(float x, float y, float z) Scales the current matrix by a set of scalars that correspond to each axis.voidmatrixSet(float[] matrixArray) Loads a matrix's contents from a column-major array into the current selected matrix.voidLoads a matrix's contents into the current selected matrix.voidmatrixTranslate(float x, float y, float z) Translates the current matrix by a set of units.voidreadFrameBuffer(ByteBuffer imageData, ColorFormat colorFormat, int x, int y, int width, int height) Reads from the current-bound frame buffer into a target buffer.protected MatrixStackvoidsetAutoNormalGen(boolean enabled) Sets if normal vectors are generated automatically when geometry is submitted to the OpenGL geometry pipeline.voidsetBackFillMode(FillMode mode) Set back polygon fill mode.voidsetBlendingEnabled(boolean enabled) Sets if blending is enabled.voidsetBlendingFunc(BlendArg source, BlendArg destination) Sets the current blending function.voidsetBlendingFunc(BlendFunc func) Sets the current blending function.voidsetClearAccum(float clearRed, float clearGreen, float clearBlue, float clearAlpha) Sets the clear color for the accumulation buffer.voidsetClearColor(float clearRed, float clearGreen, float clearBlue, float clearAlpha) Sets the clear color.voidsetClearDepth(double depthValue) Sets depth clear value.voidsetClearStencil(int mask) Sets the stencil mask clear value.voidsetColor(float red, float green, float blue, float alpha) Sets the current color used for drawing polygons and other geometry.voidSets the current color used for drawing polygons and other geometry.voidsetColorARGB(int argb) Sets the current color used for drawing polygons and other geometry using an ARGB integer.voidsetColorArrayEnabled(boolean enable) Enables or disables the processing of bound vertex color arrays.voidsetColorArrayPointer(DataType dataType, int width, int stride, int offset) Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for colors.voidsetColorMask(boolean enabled) Sets if all of the components of the color buffer get written to.voidsetColorMask(boolean red, boolean green, boolean blue, boolean alpha) Sets if each color component gets written to the color buffer.protected voidsetCurrentActiveTextureState(int targetId, OGLTexture texture) Sets the current texture state.protected voidsetCurrentActiveTextureUnitState(int unit) Sets the current texture unit state.protected voidsetCurrentMatrixId(Integer currentMatrixId) Sets the current matrix id.voidsetDepthFunc(LogicFunc func) Set depth comparison function.voidsetDepthMask(boolean enabled) Sets if the depth buffer is enabled for writing.voidsetDepthTestEnabled(boolean enabled) Sets if the depth test is enabled or not for incoming fragments.voidsetFaceCullingEnabled(boolean enabled) Sets if face culling is enabled.voidsetFaceCullingSide(FaceSide side) Sets the face side(s) that are culled if face culling is enabled.voidsetFaceFront(FaceSide.Direction faceFront) Sets face winding to determine the front face.voidsetFillMode(FillMode mode) Set polygon fill mode.voidsetFogColor(float red, float green, float blue, float alpha) Sets the color of the fog.voidsetFogColor(int argb) Sets the current color used for fog as an ARGB integer.voidsetFogColor(Color color) Sets the color of the fog.voidsetFogDensity(float density) Sets the density factor for calculating fog.voidsetFogEnabled(boolean enabled) Sets if fog rendering is enabled or disabled.voidsetFogEnd(float end) Sets the starting point for calculating fog.voidsetFogExponent(Color color, float density) Sets most fog attributes at once for exponent fog.voidsetFogExponentSquared(Color color, float density) Sets most fog attributes at once for exponent squared fog.voidsetFogFormula(FogFormulaType formula) Sets the distance calculation formula for calculating fog cover.voidsetFogLinear(Color color, float start, float end) Sets most fog attributes at once for linear fog.voidsetFogStart(float start) Sets the starting point for calculating fog.voidSets the current buffer to read from for pixel read/copy operations.voidSets the current buffer to write to for pixel drawing/rasterizing operations.voidsetFrontFillMode(FillMode mode) Set front polygon fill mode.voidSets an OpenGL hint.voidSets the current light used for illuminating polygons and other geometry.voidsetLightAmbientColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a ambient component for a light.voidsetLightAmbientColor(int sourceId, int argbColor) Sets the color for a ambient component for a light.voidsetLightAmbientColor(int sourceId, Color color) Sets the color for a ambient component for a light.voidsetLightAttenuation(int sourceId, float constant, float linear, float quadratic) Sets the current light attenuation used for illuminating polygons and other geometry.voidsetLightDiffuseColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a diffuse component for a light.voidsetLightDiffuseColor(int sourceId, int argbColor) Sets the color for a diffuse component for a light.voidsetLightDiffuseColor(int sourceId, Color color) Sets the color for a diffuse component for a light.voidsetLightEnabled(int sourceId, boolean enable) Sets if certain lights are enabled.voidsetLightingEnabled(boolean enable) Sets if lighting is enabled.voidsetLightPosition(int sourceId, float x, float y, float z, float w) Sets the position of a light source.voidsetLightShadeType(LightShadeType shade) Sets the light shading type.voidsetLightSpecularColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a specular component for a light.voidsetLightSpecularColor(int sourceId, int argbColor) Sets the color for a specular component for a light.voidsetLightSpecularColor(int sourceId, Color color) Sets the color for a specular component for a light.voidsetLineSmoothingEnabled(boolean enabled) Enables/Disables line smoothing.voidsetLineWidth(float width) Sets the width of line geometry.voidsetMaterial(FaceSide faceside, OGLMaterial material) Sets the current material used for drawing polygons and other geometry, and will remain doing so until this is changed.voidsetMaterial(OGLMaterial material) Sets the current material used for drawing polygons and other geometry.voidsetMaterialAmbientColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material ambient color used for drawing polygons and other geometry.voidsetMaterialAmbientColor(FaceSide faceside, int argbColor) Sets the current material ambient color used for drawing polygons and other geometry.voidsetMaterialAmbientColor(FaceSide faceside, Color color) Sets the current material ambient color used for drawing polygons and other geometry.voidsetMaterialDiffuseColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material diffuse color used for drawing polygons and other geometry.voidsetMaterialDiffuseColor(FaceSide faceside, int argbColor) Sets the current material diffuse color used for drawing polygons and other geometry.voidsetMaterialDiffuseColor(FaceSide faceside, Color color) Sets the current material diffuse color used for drawing polygons and other geometry.voidsetMaterialEmissionColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material emission color used for drawing polygons and other geometry.voidsetMaterialEmissionColor(FaceSide faceside, int argbColor) Sets the current material emission color used for drawing polygons and other geometry.voidsetMaterialEmissionColor(FaceSide faceside, Color color) Sets the current material emission color used for drawing polygons and other geometry.voidsetMaterialShininessFactor(FaceSide faceside, float f) Sets the current material shininess factor used for drawing polygons and other geometry.voidsetMaterialSpecularColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material specular color used for drawing polygons and other geometry.voidsetMaterialSpecularColor(FaceSide faceside, int argbColor) Sets the current material specular color used for drawing polygons and other geometry.voidsetMaterialSpecularColor(FaceSide faceside, Color color) Sets the current material specular color used for drawing polygons and other geometry.voidsetNormalArrayEnabled(boolean enable) Enables or disables the processing of bound surface normal arrays.voidsetNormalArrayPointer(DataType dataType, int stride, int offset) Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for normal vectors.voidsetPixelPackAlignment(int alignment) Sets the current pixel packing alignment value (GL-to-application).voidsetPixelUnpackAlignment(int alignment) Sets the current pixel unpacking alignment value (application-to-GL).voidsetPointSize(float size) Sets the reference unit size for the diameter of Point geometry.voidsetPointSmoothingEnabled(boolean enabled) Enables/Disables smooth point geometry.voidsetRasterPosition(int x, int y, float z) Sets the next raster position for drawing bitmaps.voidsetScissorBounds(int x, int y, int width, int height) Sets the bounds of the scissor test area.voidsetScissorTestEnabled(boolean enabled) Sets if the scissor test is enabled.voidsetStencilMask(int mask) Sets the stencil mask.voidsetStencilTestEnabled(boolean enabled) Sets if the stencil test is enabled or not for incoming fragments.voidsetStencilTestFunc(LogicFunc func, int ref, int refmask) Sets the stencil function for the stencil test.voidsetStencilTestOperations(StencilTestFunc stencilFail, StencilTestFunc stencilDepthFail, StencilTestFunc stencilDepthPass) Sets the functions for what to do for each incoming fragment.voidsetTexGenEyePlane(TextureCoordType coord, float a, float b, float c, float d) Sets the eye plane equation for generating coordinates using the eye method.voidsetTexGenMode(TextureCoordType coord, TextureGenMode mode) Sets how texture coordinates are to be automatically generated.voidsetTexGenObjectPlane(TextureCoordType coord, float a, float b, float c, float d) Sets the object plane equation for generating coordinates using the object method.voidsetTexGenQEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the Q coordinate axis (I have no idea what the hell this could be).voidsetTexGenREnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the R coordinate axis (usually depth).voidsetTexGenSEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the S coordinate axis (usually width).voidsetTexGenTEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the T coordinate axis (usually height).voidsetTexture(TextureTargetType target, OGLTexture texture) Binds a texture object to the current active texture unit on the specified target.voidsetTextureCoordinateArrayEnabled(boolean enable) Enables or disables the processing of bound texture coordinate arrays.voidsetTextureCoordinateArrayPointer(DataType dataType, int width, int stride, int offset) Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for texture coordinates.voidsetTextureData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, TextureFormat format, int texlevel, int width, int border) Sends a texture to OpenGL's memory for the current texture bound to the specified target.voidsetTextureData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, TextureFormat format, int texlevel, int width, int height, int border) Sends a texture into OpenGL's memory for the current texture bound to the specified target.voidsetTextureDataFromReadBuffer(TextureTargetType target, TextureFormat format, int texlevel, int srcX, int srcY, int width, int border) Copies the contents of the current read frame buffer into the current texture bound to the specified target.voidsetTextureDataFromReadBuffer(TextureTargetType target, TextureFormat format, int texlevel, int srcX, int srcY, int width, int height, int border) Copies the contents of the current read frame buffer into the current texture bound to the specified target.voidsetTextureEnabled(TextureTargetType target, boolean enabled) Sets if a texture target is enabled for rendering or not.voidSets the texture environment mode to use for texel fragment coloring.voidsetTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter) Sets the filtering for the current texture bound to the specified target.voidsetTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, float anisotropy) Sets the filtering for the current texture bound to the specified target.voidsetTextureSubData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, int texlevel, int width, int xoffs) Sends a subset of data to the current texture bound to the specified target already in OpenGL's memory.voidsetTextureSubData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, int texlevel, int width, int height, int xoffs, int yoffs) Sends a subset of data to the current texture bound to the specified target already in OpenGL's memory.voidsetTextureSubDataFromReadBuffer(TextureTargetType target, int texlevel, int xoffset, int srcX, int srcY, int width) Copies the contents of the current read frame buffer into the current texture bound to the specified target already in OpenGL's memory.voidsetTextureSubDataFromReadBuffer(TextureTargetType target, int texlevel, int xoffset, int yoffset, int srcX, int srcY, int width, int height) Copies the contents of the current read frame buffer into the current texture bound to the specified target already in OpenGL's memory.voidsetTextureWrapping(TextureTargetType target, TextureWrapType wrapS) Sets the current wrapping for the current texture bound to the specified target.voidsetTextureWrapping(TextureTargetType target, TextureWrapType wrapS, TextureWrapType wrapT) Sets the current wrapping for the current texture bound to the specified target.voidsetVertexArrayEnabled(boolean enable) Enables or disables the processing of bound vertex arrays and/or buffers.voidsetVertexArrayPointer(DataType dataType, int width, int stride, int offset) Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for vertices.voidsetViewport(int x, int y, int width, int height) Sets the OpenGL viewport (Note: (0,0) is the lower-left corner).voidunsetTexture(TextureTargetType target) Unbinds a texture currently bound to a target.Methods inherited from class OGLGraphics
checkError, clearError, currentBlit, currentFrame, currentNanos, currentTime, currentTimeMillis, currentTimeStepMillis, currentTimeStepNanos, destroyObject, fromGLBool, getCanvasAspect, getCanvasHeight, getCanvasWidth, getFloat, getFloats, getGLErrorName, getInfo, getInt, getInts, handleUndeletedObjects, isCore, setClientFlag, setFlag, supports, toGLBool, verifyFeatureSupport, verifyNonCore
-
Constructor Details
-
OGL11Graphics
-
-
Method Details
-
getVersion
- Returns:
- the version that this object or value is available for (and higher).
-
getCurrentActiveTextureState
Gets the current texture state. Uses the current texture unit.- Parameters:
targetId- the texture target id.- Returns:
- the current texture, or null if no current.
- See Also:
-
setCurrentActiveTextureState
Sets the current texture state. Uses the current texture unit.- Parameters:
targetId- the texture target id.texture- the texture to set.- See Also:
-
getCurrentActiveTextureUnitState
protected int getCurrentActiveTextureUnitState()- Returns:
- the current "active" texture unit.
-
setCurrentActiveTextureUnitState
protected void setCurrentActiveTextureUnitState(int unit) Sets the current texture unit state.- Parameters:
unit- the current "active" texture unit to set.
-
getCurrentMatrixId
- Returns:
- the current matrix mode index.
-
setCurrentMatrixId
Sets the current matrix id.- Parameters:
currentMatrixId- the new current matrix id.
-
getCurrentMatrixStack
- Returns:
- the current matrix stack, or null if no current matrix.
-
getCurrentMatrixStack
- Parameters:
id- the matrix id.- Returns:
- the current matrix stack, or null if no current matrix.
-
resolveCurrentMatrixStack
- Returns:
- the current matrix stack.
- Throws:
GraphicsException- if no current matrix is set.
-
createInfo
Description copied from class:OGLGraphicsCalled once in order to fetch context info.- Specified by:
createInfoin classOGLGraphics- Returns:
- the info object.
-
endFrame
protected void endFrame()Description copied from class:OGLGraphicsCalled on frame end - mostly does cleanup of objects that were abandoned in OpenGL.- Specified by:
endFramein classOGLGraphics
-
clear
public void clear(boolean clearColorBuffer, boolean clearDepthBuffer, boolean clearAccumulationBuffer, boolean clearStencilBuffer) Clears a bunch of the current framebuffers.This is the non-core clear function, since it includes the accumulation buffer, optionally.
- Parameters:
clearColorBuffer- if true, clear the color buffer.clearDepthBuffer- if true, clear the depth buffer.clearAccumulationBuffer- if true, clear the accumulation buffer.clearStencilBuffer- if true, clear the stencil buffer.
-
setColor
Sets the current color used for drawing polygons and other geometry.- Parameters:
c- the color to use.
-
setColor
public void setColor(float red, float green, float blue, float alpha) Sets the current color used for drawing polygons and other geometry.- Parameters:
red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setColorARGB
public void setColorARGB(int argb) Sets the current color used for drawing polygons and other geometry using an ARGB integer.- Parameters:
argb- the 32-bit color as an integer.
-
setLightingEnabled
public void setLightingEnabled(boolean enable) Sets if lighting is enabled.- Parameters:
enable- true to enable, false to disable.
-
setLightShadeType
Sets the light shading type.- Parameters:
shade- the shading type.
-
checkLightId
protected void checkLightId(int sourceId) Verifies that the light source id is valid.- Parameters:
sourceId- the light source id.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightEnabled
public void setLightEnabled(int sourceId, boolean enable) Sets if certain lights are enabled.- Parameters:
sourceId- the light source id.enable- true to enable, false to disable.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLight
Sets the current light used for illuminating polygons and other geometry. This light will set all properties.- Parameters:
sourceId- the light source id. this cannot exceed the maximum number of lights that OpenGL can handle.light- the Light to use.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightAttenuation
public void setLightAttenuation(int sourceId, float constant, float linear, float quadratic) Sets the current light attenuation used for illuminating polygons and other geometry. This alters light intensity at varying distances from the light.- Parameters:
sourceId- the light source id. this cannot exceed the maximum number of lights that OpenGL can handle.constant- the constant coefficient.linear- the linear coefficient.quadratic- the quadratic coefficient.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightAmbientColor
Sets the color for a ambient component for a light.- Parameters:
sourceId- the light source id.color- the color to use.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightAmbientColor
public void setLightAmbientColor(int sourceId, int argbColor) Sets the color for a ambient component for a light.- Parameters:
sourceId- the light source id.argbColor- the ARGB color to set.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightAmbientColor
public void setLightAmbientColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a ambient component for a light.- Parameters:
sourceId- the light source id.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightDiffuseColor
Sets the color for a diffuse component for a light.- Parameters:
sourceId- the light source id.color- the color to use.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightDiffuseColor
public void setLightDiffuseColor(int sourceId, int argbColor) Sets the color for a diffuse component for a light.- Parameters:
sourceId- the light source id.argbColor- the ARGB color to set.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightDiffuseColor
public void setLightDiffuseColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a diffuse component for a light.- Parameters:
sourceId- the light source id.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightSpecularColor
Sets the color for a specular component for a light.- Parameters:
sourceId- the light source id.color- the color to use.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightSpecularColor
public void setLightSpecularColor(int sourceId, int argbColor) Sets the color for a specular component for a light.- Parameters:
sourceId- the light source id.argbColor- the ARGB color to set.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightSpecularColor
public void setLightSpecularColor(int sourceId, float red, float green, float blue, float alpha) Sets the color for a specular component for a light.- Parameters:
sourceId- the light source id.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setLightPosition
public void setLightPosition(int sourceId, float x, float y, float z, float w) Sets the position of a light source.- Parameters:
sourceId- the light source id.x- the x-axis position.y- the y-axis position.z- the z-axis position.w- if 0, the light is a directional one. If nonzero, positional.- Throws:
IllegalArgumentException- if the specified sourceId is not a valid one.
-
setMaterial
Sets the current material used for drawing polygons and other geometry. Depending on what colors are set on the Material object, not all of the material calls will be made. This applies the Material properties to both polygon sides, and will remain doing so until this is changed.- Parameters:
material- the material to use.
-
setMaterial
Sets the current material used for drawing polygons and other geometry, and will remain doing so until this is changed. Depending on what colors are set on the Material object, not all of the material calls will be made.- Parameters:
faceside- the face side to apply these properties to.material- the material to use.
-
setMaterialAmbientColor
-
setMaterialAmbientColor
Sets the current material ambient color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.argbColor- the ARGB color to set.
-
setMaterialAmbientColor
public void setMaterialAmbientColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material ambient color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setMaterialDiffuseColor
-
setMaterialDiffuseColor
Sets the current material diffuse color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.argbColor- the ARGB color to set.
-
setMaterialDiffuseColor
public void setMaterialDiffuseColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material diffuse color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setMaterialSpecularColor
-
setMaterialSpecularColor
Sets the current material specular color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.argbColor- the ARGB color to set.
-
setMaterialSpecularColor
public void setMaterialSpecularColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material specular color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setMaterialEmissionColor
-
setMaterialEmissionColor
Sets the current material emission color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.argbColor- the ARGB color to set.
-
setMaterialEmissionColor
public void setMaterialEmissionColor(FaceSide faceside, float red, float green, float blue, float alpha) Sets the current material emission color used for drawing polygons and other geometry.- Parameters:
faceside- the face side to apply these properties to.red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setMaterialShininessFactor
Sets the current material shininess factor used for drawing polygons and other geometry. As this number gets higher,- Parameters:
faceside- the face side to apply these properties to.f- the factor.
-
setFogEnabled
public void setFogEnabled(boolean enabled) Sets if fog rendering is enabled or disabled.- Parameters:
enabled- true to enable, false to disable.
-
setFogLinear
Sets most fog attributes at once for linear fog.- Parameters:
color- the color of the fog.start- the unit of space for the fog start (before that is no fog).end- the unit of space for the fog end (after that is solid color).- See Also:
-
setFogExponent
Sets most fog attributes at once for exponent fog.- Parameters:
color- the color of the fog.density- the density factor to use.- See Also:
-
setFogExponentSquared
Sets most fog attributes at once for exponent squared fog.- Parameters:
color- the color of the fog.density- the density factor to use.- See Also:
-
setFogColor
Sets the color of the fog.- Parameters:
color- the color of the fog.
-
setFogColor
public void setFogColor(int argb) Sets the current color used for fog as an ARGB integer.- Parameters:
argb- the 32-bit color as an integer.
-
setFogColor
public void setFogColor(float red, float green, float blue, float alpha) Sets the color of the fog.- Parameters:
red- the red component of the color to use (0 to 1).green- the green component of the color to use (0 to 1).blue- the blue component of the color to use (0 to 1).alpha- the alpha component of the color to use (0 to 1).
-
setFogFormula
Sets the distance calculation formula for calculating fog cover.- Parameters:
formula- the formula to use.
-
setFogDensity
public void setFogDensity(float density) Sets the density factor for calculating fog. Only works for the exponential formulas.- Parameters:
density- the density factor to use.
-
setFogStart
public void setFogStart(float start) Sets the starting point for calculating fog. The value passed in is from the eye.- Parameters:
start- the unit of space for the fog start (before that is no fog).
-
setFogEnd
public void setFogEnd(float end) Sets the starting point for calculating fog. The value passed in is from the eye.- Parameters:
end- the unit of space for the fog end (after that is solid color).
-
setTextureEnabled
Sets if a texture target is enabled for rendering or not.- Parameters:
target- the texture target.enabled- true to enable, false to disable.
-
setTextureEnvironment
Sets the texture environment mode to use for texel fragment coloring. This is usually REPLACE, by default. Only viable in the fixed pipeline.- Parameters:
mode- the texture mode.
-
setTexGenSEnabled
public void setTexGenSEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the S coordinate axis (usually width).- Parameters:
enabled- true to enable, false to disable.
-
setTexGenTEnabled
public void setTexGenTEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the T coordinate axis (usually height).- Parameters:
enabled- true to enable, false to disable.
-
setTexGenREnabled
public void setTexGenREnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the R coordinate axis (usually depth).- Parameters:
enabled- true to enable, false to disable.
-
setTexGenQEnabled
public void setTexGenQEnabled(boolean enabled) Sets if texture coordinates are to be automatically generated for the Q coordinate axis (I have no idea what the hell this could be).- Parameters:
enabled- true to enable, false to disable.
-
setTexGenMode
Sets how texture coordinates are to be automatically generated.- Parameters:
coord- the texture coordinate to set the mode for.mode- the generation function.
-
setTexGenEyePlane
Sets the eye plane equation for generating coordinates using the eye method.- Parameters:
coord- the texture coordinate to set the mode for.a- the plane A coordinate coefficient.b- the plane B coordinate coefficient.c- the plane C coordinate coefficient.d- the plane D coordinate coefficient.
-
setTexGenObjectPlane
Sets the object plane equation for generating coordinates using the object method.- Parameters:
coord- the texture coordinate to set the mode for.a- the plane A coordinate coefficient.b- the plane B coordinate coefficient.c- the plane C coordinate coefficient.d- the plane D coordinate coefficient.
-
setAutoNormalGen
public void setAutoNormalGen(boolean enabled) Sets if normal vectors are generated automatically when geometry is submitted to the OpenGL geometry pipeline.- Parameters:
enabled- true to enable, false to disable.
-
attribPush
Pushes an array of attributes onto the attribute stack.- Parameters:
attribs- the list of attributes to preserve.
-
attribPop
public void attribPop()Restores attributes from the attribute stack. -
clientAttribPush
Pushes a series of attributes onto the client attribute stack.- Parameters:
attribs- the list of attributes to preserve.
-
clientAttribPop
public void clientAttribPop()Restores attributes from the client attribute stack. -
setClearAccum
public void setClearAccum(float clearRed, float clearGreen, float clearBlue, float clearAlpha) Sets the clear color for the accumulation buffer. The accumulation buffer is filled with this color upon clear.- Parameters:
clearRed- the red component of the color to use (0 to 1).clearGreen- the green component of the color to use (0 to 1).clearBlue- the blue component of the color to use (0 to 1).clearAlpha- the alpha component of the color to use (0 to 1).
-
accumulate
Performs an accumulation buffer operation. What happens with accum buffer contents differs based on the current color buffers for reading and writing, and the desired operation.- Parameters:
operation- the accum buffer operation.value- the value scalar for the operation.- See Also:
-
setRasterPosition
public void setRasterPosition(int x, int y, float z) Sets the next raster position for drawing bitmaps. Remember, (0,0) is the lower left edge of the window.- Parameters:
x- the screen x-coordinate.y- the screen y-coordinate.z- the screen z-coordinate.
-
drawBitmap
Draws a Bitmap at the current raster position and increments the raster position.- Parameters:
b- the Bitmap to draw ((0,0) is the lower-left).offsetX- the offset from the current raster position, x-coordinate.offsetY- the offset from the current raster position, y-coordinate.incX- what to increment the raster position x-coordinate by after the draw.incY- what to increment the raster position y-coordinate by after the draw.
-
setVertexArrayEnabled
public void setVertexArrayEnabled(boolean enable) Enables or disables the processing of bound vertex arrays and/or buffers.- Parameters:
enable- true to enable, false to disable.
-
setVertexArrayPointer
Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for vertices.- Parameters:
dataType- the data type contained in the buffer that will be read (calculates actual sizes of data).width- the width of a full set of coordinates (3-dimensional vertices = 3).stride- the distance (in elements) between each vertex.offset- the offset in each stride where each vertex starts.- See Also:
-
setTextureCoordinateArrayEnabled
public void setTextureCoordinateArrayEnabled(boolean enable) Enables or disables the processing of bound texture coordinate arrays.- Parameters:
enable- true to enable, false to disable.
-
setTextureCoordinateArrayPointer
Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for texture coordinates.- Parameters:
dataType- the data type contained in the buffer that will be read (calculates actual sizes of data).width- the width of a full set of coordinates (2-dimensional coords = 2).stride- the distance (in elements) between each coordinate group.offset- the offset in each stride where each coordinate starts.- See Also:
-
setColorArrayEnabled
public void setColorArrayEnabled(boolean enable) Enables or disables the processing of bound vertex color arrays.- Parameters:
enable- true to enable, false to disable.
-
setColorArrayPointer
Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for colors.- Parameters:
dataType- the data type contained in the buffer that will be read (calculates actual sizes of data).width- the width of a full set of color components (4-component color = 4).stride- the distance (in elements) between each color.offset- the offset in each stride where each color starts.- See Also:
-
setNormalArrayEnabled
public void setNormalArrayEnabled(boolean enable) Enables or disables the processing of bound surface normal arrays.- Parameters:
enable- true to enable, false to disable.
-
setNormalArrayPointer
Sets what positions in the currentBufferTargetType.GEOMETRY-bound buffer or array are used to draw polygonal information: This sets the attribute pointer for normal vectors. Always assumes 3-dimensional vectors.- Parameters:
dataType- the data type contained in the buffer that will be read (calculates actual sizes of data).stride- the distance (in elements) between each normal.offset- the offset in each stride where each normal starts.- See Also:
-
matrixMode
Sets the current matrix for matrix operations.- Parameters:
mode- the matrix mode to set.- Throws:
UnsupportedOperationException- if matrix modes are unavailable in this version (core implementation).NullPointerException- if the mode is null.
-
matrixReset
public void matrixReset()Loads the identity matrix into the current selected matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations. -
matrixPush
public void matrixPush()Pushes a copy of the current matrix onto the current selected stack.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations. -
matrixPop
public void matrixPop()Pops the current matrix off of the current selected stack.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations. -
matrixGet
Reads a current matrix into an array.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrixType- the type of matrix to load.outArray- the output array. Must be length 16 or greater.- Throws:
ArrayIndexOutOfBoundsException- if the array length is less than 16.UnsupportedOperationException- if matrix modes are unavailable in this version (core implementation).
-
matrixGet
Reads a current matrix into a matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrixType- the type of matrix to load.matrix- the output matrix.- Throws:
UnsupportedOperationException- if matrix modes are unavailable in this version (core implementation).
-
matrixSet
public void matrixSet(float[] matrixArray) Loads a matrix's contents from a column-major array into the current selected matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrixArray- the column-major cells of a matrix.
-
matrixSet
Loads a matrix's contents into the current selected matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrix- the matrix to read from.
-
matrixMultiply
public void matrixMultiply(float[] matrixArray) Multiplies a matrix into the current selected matrix from a column-major array into.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrixArray- the column-major cells of a matrix.
-
matrixMultiply
Multiplies a matrix into the current selected matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrix- the matrix to read from.
-
matrixTranslate
public void matrixTranslate(float x, float y, float z) Translates the current matrix by a set of units. This is applied via multiplication with the current matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
x- the x-axis translation.y- the y-axis translation.z- the z-axis translation.
-
matrixRotateX
public void matrixRotateX(float degrees) Rotates the current matrix by an amount of DEGREES around the X-Axis. This is applied via multiplication with the current matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
degrees- the amount of degrees.
-
matrixRotateY
public void matrixRotateY(float degrees) Rotates the current matrix by an amount of DEGREES around the Y-Axis. This is applied via multiplication with the current matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
degrees- the amount of degrees.
-
matrixRotateZ
public void matrixRotateZ(float degrees) Rotates the current matrix by an amount of DEGREES around the Z-Axis. This is applied via multiplication with the current matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
degrees- the amount of degrees.
-
matrixScale
public void matrixScale(float x, float y, float z) Scales the current matrix by a set of scalars that correspond to each axis. This is applied via multiplication with the current matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
x- the x-axis scalar.y- the y-axis scalar.z- the z-axis scalar.
-
matrixPerspective
public void matrixPerspective(float fov, float aspect, float near, float far) Multiplies the current matrix by a symmetric perspective projection matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
fov- front of view angle in degrees.aspect- the aspect ratio, usually view width over view height.near- the near clipping plane on the Z-Axis.far- the far clipping plane on the Z-Axis.- Throws:
GraphicsException- iffov == 0 || aspect == 0 || near == far.
-
matrixFrustum
public void matrixFrustum(float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by a frustum projection matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
left- the left clipping plane on the X-Axis.right- the right clipping plane on the X-Axis.bottom- the bottom clipping plane on the Y-Axis.top- the upper clipping plane on the Y-Axis.near- the near clipping plane on the Z-Axis.far- the far clipping plane on the Z-Axis.- Throws:
GraphicsException- ifleft == right || bottom == top || near == far.
-
matrixOrtho
public void matrixOrtho(float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by an orthographic projection matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
left- the left clipping plane on the X-Axis.right- the right clipping plane on the X-Axis.bottom- the bottom clipping plane on the Y-Axis.top- the upper clipping plane on the Y-Axis.near- the near clipping plane on the Z-Axis.far- the far clipping plane on the Z-Axis.- Throws:
GraphicsException- ifleft == right || bottom == top || near == far.
-
matrixAspectOrtho
public void matrixAspectOrtho(float targetAspect, float left, float right, float bottom, float top, float near, float far) Multiplies the current matrix by an aspect-adjusted orthographic projection matrix using the canvas dimensions.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
targetAspect- the target orthographicleft- the left clipping plane on the X-Axis.right- the right clipping plane on the X-Axis.bottom- the bottom clipping plane on the Y-Axis.top- the upper clipping plane on the Y-Axis.near- the near clipping plane on the Z-Axis.far- the far clipping plane on the Z-Axis.- Throws:
GraphicsException- ifleft == right || bottom == top || near == far.
-
matrixLookAt
public void matrixLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) Multiplies a "look at" matrix to the current matrix. This sets up the matrix to look at a place in the world (if modelview).This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
eyeX- the point to look at, X-coordinate.eyeY- the point to look at, Y-coordinate.eyeZ- the point to look at, Z-coordinate.centerX- the reference point to look from, X-coordinate.centerY- the reference point to look from, Y-coordinate.centerZ- the reference point to look from, Z-coordinate.upX- the up vector of the viewpoint, X-coordinate.upY- the up vector of the viewpoint, Y-coordinate.upZ- the up vector of the viewpoint, Z-coordinate.
-
flush
public void flush()Tells the OpenGL implementation to finish all pending commands in finite time. This ensures that the next commands are executed immediately. Has little to no effect on a double-buffered setup. Not to be confused withfinish().- See Also:
-
finish
public void finish()Tells the OpenGL implementation to finish all pending commands, and waits for it to do so. OpenGL commands are usually pipelined for performance reasons. This ensures that OpenGL finishes all pending commands so that what you expect in the target writable buffers is the last command executed, then resumes this thread.NOTE: This best called right before a screenshot is taken.
-
setHint
-
setFillMode
-
setFrontFillMode
Set front polygon fill mode.- Parameters:
mode- the fill mode.
-
setBackFillMode
Set back polygon fill mode.- Parameters:
mode- the fill mode.
-
setViewport
public void setViewport(int x, int y, int width, int height) Sets the OpenGL viewport (Note: (0,0) is the lower-left corner). If any value is below zero, it is clamped to zero.- Parameters:
x- x-coordinate origin of the screen.y- y-coordinate origin of the screen.width- the width of the viewport in pixels.height- the height of the viewport in pixels.
-
setFaceFront
Sets face winding to determine the front face.- Parameters:
faceFront- the front side.
-
setClearColor
public void setClearColor(float clearRed, float clearGreen, float clearBlue, float clearAlpha) Sets the clear color. The color buffer is filled with this color upon clear.- Parameters:
clearRed- the red component of the color to use (0 to 1).clearGreen- the green component of the color to use (0 to 1).clearBlue- the blue component of the color to use (0 to 1).clearAlpha- the alpha component of the color to use (0 to 1).
-
setClearDepth
public void setClearDepth(double depthValue) Sets depth clear value. If the depth buffer gets cleared, this is the value that is written to all of the pixels in the buffer.- Parameters:
depthValue- the depth value to set on clear.
-
setClearStencil
public void setClearStencil(int mask) Sets the stencil mask clear value.- Parameters:
mask- the mask bits.
-
clear
public void clear(boolean clearColorBuffer, boolean clearDepthBuffer, boolean clearStencilBuffer) Clears a bunch of current framebuffers.- Parameters:
clearColorBuffer- if true, clear the color buffer.clearDepthBuffer- if true, clear the depth buffer.clearStencilBuffer- if true, clear the stencil buffer.
-
setColorMask
public void setColorMask(boolean red, boolean green, boolean blue, boolean alpha) Sets if each color component gets written to the color buffer.- Parameters:
red- will the red component be written to the buffer?green- will the green component be written to the buffer?blue- will the blue component be written to the buffer?alpha- will the alpha component be written to the buffer?
-
setColorMask
public void setColorMask(boolean enabled) Sets if all of the components of the color buffer get written to.- Parameters:
enabled- true to enable all components, false to disable.
-
setPointSize
public void setPointSize(float size) Sets the reference unit size for the diameter of Point geometry.- Parameters:
size- the minimum size.
-
setPointSmoothingEnabled
public void setPointSmoothingEnabled(boolean enabled) Enables/Disables smooth point geometry.- Parameters:
enabled- true to enable, false to disable.
-
setLineWidth
public void setLineWidth(float width) Sets the width of line geometry.- Parameters:
width- the width of the line in pixels.
-
setLineSmoothingEnabled
public void setLineSmoothingEnabled(boolean enabled) Enables/Disables line smoothing. "Line smoothing" is a fancy term for anti-aliasing.- Parameters:
enabled- true to enable, false to disable.
-
setFrameBufferRead
Sets the current buffer to read from for pixel read/copy operations. By default, this is the BACK buffer in double-buffered contexts.- Parameters:
type- the buffer to read from from now on.- Throws:
IllegalArgumentException- if type is NONE or FRONT_AND_BACK.
-
setFrameBufferWrite
Sets the current buffer to write to for pixel drawing/rasterizing operations. By default, this is the BACK buffer in double-buffered contexts.- Parameters:
type- the buffer to write to from now on.- Throws:
IllegalArgumentException- if type is NONE or FRONT_AND_BACK.
-
readFrameBuffer
public void readFrameBuffer(ByteBuffer imageData, ColorFormat colorFormat, int x, int y, int width, int height) Reads from the current-bound frame buffer into a target buffer.- Parameters:
imageData- the buffer to write the pixel data to (must be direct).colorFormat- the color format to write to the buffer.x- the starting screen offset, x-coordinate (0 is left).y- the starting screen offset, y-coordinate (0 is bottom).width- the capture width in pixels.height- the capture height in pixels.- Throws:
GraphicsException- if the buffer provided is not direct.
-
setPixelPackAlignment
public void setPixelPackAlignment(int alignment) Sets the current pixel packing alignment value (GL-to-application). This is used for pulling pixel data from an OpenGL buffer into a format that the application can recognize/manipulate.- Parameters:
alignment- the alignment in bytes.
-
getPixelPackAlignment
public int getPixelPackAlignment()Gets the current pixel packing alignment value (GL-to-application). This is used for pulling pixel data from an OpenGL buffer into a format that the application can recognize/manipulate.- Returns:
- the packing alignment in bytes.
-
setPixelUnpackAlignment
public void setPixelUnpackAlignment(int alignment) Sets the current pixel unpacking alignment value (application-to-GL). This is used for pulling pixel data from an OpenGL buffer into a format that the application can recognize/manipulate.- Parameters:
alignment- the alignment in bytes.
-
getPixelUnpackAlignment
public int getPixelUnpackAlignment()Gets the current pixel unpacking alignment value (application-to-GL). This is used for pulling pixel data from an OpenGL buffer into a format that the application can recognize/manipulate.- Returns:
- the unpacking alignment in bytes.
-
setDepthTestEnabled
public void setDepthTestEnabled(boolean enabled) Sets if the depth test is enabled or not for incoming fragments.- Parameters:
enabled- true to enable, false to disable.
-
setDepthFunc
Set depth comparison function.- Parameters:
func- the function to set.
-
setDepthMask
public void setDepthMask(boolean enabled) Sets if the depth buffer is enabled for writing.- Parameters:
enabled- true to enable, false to disable.
-
setStencilMask
public void setStencilMask(int mask) Sets the stencil mask.- Parameters:
mask- the mask bits.
-
setStencilTestEnabled
public void setStencilTestEnabled(boolean enabled) Sets if the stencil test is enabled or not for incoming fragments.- Parameters:
enabled- true to enable, false to disable.
-
setStencilTestFunc
Sets the stencil function for the stencil test.- Parameters:
func- the comparison function to use.ref- the reference value.refmask- the stencil mask bits.
-
setStencilTestOperations
public void setStencilTestOperations(StencilTestFunc stencilFail, StencilTestFunc stencilDepthFail, StencilTestFunc stencilDepthPass) Sets the functions for what to do for each incoming fragment.- Parameters:
stencilFail- the function to perform if the stencil test fails.stencilDepthFail- the function to perform if the stencil test passes, but the depth test fails (if enabled).stencilDepthPass- the function to perform if the fragment passes, both the depth and stencil test.
-
setScissorTestEnabled
public void setScissorTestEnabled(boolean enabled) Sets if the scissor test is enabled.- Parameters:
enabled- true to enable, false to disable.
-
setScissorBounds
public void setScissorBounds(int x, int y, int width, int height) Sets the bounds of the scissor test area.- Parameters:
x- the lower left corner, x-coordinate.y- the lower left corner, y-coordinate.width- the width of scissor area from the lower-left corner.height- the height of scissor area from the lower-left corner.
-
setBlendingEnabled
public void setBlendingEnabled(boolean enabled) Sets if blending is enabled.- Parameters:
enabled- true to enable, false to disable.
-
setBlendingFunc
-
setBlendingFunc
Sets the current blending function.- Parameters:
func- the function to set the fragment arguments.
-
setFaceCullingEnabled
public void setFaceCullingEnabled(boolean enabled) Sets if face culling is enabled.- Parameters:
enabled- true to enable, false to disable.
-
setFaceCullingSide
Sets the face side(s) that are culled if face culling is enabled.- Parameters:
side- the side to cull.
-
createTextureBuilder
Creates a texture builder.This texture builder aids in building texture objects, and its
TextureBuilder.create()method will bind a new texture to its required target, send the data, set the filtering and build mipmaps, unbind the target, and return the new object.Limitations on this implementation version are: No 3D support, no compression, no auto mipmapgen, force RGBA.
- Returns:
- a new texture builder.
-
createTexture
Creates a new texture object.- Returns:
- a new, uninitialized texture object.
- Throws:
GraphicsException- if the object could not be created.
-
destroyTexture
Destroys a texture object.- Parameters:
texture- the texture to destroy.
-
getTexture
Gets a texture currently bound to a target.- Parameters:
target- the texture target.- Returns:
- the texture, or null if no bound texture.
- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.
-
setTexture
Binds a texture object to the current active texture unit on the specified target. This also sets the texture's target identity: if this texture from this point forward is bound to any other target type, an exception will be thrown.- Parameters:
target- the texture target.texture- the texture to bind.- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.GraphicsException- if the provided texture was previously bound to a different target.
-
setTextureFiltering
public void setTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter) Sets the filtering for the current texture bound to the specified target. Assumes an anisotropy value of1.0f(not set if not supported).- Parameters:
target- the texture target.minFilter- the minification filter.magFilter- the magnification filter.
-
setTextureFiltering
public void setTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, float anisotropy) Sets the filtering for the current texture bound to the specified target. If anisotropic filtering is unsupported, the anisotropy filtering constant is ignored.- Parameters:
target- the texture target.minFilter- the minification filter.magFilter- the magnification filter.anisotropy- the anisotropic filtering (2.0 or greater to enable, 1.0 is "off").- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.
-
setTextureWrapping
Sets the current wrapping for the current texture bound to the specified target.- Parameters:
target- the texture target.wrapS- the wrapping mode, S-axis.- Throws:
UnsupportedOperationException- if either provided type is unavailable in this version.GraphicsException- if the target is not a one-dimensionally-sampled target.
-
setTextureWrapping
public void setTextureWrapping(TextureTargetType target, TextureWrapType wrapS, TextureWrapType wrapT) Sets the current wrapping for the current texture bound to the specified target.- Parameters:
target- the texture target.wrapS- the wrapping mode, S-axis.wrapT- the wrapping mode, T-axis.- Throws:
UnsupportedOperationException- if any provided type is unavailable in this version.GraphicsException- if the target is not a two-dimensionally-sampled target.
-
setTextureData
public void setTextureData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, TextureFormat format, int texlevel, int width, int border) Sends a texture to OpenGL's memory for the current texture bound to the specified target.- Parameters:
target- the texture target.imageData- the image to send.colorFormat- the pixel storage format of the buffer data.format- the internal texture format.texlevel- the mipmapping level to copy this into (0 is topmost).width- the texture width in texels.border- the texel border to add, if any.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the buffer provided is not direct, or if the target is not stored one-dimensionally.
-
setTextureData
public void setTextureData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, TextureFormat format, int texlevel, int width, int height, int border) Sends a texture into OpenGL's memory for the current texture bound to the specified target.- Parameters:
target- the texture target.imageData- the image to send.colorFormat- the pixel storage format of the buffer data.format- the internal format.texlevel- the mipmapping level to copy this into (0 is topmost).width- the texture width in texels.height- the texture height in texels.border- the texel border to add, if any.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the buffer provided is not direct, or if the target is not stored two-dimensionally.
-
setTextureSubData
public void setTextureSubData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, int texlevel, int width, int xoffs) Sends a subset of data to the current texture bound to the specified target already in OpenGL's memory.- Parameters:
target- the texture target.imageData- the image to send.colorFormat- the pixel storage format of the buffer data.texlevel- the mipmapping level to copy this into (0 is topmost).width- the texture width in texels.xoffs- the texel offset.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the buffer provided is not direct, or if the target is not stored one-dimensionally.
-
setTextureSubData
public void setTextureSubData(TextureTargetType target, ByteBuffer imageData, ColorFormat colorFormat, int texlevel, int width, int height, int xoffs, int yoffs) Sends a subset of data to the current texture bound to the specified target already in OpenGL's memory.- Parameters:
target- the texture target.imageData- the image to send.colorFormat- the pixel storage format of the buffer data.texlevel- the mipmapping level to copy this into (0 is topmost).width- the texture width in texels.height- the texture height in texels.xoffs- the texel offset.yoffs- the texel offset.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the buffer provided is not direct, or if the target is not stored two-dimensionally.
-
setTextureDataFromReadBuffer
public void setTextureDataFromReadBuffer(TextureTargetType target, TextureFormat format, int texlevel, int srcX, int srcY, int width, int border) Copies the contents of the current read frame buffer into the current texture bound to the specified target.- Parameters:
target- the texture target.format- the internal texture format.texlevel- the mipmapping level to copy this into (0 is topmost level).srcX- the screen-aligned x-coordinate of what to grab from the buffer (0 is the left side of the screen).srcY- the screen-aligned y-coordinate of what to grab from the buffer (0 is the bottom of the screen).width- the width of the screen in pixels to grab.border- the texel border to add, if any.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the target is not stored one-dimensionally.
-
setTextureDataFromReadBuffer
public void setTextureDataFromReadBuffer(TextureTargetType target, TextureFormat format, int texlevel, int srcX, int srcY, int width, int height, int border) Copies the contents of the current read frame buffer into the current texture bound to the specified target.- Parameters:
target- the texture target.format- the internal format.texlevel- the mipmapping level to copy this into (0 is topmost level).srcX- the screen-aligned x-coordinate of what to grab from the buffer (0 is the left side of the screen).srcY- the screen-aligned y-coordinate of what to grab from the buffer (0 is the bottom of the screen).width- the width of the screen in pixels to grab.height- the height of the screen in pixels to grab.border- the texel border to add, if any.- Throws:
UnsupportedOperationException- if any provided type or format is unavailable in this version.GraphicsException- if the target is not stored two-dimensionally.
-
setTextureSubDataFromReadBuffer
public void setTextureSubDataFromReadBuffer(TextureTargetType target, int texlevel, int xoffset, int srcX, int srcY, int width) Copies the contents of the current read frame buffer into the current texture bound to the specified target already in OpenGL's memory.- Parameters:
target- the texture target.texlevel- the mipmapping level to copy this into (0 is topmost level).xoffset- the offset in pixels on this texture (x-coordinate) to put this texture data.srcX- the screen-aligned x-coordinate of what to grab from the buffer (0 is the left side of the screen).srcY- the screen-aligned y-coordinate of what to grab from the buffer (0 is the bottom of the screen).width- the width of the screen in pixels to grab.- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.GraphicsException- if the target is not stored one-dimensionally.
-
setTextureSubDataFromReadBuffer
public void setTextureSubDataFromReadBuffer(TextureTargetType target, int texlevel, int xoffset, int yoffset, int srcX, int srcY, int width, int height) Copies the contents of the current read frame buffer into the current texture bound to the specified target already in OpenGL's memory.- Parameters:
target- the texture target.texlevel- the mipmapping level to copy this into (0 is topmost level).xoffset- the offset in pixels on this texture (x-coordinate) to put this texture data.yoffset- the offset in pixels on this texture (y-coordinate) to put this texture data.srcX- the screen-aligned x-coordinate of what to grab from the buffer (0 is the left side of the screen).srcY- the screen-aligned y-coordinate of what to grab from the buffer (0 is the bottom of the screen).width- the width of the screen in pixels to grab.height- the height of the screen in pixels to grab.- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.GraphicsException- if the target is not stored two-dimensionally.
-
unsetTexture
Unbinds a texture currently bound to a target.- Parameters:
target- the texture target.- Throws:
UnsupportedOperationException- if the target type is unavailable in this version.
-
drawGeometryArray
Draws geometry using the current bound, enabled coordinate arrays/buffers as data.- Parameters:
geometryType- the geometry type - tells how to interpret the data.offset- the starting offset in the bound buffers (in elements).elementCount- the number of elements to draw using bound buffers. NOTE: an element is in terms of array elements, so if the bound buffers describe the coordinates of 4 vertices,elementCountshould be 4.
-
drawGeometryElements
public void drawGeometryElements(GeometryType geometryType, DataType dataType, int count, int offset) Draws geometry using the current bound, enabled coordinate arrays/buffers as data, plus an element buffer to describe the ordering.- Parameters:
geometryType- the geometry type - tells how to interpret the data.dataType- the data type of the indices in theBufferTargetType.INDICES-bound buffer (must be an unsigned type).count- the amount of element indices to interpret in theBufferTargetType.INDICES-bound buffer.offset- the starting offset in the index buffer (in elements).
-