Class OGLObject
java.lang.Object
com.blackrook.gloop.opengl.OGLObject
- Direct Known Subclasses:
OGLBuffer, OGLFramebuffer, OGLProgram, OGLProgramPipeline, OGLProgramShader, OGLQuery, OGLRenderbuffer, OGLSampler, OGLSync, OGLTexture, OGLVertexArrayState
Generic OpenGL object type.
Since this is managed internally by OpenGL, the handles to these
objects are "names" (aka integer IDs) rather than memory addresses.
- Author:
- Matthew Tropiano
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this OpenAL object equals the provided one.booleanprotected static int[]expand(int[] input, int targetLength) Utility function to expand the "undeleted" GL name pool if it is below a certain length.protected static long[]expand(long[] input, int targetLength) Utility function to expand the "undeleted" GL name pool if it is below a certain length.protected abstract voidfree()Destroys this object (deallocates it on OpenAL).final longfinal intgetName()inthashCode()protected booleanprotected voidsetLongName(long glId) Sets this object's long OpenGL name/id.protected voidsetName(int glId) Sets this object's OpenGL name/id.toString()
-
Constructor Details
-
OGLObject
protected OGLObject()Allocates a new OpenGL object.
-
-
Method Details
-
setName
protected void setName(int glId) Sets this object's OpenGL name/id. Set either this or the longer one.- Parameters:
glId- the new id.- Throws:
GraphicsException- if the id is zero.
-
setLongName
protected void setLongName(long glId) Sets this object's long OpenGL name/id. Set either this or the shorter one.- Parameters:
glId- the new id.- Throws:
GraphicsException- if the id is zero.
-
getName
public final int getName()- Returns:
- this OGLObject OpenGL object id.
-
getLongName
public final long getLongName()- Returns:
- this OGLObject OpenGL object id.
-
hashCode
-
equals
-
equals
Tests if this OpenAL object equals the provided one.- Parameters:
obj- the object to test.- Returns:
- true if so, false if not.
-
isAllocated
protected boolean isAllocated()- Returns:
- true if allocated in OpenGL, false if not.
-
free
protected abstract void free()Destroys this object (deallocates it on OpenAL). This is called by destroy().- Throws:
GraphicsException- if the deallocation cannot happen.
-
expand
protected static int[] expand(int[] input, int targetLength) Utility function to expand the "undeleted" GL name pool if it is below a certain length.- Parameters:
input- the input array.targetLength- the target length.- Returns:
- the array itself (
input) if no expansion needed, or a new array with the contents copied ifinput.length < targetLength.
-
expand
protected static long[] expand(long[] input, int targetLength) Utility function to expand the "undeleted" GL name pool if it is below a certain length.- Parameters:
input- the input array.targetLength- the target length.- Returns:
- the array itself (
input) if no expansion needed, or a new array with the contents copied ifinput.length < targetLength.
-
toString
-