Maven module :un.engine : engine-opengl-util :
Class : un.impl.opengl.GLUtilities
Extends/Implements : -
Subclasses : -

author  Johann Sorel


Variables : PRIMITIVE_TO_GL
Functions : createOffscreenDrawable, createDummyDrawable, configureBlending, calculateStride, byteSize, glTypeToPrimitiveType, primitiveTypeToGlType, asGLBuffer, inverseCulling, discardErrors, checkGLErrorsFail, checkGLErrors


protected int[] PRIMITIVE_TO_GL



Create an offscreen drawable.
return  GLOffscreenAutoDrawable
public GLOffscreenAutoDrawable createOffscreenDrawable (int width, int height, GLProfile glProfile)


Create a dummy drawable, could be used for loading resources or
processing in parallel threads.
return  GLAutoDrawable
public GLAutoDrawable createDummyDrawable (GLAutoDrawable drawable)


Clear GL_ZERO GL_ZERO
Src GL_ONE GL_ZERO
SrcOver GL_ONE GL_ONE_MINUS_SRC_ALPHA
DstOver GL_ONE_MINUS_DST_ALPHA GL_ONE
SrcIn GL_DST_ALPHA GL_ZERO
DstIn GL_ZERO GL_SRC_ALPHA
SrcOut GL_ONE_MINUS_DST_ALPHA GL_ZERO
DstOut GL_ZERO GL_ONE_MINUS_SRC_ALPHA
Dst GL_ZERO GL_ONE
SrcAtop GL_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA
DstAtop GL_ONE_MINUS_DST_ALPHA GL_SRC_ALPHA
AlphaXor GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA
param  gl
param  blending
public void configureBlending (GL gl, AlphaBlending blending)


Calculate stride value for given primitive type and tuple size.
param  gpuType, one of :
return  stride size
public int calculateStride (int gpuType, int tupleSize)


Get GPU primitive type size in bytes.
param  gpuType, one of :
public int byteSize (int gpuType)

public int glTypeToPrimitiveType (int gltype)

public int primitiveTypeToGlType (int primitiveType)

public Buffer asGLBuffer (un.api.buffer.Buffer buffer)

public int inverseCulling (int culling)


Discard any error in the gl stack.
param  gl
public void discardErrors (GL gl)


Checks for GL errors, fails with runtime exception.
public void checkGLErrorsFail (GL gl)


Loops on GL error and throw a GLException if any.
public void checkGLErrors (GL gl)