Top Description Constructors Methods
org.lwjgl.opengles

pack-priv Class GLChecks

extends Object
Class Inheritance
Imports
org.lwjgl.BufferUtils, .LWJGLUtil, org.lwjgl.opengl.OpenGLException, java.nio.Buffer

A class to check buffer boundaries in GL methods. Many GL methods read data from the GL into a native Buffer at its current position. If there is unsufficient space in the buffer when the call is made then a buffer overflow would otherwise occur and cause unexpected behaviour, a crash, or worse, a security risk. Therefore in those methods where GL reads data back into a buffer, we will call a bounds check method from this class to ensure that there is sufficient space in the buffer.

Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error.

Author
cix_foo
Version
$Revision: 3459 $ $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $

Constructor Summary

AccessConstructor and Description
private
GLChecks()

Static methods only!

Method Summary

Modifier and TypeMethod and Description
private static int
calculateBytesPerPixel(int format, int type)

pack-priv static int

Returns:

the size, in elements, of the image
calculateImageStorage
(Buffer buffer, int
The format of the image (example: GL_RGBA)
format
,
int
The type of the image elements (example: GL_UNSIGNED_BYTE)
type
,
int
The width of the image
width
,
int
The height of the image (1 for 1D images)
height
,
int
The depth of the image (1 for 2D images)
depth
)

Calculate the storage required for an image in elements

private static int

Returns:

the size, in bytes, of the image
calculateImageStorage
(int
The format of the image (example: GL_RGBA)
format
,
int
The type of the image elements (example: GL_UNSIGNED_BYTE)
type
,
int
The width of the image
width
,
int
The height of the image (1 for 1D images)
height
,
int
The depth of the image (1 for 2D images)
depth
)

Calculate the storage required for an image in bytes.

pack-priv static int
calculateTexImage1DStorage(Buffer buffer, int format, int type, int width)

private static int
calculateTexImage1DStorage(int format, int type, int width)

pack-priv static int
calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height)

private static int
calculateTexImage2DStorage(int format, int type, int width, int height)

pack-priv static int
calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth)

private static int
calculateTexImage3DStorage(int format, int type, int width, int height, int depth)

pack-priv static void
ensureArrayVBOdisabled()

Helper method to ensure that array buffer objects are disabled.

pack-priv static void
ensureArrayVBOenabled()

Helper method to ensure that array buffer objects are enabled.

pack-priv static void
ensureElementVBOdisabled()

Helper method to ensure that element array buffer objects are disabled.

pack-priv static void
ensureElementVBOenabled()

Helper method to ensure that element array buffer objects are enabled.

pack-priv static void
ensurePackPBOdisabled()

Helper method to ensure that pixel pack buffer objects are disabled.

pack-priv static void
ensurePackPBOenabled()

Helper method to ensure that pixel pack buffer objects are enabled.

pack-priv static void
ensureUnpackPBOdisabled()

Helper method to ensure that pixel unpack buffer objects are disabled.

pack-priv static void
ensureUnpackPBOenabled()

Helper method to ensure that pixel unpack buffer objects are enabled.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GLChecksback to summary
private GLChecks()

Static methods only!

Method Detail

calculateBytesPerPixelback to summary
private static int calculateBytesPerPixel(int format, int type)
calculateImageStorageback to summary
pack-priv static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth)

Calculate the storage required for an image in elements

Parameters
format:int

The format of the image (example: GL_RGBA)

type:int

The type of the image elements (example: GL_UNSIGNED_BYTE)

width:int

The width of the image

height:int

The height of the image (1 for 1D images)

depth:int

The depth of the image (1 for 2D images)

Returns:int

the size, in elements, of the image

calculateImageStorageback to summary
private static int calculateImageStorage(int format, int type, int width, int height, int depth)

Calculate the storage required for an image in bytes.

Parameters
format:int

The format of the image (example: GL_RGBA)

type:int

The type of the image elements (example: GL_UNSIGNED_BYTE)

width:int

The width of the image

height:int

The height of the image (1 for 1D images)

depth:int

The depth of the image (1 for 2D images)

Returns:int

the size, in bytes, of the image

calculateTexImage1DStorageback to summary
pack-priv static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width)
calculateTexImage1DStorageback to summary
private static int calculateTexImage1DStorage(int format, int type, int width)
calculateTexImage2DStorageback to summary
pack-priv static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height)
calculateTexImage2DStorageback to summary
private static int calculateTexImage2DStorage(int format, int type, int width, int height)
calculateTexImage3DStorageback to summary
pack-priv static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth)
calculateTexImage3DStorageback to summary
private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth)
ensureArrayVBOdisabledback to summary
pack-priv static void ensureArrayVBOdisabled()

Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException

ensureArrayVBOenabledback to summary
pack-priv static void ensureArrayVBOenabled()

Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException

ensureElementVBOdisabledback to summary
pack-priv static void ensureElementVBOdisabled()

Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException

ensureElementVBOenabledback to summary
pack-priv static void ensureElementVBOenabled()

Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException

ensurePackPBOdisabledback to summary
pack-priv static void ensurePackPBOdisabled()

Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException

ensurePackPBOenabledback to summary
pack-priv static void ensurePackPBOenabled()

Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException

ensureUnpackPBOdisabledback to summary
pack-priv static void ensureUnpackPBOdisabled()

Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException

ensureUnpackPBOenabledback to summary
pack-priv static void ensureUnpackPBOenabled()

Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException