Class OGL30Graphics
java.lang.Object
- All Implemented Interfaces:
OGLVersioned
- Direct Known Subclasses:
OGL31Graphics
OpenGL 3.0 Graphics Implementation.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class OGL20Graphics
OGL20Graphics.Info20Nested classes/interfaces inherited from class OGL13Graphics
OGL13Graphics.Info13Nested classes/interfaces inherited from class OGL11Graphics
OGL11Graphics.Info11Nested classes/interfaces inherited from class OGLGraphics
OGLGraphics.ErrorHandlingType, OGLGraphics.Info, OGLGraphics.Options -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattachFramebufferRenderbuffer(AttachPoint attachPoint, OGLRenderbuffer renderBuffer) Attaches a render buffer to the current frame buffer.voidattachFramebufferTexture2D(AttachPoint attachPoint, OGLTexture texture) Attaches a texture to this frame buffer for rendering directly to a texture.voidTests for frame buffer completeness on the bound framebuffer.Creates a new framebuffer object.protected OGLGraphics.InfoCalled once in order to fetch context info.Creates a new program builder.Creates a new render buffer object.Creates a vertex array state object, which maintains the state of bound vertex attributes and bound buffer targets.createVertexArrayState(OGLBuffer buffer, GeometryBuilder builder) Creates a vertex array state object, which maintains the state of bound vertex attributes and bound buffer targets.voiddestroyFramebuffer(OGLFramebuffer frameBuffer) Destroys a framebuffer.voiddestroyRenderbuffer(OGLRenderbuffer renderBuffer) Destroys a render buffer.voiddestroyVertexArrayState(OGLVertexArrayState arrayState) Destroys a vertex array state.voiddetachFramebufferRenderbuffer(AttachPoint attachPoint) Detaches a render buffer from the current frame buffer.voiddetachFramebufferTexture2D(AttachPoint attachPoint) Detaches a texture from this frame buffer.voidEnds a conditional render.protected voidendFrame()Called on frame end - mostly does cleanup of objects that were abandoned in OpenGL.voidEnds a transform feedback.voidgenerateMipmaps(TextureTargetType target) Generates mipmaps on-demand internally for the current texture bound to the provided target.voidmatrixGet(int matrixId, float[] outArray) Reads a current matrix into an array.voidReads a current matrix into a 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.voidmatrixId(int id) Sets the current matrix index.voidmatrixMode(MatrixMode mode) Sets the current matrix for matrix operations.voidsetFramebuffer(OGLFramebuffer framebuffer) Binds a FrameBuffer for rendering.voidsetProgramFragmentDataLocation(OGLProgram program, String outVariableName, int colorIndex) Sets the location of a fragment output.voidsetProgramUniformMatrix4(int locationId, int matrixId) Sets a uniform matrix (mat4) value on the currently-bound program using a matrix in the matrix stack.voidsetProgramUniformMatrix4(int locationId, MatrixMode matrixMode) Sets a uniform matrix (mat4) value on the currently-bound program using a matrix in the matrix stack.voidsetRenderbuffer(OGLRenderbuffer renderbuffer) Binds a FrameRenderBuffer to the current context.voidsetRenderbufferSize(RenderbufferFormat format, int width, int height) Sets a render buffer's internal format and size.voidsetShaderUniformUnsignedInt(int locationId, int value) Sets a uniform unsigned integer value on the currently-bound shader.voidsetShaderUniformUnsignedIntArray(int locationId, int... values) Sets a uniform unsigned integer value array on the currently-bound shader.voidsetShaderUniformUnsignedIVec2(int locationId, int value0, int value1) Sets a uniform integer vec2 value on the currently-bound shader.voidsetShaderUniformUnsignedIVec3(int locationId, int value0, int value1, int value2) Sets a uniform integer vec3 value on the currently-bound shader.voidsetShaderUniformUnsignedIVec4(int locationId, int value0, int value1, int value2, int value3) Sets a uniform integer vec4 value on the currently-bound shader.voidsetTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, boolean genMipmaps) Sets the filtering for the current texture bound to the specified target.voidsetTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, float anisotropy, boolean genMipmaps) Sets the filtering for the current texture bound to the specified target.voidsetTransformFeedbackVaryingNames(OGLProgram program, FeedbackBufferType type, String... variableNames) Sets the transform feedback varying variables for the bound shader program.voidSets the current vertex array state, which also restores all of the vertex attribute pointer and buffer target bindings associated with it.voidstartConditionalRender(OGLQuery query, QueryWaitType waitType) Starts a conditional render.voidstartTransformFeedback(PrimitiveMode primitiveMode) Starts a transform feedback.voidUnbinds a FrameBuffer for rendering.voidUnbinds a FrameRenderBuffer from the current context.voidUnbinds a vertex array state from the current context.Methods inherited from class OGL21Graphics
setProgramUniformMatrix2x3, setProgramUniformMatrix2x3, setProgramUniformMatrix2x4, setProgramUniformMatrix2x4, setProgramUniformMatrix3x2, setProgramUniformMatrix3x2, setProgramUniformMatrix3x4, setProgramUniformMatrix3x4, setProgramUniformMatrix4x2, setProgramUniformMatrix4x2, setProgramUniformMatrix4x3, setProgramUniformMatrix4x3Methods inherited from class OGL20Graphics
attachProgramShaders, createFileSourceSupplier, createFileSourceSupplier, createProgram, createProgramShader, createProgramShader, createReaderSourceSupplier, createStreamSourceSupplier, createStreamSourceSupplier, destroyProgram, destroyProgramShader, detachProgramShaders, getProgram, linkProgram, refreshProgramLinkStatusAndUniforms, setFrameBufferWrite, setPointSpritesEnabled, setPointSpriteTexCoordGeneration, setProgram, setProgramUniformFloat, setProgramUniformFloatArray, setProgramUniformInt, setProgramUniformIntArray, setProgramUniformIVec2, setProgramUniformIVec3, setProgramUniformIVec4, setProgramUniformMatrix2, setProgramUniformMatrix2, setProgramUniformMatrix3, setProgramUniformMatrix3, setProgramUniformMatrix4, setProgramUniformMatrix4, setProgramUniformMatrix4, setProgramUniformVec2, setProgramUniformVec3, setProgramUniformVec4, setProgramVertexAttribLocation, setVertexAttribBufferPointer, setVertexAttribEnabled, unsetProgramMethods inherited from class OGL15Graphics
createBuffer, createGeometryBuilder, createQuery, destroyBuffer, destroyQuery, endQuery, getBuffer, getCurrentBufferState, getQueryBooleanResult, getQueryResult, isQueryReady, mapByteBuffer, mapDoubleBuffer, mapFloatBuffer, mapIntBuffer, mapLongBuffer, mapShortBuffer, setBuffer, setBufferCapacity, setBufferData, setBufferData, setBufferData, setBufferData, setBufferData, setBufferData, setBufferSubData, setBufferSubData, setBufferSubData, setBufferSubData, setBufferSubData, setBufferSubData, setCurrentBufferState, setFogCoordinateSource, startQuery, unmapBuffer, unsetBufferMethods inherited from class OGL14Graphics
createTextureBuilder, setPointAttenuationFormula, setPointAttenuationMaximum, setPointAttenuationMinimum, setTextureLODBiasMethods inherited from class OGL13Graphics
getActiveTextureUnit, getCurrentActiveTextureUnitState, setActiveTextureUnit, setCurrentActiveTextureCoordArray, setCurrentActiveTextureUnitState, setTextureData, setTextureSubDataMethods inherited from class OGL12Graphics
drawGeometryElementRange, setTextureData, setTextureSubData, setTextureWrappingMethods inherited from class OGL11Graphics
accumulate, attribPop, attribPush, checkLightId, clear, clear, clientAttribPop, clientAttribPush, createTexture, destroyTexture, drawBitmap, drawGeometryArray, drawGeometryElements, finish, flush, getCurrentActiveTextureState, getCurrentMatrixId, getCurrentMatrixStack, getCurrentMatrixStack, getPixelPackAlignment, getPixelUnpackAlignment, getTexture, matrixAspectOrtho, matrixFrustum, matrixLookAt, matrixMultiply, matrixMultiply, matrixOrtho, matrixPerspective, matrixPop, matrixPush, matrixReset, matrixRotateX, matrixRotateY, matrixRotateZ, matrixScale, matrixSet, matrixSet, matrixTranslate, readFrameBuffer, resolveCurrentMatrixStack, setAutoNormalGen, setBackFillMode, setBlendingEnabled, setBlendingFunc, setBlendingFunc, setClearAccum, setClearColor, setClearDepth, setClearStencil, setColor, setColor, setColorARGB, setColorArrayEnabled, setColorArrayPointer, setColorMask, setColorMask, setCurrentActiveTextureState, setCurrentMatrixId, setDepthFunc, setDepthMask, setDepthTestEnabled, setFaceCullingEnabled, setFaceCullingSide, setFaceFront, setFillMode, setFogColor, setFogColor, setFogColor, setFogDensity, setFogEnabled, setFogEnd, setFogExponent, setFogExponentSquared, setFogFormula, setFogLinear, setFogStart, setFrameBufferRead, setFrameBufferWrite, setFrontFillMode, setHint, setLight, setLightAmbientColor, setLightAmbientColor, setLightAmbientColor, setLightAttenuation, setLightDiffuseColor, setLightDiffuseColor, setLightDiffuseColor, setLightEnabled, setLightingEnabled, setLightPosition, setLightShadeType, setLightSpecularColor, setLightSpecularColor, setLightSpecularColor, setLineSmoothingEnabled, setLineWidth, setMaterial, setMaterial, setMaterialAmbientColor, setMaterialAmbientColor, setMaterialAmbientColor, setMaterialDiffuseColor, setMaterialDiffuseColor, setMaterialDiffuseColor, setMaterialEmissionColor, setMaterialEmissionColor, setMaterialEmissionColor, setMaterialShininessFactor, setMaterialSpecularColor, setMaterialSpecularColor, setMaterialSpecularColor, setNormalArrayEnabled, setNormalArrayPointer, setPixelPackAlignment, setPixelUnpackAlignment, setPointSize, setPointSmoothingEnabled, setRasterPosition, setScissorBounds, setScissorTestEnabled, setStencilMask, setStencilTestEnabled, setStencilTestFunc, setStencilTestOperations, setTexGenEyePlane, setTexGenMode, setTexGenObjectPlane, setTexGenQEnabled, setTexGenREnabled, setTexGenSEnabled, setTexGenTEnabled, setTexture, setTextureCoordinateArrayEnabled, setTextureCoordinateArrayPointer, setTextureData, setTextureData, setTextureDataFromReadBuffer, setTextureDataFromReadBuffer, setTextureEnabled, setTextureEnvironment, setTextureFiltering, setTextureFiltering, setTextureSubData, setTextureSubData, setTextureSubDataFromReadBuffer, setTextureSubDataFromReadBuffer, setTextureWrapping, setTextureWrapping, setVertexArrayEnabled, setVertexArrayPointer, setViewport, unsetTextureMethods 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
-
OGL30Graphics
-
-
Method Details
-
getVersion
- Specified by:
getVersionin interfaceOGLVersioned- Overrides:
getVersionin classOGL21Graphics- Returns:
- the version that this object or value is available for (and higher).
-
createInfo
Description copied from class:OGLGraphicsCalled once in order to fetch context info.- Overrides:
createInfoin classOGL20Graphics- 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.- Overrides:
endFramein classOGL20Graphics
-
matrixMode
Description copied from class:OGL11GraphicsSets the current matrix for matrix operations.- Overrides:
matrixModein classOGL11Graphics- Parameters:
mode- the matrix mode to set.
-
matrixGet
Description copied from class:OGL11GraphicsReads a current matrix into an array.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Overrides:
matrixGetin classOGL11Graphics- Parameters:
matrixType- the type of matrix to load.outArray- the output array. Must be length 16 or greater.
-
matrixGet
Description copied from class:OGL11GraphicsReads a current matrix into a matrix.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Overrides:
matrixGetin classOGL11Graphics- Parameters:
matrixType- the type of matrix to load.matrix- the output matrix.
-
setProgramUniformMatrix4
Sets a uniform matrix (mat4) value on the currently-bound program using a matrix in the matrix stack.- Overrides:
setProgramUniformMatrix4in classOGL20Graphics- Parameters:
locationId- the uniform location.matrixMode- the matrix to grab values from.- Throws:
UnsupportedOperationException- if matrix modes are unavailable in this version (core implementation).
-
setTextureFiltering
public void setTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, boolean genMipmaps) Description copied from class:OGL14GraphicsSets the filtering for the current texture bound to the specified target.- Overrides:
setTextureFilteringin classOGL14Graphics- Parameters:
target- the texture target.minFilter- the minification filter.magFilter- the magnification filter.genMipmaps- if this generates mipmaps automatically.
-
setTextureFiltering
public void setTextureFiltering(TextureTargetType target, TextureMinFilter minFilter, TextureMagFilter magFilter, float anisotropy, boolean genMipmaps) Description copied from class:OGL14GraphicsSets the filtering for the current texture bound to the specified target.- Overrides:
setTextureFilteringin classOGL14Graphics- 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 or less is "off").genMipmaps- if this generates mipmaps automatically.
-
createProgramBuilder
Creates a new program builder.This program builder aids in building shader program objects, and its
ProgramBuilder.create()method will compile and link all of the shaders and return the new object.- Overrides:
createProgramBuilderin classOGL20Graphics- Returns:
- a new program builder.
-
matrixId
public void matrixId(int id) Sets the current matrix index.Use this if you want matrix stack functionality in a core profile.
- Parameters:
id- the new current matrix id.- Throws:
UnsupportedOperationException- if this profile is not core OpenGL.
-
matrixGet
public void matrixGet(int matrixId, float[] outArray) Reads a current matrix into an array.This is technically not available in Core OpenGL, but is instead implemented using
MatrixStackfor core implementations.- Parameters:
matrixId- the matrix id to fetch.outArray- the output array. Must be length 16 or greater.- Throws:
ArrayIndexOutOfBoundsException- if the array length is less than 16.
-
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:
matrixId- the matrix id to fetch.matrix- the output matrix.
-
setTransformFeedbackVaryingNames
public void setTransformFeedbackVaryingNames(OGLProgram program, FeedbackBufferType type, String... variableNames) Sets the transform feedback varying variables for the bound shader program. Must be called beforeOGL20Graphics.linkProgram(OGLProgram)for the provided program.- Parameters:
program- the program to set the variables for.type- the feedback output type.variableNames- the names of the varying variables.- Throws:
IllegalStateException- if the provided program was already linked.
-
setProgramUniformMatrix4
public void setProgramUniformMatrix4(int locationId, int matrixId) Sets a uniform matrix (mat4) value on the currently-bound program using a matrix in the matrix stack.- Parameters:
locationId- the uniform location.matrixId- the matrix stack id.
-
generateMipmaps
Generates mipmaps on-demand internally for the current texture bound to the provided target.- Parameters:
target- the texture target.
-
setShaderUniformUnsignedInt
public void setShaderUniformUnsignedInt(int locationId, int value) Sets a uniform unsigned integer value on the currently-bound shader.- Parameters:
locationId- the uniform location.value- the value to set.
-
setShaderUniformUnsignedIntArray
public void setShaderUniformUnsignedIntArray(int locationId, int... values) Sets a uniform unsigned integer value array on the currently-bound shader.- Parameters:
locationId- the uniform location.values- the values to set.
-
setShaderUniformUnsignedIVec2
public void setShaderUniformUnsignedIVec2(int locationId, int value0, int value1) Sets a uniform integer vec2 value on the currently-bound shader.- Parameters:
locationId- the uniform location.value0- the first value to set.value1- the second value to set.
-
setShaderUniformUnsignedIVec3
public void setShaderUniformUnsignedIVec3(int locationId, int value0, int value1, int value2) Sets a uniform integer vec3 value on the currently-bound shader.- Parameters:
locationId- the uniform location.value0- the first value to set.value1- the second value to set.value2- the third value to set.
-
setShaderUniformUnsignedIVec4
public void setShaderUniformUnsignedIVec4(int locationId, int value0, int value1, int value2, int value3) Sets a uniform integer vec4 value on the currently-bound shader.- Parameters:
locationId- the uniform location.value0- the first value to set.value1- the second value to set.value2- the third value to set.value3- the fourth value to set.
-
createVertexArrayState
Creates a vertex array state object, which maintains the state of bound vertex attributes and bound buffer targets. This uses the content of aGeometryBuilderand the buffer it created to set the pointers used by the array state.- Parameters:
buffer- the buffer created by the builder.builder- the builder to get the attribute data from.- Returns:
- the new object.
-
createVertexArrayState
Creates a vertex array state object, which maintains the state of bound vertex attributes and bound buffer targets.- Returns:
- the new object.
-
destroyVertexArrayState
Destroys a vertex array state.- Parameters:
arrayState- the vertex array state to destroy.
-
setVertexArrayState
Sets the current vertex array state, which also restores all of the vertex attribute pointer and buffer target bindings associated with it. The following is saved by a vertex array state:- Parameters:
state- the state to set.
-
unsetVertexArrayState
public void unsetVertexArrayState()Unbinds a vertex array state from the current context. -
setProgramFragmentDataLocation
public void setProgramFragmentDataLocation(OGLProgram program, String outVariableName, int colorIndex) Sets the location of a fragment output. Must be done before program link.- Parameters:
program- the shader to set it on.outVariableName- the name of the output variable.colorIndex- the color index (draw buffer index).- Throws:
GraphicsException- if the program shader has been linked already.
-
createRenderbuffer
Creates a new render buffer object.- Returns:
- a new, uninitialized render buffer object.
-
destroyRenderbuffer
Destroys a render buffer.- Parameters:
renderBuffer- the render buffer to destroy.
-
setRenderbuffer
Binds a FrameRenderBuffer to the current context.- Parameters:
renderbuffer- the render buffer to bind to the current render buffer.
-
setRenderbufferSize
Sets a render buffer's internal format and size.- Parameters:
format- the buffer format.width- the width in pixel data.height- the height in pixel data.
-
unsetRenderbuffer
public void unsetRenderbuffer()Unbinds a FrameRenderBuffer from the current context. -
createFramebuffer
Creates a new framebuffer object.- Returns:
- a new, uninitialized framebuffer object.
- Throws:
GraphicsException- if the object could not be created.
-
destroyFramebuffer
Destroys a framebuffer.- Parameters:
frameBuffer- the framebuffer to destroy.
-
setFramebuffer
Binds a FrameBuffer for rendering.- Parameters:
framebuffer- the framebuffer to set as the current one.
-
checkFramebufferStatus
public void checkFramebufferStatus()Tests for frame buffer completeness on the bound framebuffer. If incomplete, this throws an exception.- Throws:
GraphicsException- if the framebuffer is incomplete.
-
attachFramebufferTexture2D
Attaches a texture to this frame buffer for rendering directly to a texture.- Parameters:
attachPoint- the attachment source point.texture- the texture to attach this to.
-
detachFramebufferTexture2D
Detaches a texture from this frame buffer.- Parameters:
attachPoint- the attachment source point.
-
attachFramebufferRenderbuffer
Attaches a render buffer to the current frame buffer.- Parameters:
attachPoint- the attachment source point.renderBuffer- the render buffer to attach this to.
-
detachFramebufferRenderbuffer
Detaches a render buffer from the current frame buffer.- Parameters:
attachPoint- the attachment source point.
-
unsetFramebuffer
public void unsetFramebuffer()Unbinds a FrameBuffer for rendering. The current draw buffer will then be the default target buffer. -
startConditionalRender
Starts a conditional render.- Parameters:
query- the query object to use.waitType- the wait type for query results.- Throws:
IllegalStateException- if a conditional render is already active.
-
endConditionalRender
public void endConditionalRender()Ends a conditional render.- Throws:
IllegalStateException- if a conditional render is not active.
-
startTransformFeedback
Starts a transform feedback. Requires batch calling for draw, an attached geometry program, and a boundBufferTargetType.TRANSFORM_FEEDBACKbuffer for the results.- Parameters:
primitiveMode- the primitive draw mode.- See Also:
-
endTransformFeedback
public void endTransformFeedback()Ends a transform feedback.
-