JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.GLBuffers Class Reference

Utility routines for dealing with direct buffers. More...

Inheritance diagram for com.jogamp.opengl.util.GLBuffers:
Collaboration diagram for com.jogamp.opengl.util.GLBuffers:

Static Public Member Functions

static final boolean isSignedGLType (final int glType)
 
static final boolean isGLTypeFixedPoint (final int glType)
 
static final int sizeOfGLType (final int glType)
 
static final Buffer newDirectGLBuffer (final int glType, final int numElements)
 
static final Buffer sliceGLBuffer (final ByteBuffer parent, final int bytePos, final int byteLen, final int glType)
 
static final int sizeof (final GL gl, final int tmp[], final int bytesPerPixel, int width, int height, int depth, final boolean pack)
 Returns the number of bytes required to read/write a memory buffer via OpenGL using the current GL pixel storage state and the given parameters. More...
 
static final int sizeof (final GL gl, final int tmp[], final int format, final int type, final int width, final int height, final int depth, final boolean pack) throws GLException
 Returns the number of bytes required to read/write a memory buffer via OpenGL using the current GL pixel storage state and the given parameters. More...
 
static final int bytesPerPixel (final int format, final int type) throws GLException
 Returns the number of bytes required for one pixel with the the given OpenGL format and type. More...
 
static final int componentCount (final int format) throws GLException
 Returns the number of components required for the given OpenGL format. More...
 
static final int getNextPowerOf2 (int number)
 
static final float[] getFloatArray (final double[] source)
 

Detailed Description

Utility routines for dealing with direct buffers.

Author
Kenneth Russel, et.al.

Definition at line 60 of file GLBuffers.java.

Member Function Documentation

◆ bytesPerPixel()

static final int com.jogamp.opengl.util.GLBuffers.bytesPerPixel ( final int  format,
final int  type 
) throws GLException
static

Returns the number of bytes required for one pixel with the the given OpenGL format and type.

This method is security critical, hence it throws an exception (fail-fast) in case either the format, type or alignment is unhandled. In case we forgot to handle proper values, please contact the maintainer.

See componentCount(int).

Parameters
formatmust be one of (27)
GL_COLOR_INDEX GL_STENCIL_INDEX
GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
GL_RED GL_RED_INTEGER
GL_GREEN GL_GREEN_INTEGER
GL_BLUE GL_BLUE_INTEGER
GL_ALPHA GL_LUMINANCE (12)

GL_LUMINANCE_ALPHA GL_RG
GL_RG_INTEGER GL_HILO_NV
GL_SIGNED_HILO_NV (5)

GL_YCBCR_422_APPLE

GL_RGB GL_RGB_INTEGER
GL_BGR GL_BGR_INTEGER (4)

GL_RGBA GL_RGBA_INTEGER
GL_BGRA GL_BGRA_INTEGER
GL_ABGR_EXT (5)
typemust be one of (32)
GL_BITMAP,
GL_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,

GL_SHORT, GL_UNSIGNED_SHORT,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
GL_HALF_FLOAT, GL_HALF_FLOAT_OES

GL_FIXED, GL_INT
GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
GL_HILO16_NV, GL_SIGNED_HILO16_NV

GL_FLOAT_32_UNSIGNED_INT_24_8_REV

GL_FLOAT, GL_DOUBLE
Returns
required size of one pixel in bytes
Exceptions
GLExceptionif format or type alignment is not handled. Please contact the maintainer if this is our bug.

Definition at line 587 of file GLBuffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ componentCount()

static final int com.jogamp.opengl.util.GLBuffers.componentCount ( final int  format) throws GLException
static

Returns the number of components required for the given OpenGL format.

This method is security critical, hence it throws an exception (fail-fast) in case either the format, type or alignment is unhandled. In case we forgot to handle proper values, please contact the maintainer.

Parameters
formatmust be one of (27)
GL_COLOR_INDEX GL_STENCIL_INDEX
GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
GL_RED GL_RED_INTEGER
GL_GREEN GL_GREEN_INTEGER
GL_BLUE GL_BLUE_INTEGER
GL_ALPHA GL_LUMINANCE (12)

GL_LUMINANCE_ALPHA GL_RG
GL_RG_INTEGER GL_HILO_NV
GL_SIGNED_HILO_NV (5)

GL_YCBCR_422_APPLE

GL_RGB GL_RGB_INTEGER
GL_BGR GL_BGR_INTEGER (4)

GL_RGBA GL_RGBA_INTEGER
GL_BGRA GL_BGRA_INTEGER
GL_ABGR_EXT (5)
Returns
number of components required for the given OpenGL format
Exceptions
GLExceptionif format is not handled. Please contact the maintainer if this is our bug.

Definition at line 693 of file GLBuffers.java.

Here is the caller graph for this function:

◆ getFloatArray()

static final float[] com.jogamp.opengl.util.GLBuffers.getFloatArray ( final double[]  source)
static

Definition at line 760 of file GLBuffers.java.

◆ getNextPowerOf2()

static final int com.jogamp.opengl.util.GLBuffers.getNextPowerOf2 ( int  number)
static

Definition at line 744 of file GLBuffers.java.

◆ isGLTypeFixedPoint()

static final boolean com.jogamp.opengl.util.GLBuffers.isGLTypeFixedPoint ( final int  glType)
static
Parameters
glTypeGL primitive type
Returns
false if one of GL primitive floating point types, otherwise true GL_FLOAT,
GL_HALF_FLOAT,
GL_HALF_FLOAT_OES,
GL_DOUBLE

Definition at line 90 of file GLBuffers.java.

Here is the caller graph for this function:

◆ isSignedGLType()

static final boolean com.jogamp.opengl.util.GLBuffers.isSignedGLType ( final int  glType)
static
Parameters
glTypeGL primitive type
Returns
false if one of GL primitive unsigned types, otherwise true GL_UNSIGNED_BYTE,
GL_UNSIGNED_SHORT,
GL_UNSIGNED_INT,
GL_HILO16_NV

Definition at line 70 of file GLBuffers.java.

Here is the caller graph for this function:

◆ newDirectGLBuffer()

static final Buffer com.jogamp.opengl.util.GLBuffers.newDirectGLBuffer ( final int  glType,
final int  numElements 
)
static
Parameters
glTypeshall be one of (31)
GL_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,

GL_SHORT, GL_UNSIGNED_SHORT,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
GL_HALF_FLOAT, GL_HALF_FLOAT_OES

GL_FIXED, GL_INT
GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
GL_HILO16_NV, GL_SIGNED_HILO16_NV

GL_FLOAT_32_UNSIGNED_INT_24_8_REV

GL_FLOAT, GL_DOUBLE
Returns
null if glType is unhandled, otherwise the new Buffer object

Definition at line 202 of file GLBuffers.java.

◆ sizeof() [1/2]

static final int com.jogamp.opengl.util.GLBuffers.sizeof ( final GL  gl,
final int  tmp[],
final int  bytesPerPixel,
int  width,
int  height,
int  depth,
final boolean  pack 
)
static

Returns the number of bytes required to read/write a memory buffer via OpenGL using the current GL pixel storage state and the given parameters.

This method is security critical, hence it throws an exception (fail-fast) in case of an invalid alignment. In case we forgot to handle proper values, please contact the maintainer.

Parameters
glthe current GL object
tmpa pass through integer array of size >= 1 used to store temp data (performance)
bytesPerPixelbytes per pixel, i.e. via bytesPerPixel(int, int).
widthin pixels
heightin pixels
depthin pixels
packtrue for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack)
Returns
required minimum size of the buffer in bytes
Exceptions
GLExceptionif alignment is invalid. Please contact the maintainer if this is our bug.

Definition at line 364 of file GLBuffers.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sizeof() [2/2]

static final int com.jogamp.opengl.util.GLBuffers.sizeof ( final GL  gl,
final int  tmp[],
final int  format,
final int  type,
final int  width,
final int  height,
final int  depth,
final boolean  pack 
) throws GLException
static

Returns the number of bytes required to read/write a memory buffer via OpenGL using the current GL pixel storage state and the given parameters.

This method is security critical, hence it throws an exception (fail-fast) in case either the format, type or alignment is unhandled. In case we forgot to handle proper values, please contact the maintainer.

See bytesPerPixel(int, int).

Parameters
glthe current GL object
tmpa pass through integer array of size >= 1 used to store temp data (performance)
formatmust be one of (27)
GL_COLOR_INDEX GL_STENCIL_INDEX
GL_DEPTH_COMPONENT GL_DEPTH_STENCIL
GL_RED GL_RED_INTEGER
GL_GREEN GL_GREEN_INTEGER
GL_BLUE GL_BLUE_INTEGER
GL_ALPHA GL_LUMINANCE (12)

GL_LUMINANCE_ALPHA GL_RG
GL_RG_INTEGER GL_HILO_NV
GL_SIGNED_HILO_NV (5)

GL_YCBCR_422_APPLE

GL_RGB GL_RGB_INTEGER
GL_BGR GL_BGR_INTEGER (4)

GL_RGBA GL_RGBA_INTEGER
GL_BGRA GL_BGRA_INTEGER
GL_ABGR_EXT (5)
typemust be one of (32)
GL_BITMAP,
GL_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,

GL_SHORT, GL_UNSIGNED_SHORT,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
GL_HALF_FLOAT, GL_HALF_FLOAT_OES

GL_FIXED, GL_INT
GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
GL_HILO16_NV, GL_SIGNED_HILO16_NV

GL_FLOAT_32_UNSIGNED_INT_24_8_REV

GL_FLOAT, GL_DOUBLE
widthin pixels
heightin pixels
depthin pixels
packtrue for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
Returns
required minimum size of the buffer in bytes
Exceptions
GLExceptionif format, type or alignment is not handled. Please contact the maintainer if this is our bug.

Definition at line 520 of file GLBuffers.java.

Here is the call graph for this function:

◆ sizeOfGLType()

static final int com.jogamp.opengl.util.GLBuffers.sizeOfGLType ( final int  glType)
static
Parameters
glTypeshall be one of (31)
GL_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,

GL_SHORT, GL_UNSIGNED_SHORT,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
GL.GL_HALF_FLOAT, GLES2.GL_HALF_FLOAT_OES:

GL_FIXED, GL_INT
GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
GL_HILO16_NV, GL_SIGNED_HILO16_NV

GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV

GL_FLOAT, GL_DOUBLE
Returns
-1 if glType is unhandled, otherwise the actual value > 0

Definition at line 128 of file GLBuffers.java.

Here is the caller graph for this function:

◆ sliceGLBuffer()

static final Buffer com.jogamp.opengl.util.GLBuffers.sliceGLBuffer ( final ByteBuffer  parent,
final int  bytePos,
final int  byteLen,
final int  glType 
)
static
Parameters
glTypeshall be one of (31)
GL_BYTE, GL_UNSIGNED_BYTE,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,

GL_SHORT, GL_UNSIGNED_SHORT,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE,
GL_HALF_FLOAT, GL_HALF_FLOAT_OES

GL_FIXED, GL_INT
GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8,
GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2,
GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8,
GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV
GL_HILO16_NV, GL_SIGNED_HILO16_NV

GL_FLOAT_32_UNSIGNED_INT_24_8_REV

GL_FLOAT, GL_DOUBLE
Returns
null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object

Definition at line 274 of file GLBuffers.java.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: