Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class ARBGetProgramBinary

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

Native bindings to the ARB_get_program_binary extension.

This extension introduces new commands to retrieve and set the binary representation of a program object. GetProgramBinary allows an application to cache compiled and linked programs to avoid compiling and linking when used again. This may even allow the GL itself to act as an offline compiler. The resulting program binary can be reloaded into the GL via ProgramBinary. This is a very useful path for applications that wish to remain portable by shipping pure GLSL source shaders, yet would like to avoid the cost of compiling their shaders at runtime. Instead an application can supply its GLSL source shaders during first application run, or even during installation. The application then compiles and links its shaders and reads back the program binaries. On subsequent runs, only the program binaries need be supplied.

ProgramBinary may also accept binaries in vendor-specific formats produced by specialized offline compilation tools. This extension does not add any such formats, but allows for them in further extensions. Though the level of optimization may not be identical -- the offline shader compiler may have the luxury of more aggressive optimization at its disposal -- program binaries generated online by the GL are interchangeable with those generated offline by an SDK tool.

Requires OpenGL 3.0. Promoted to core in OpenGL 4.1.

Field Summary

Modifier and TypeField and Description
public static final int
GL_NUM_PROGRAM_BINARY_FORMATS

Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv and GetDoublev.

public static final int
GL_PROGRAM_BINARY_FORMATS

Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv and GetDoublev.

public static final int
GL_PROGRAM_BINARY_LENGTH

Accepted by the pname parameter of GetProgramiv.

public static final int
GL_PROGRAM_BINARY_RETRIEVABLE_HINT

Accepted by the pname parameter of ProgramParameteri and GetProgramiv.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
glGetProgramBinary(int
the name of a program object whose binary representation to retrieve
program
,
IntBuffer
the address of a variable to receive the number of bytes written into binary
length
,
IntBuffer
a variable to receive a token indicating the format of the binary data returned by the GL
binaryFormat
,
ByteBuffer
an array into which the GL will return program's binary representation
binary
)

Returns a binary representation of a program object's compiled and linked executable source.

public static void
glGetProgramBinary(int program, int[] length, int[] binaryFormat, ByteBuffer binary)

Array version of: GetProgramBinary

public static void
glProgramBinary(int
the name of a program object into which to load a program binary
program
,
int
the format of the binary data in binary
binaryFormat
,
ByteBuffer
an array containing the binary to be loaded into program
binary
)

Loads a program object with a program binary.

public static void
glProgramParameteri(int
the name of a program object whose parameter to modify
program
,
int
the name of the parameter to modify. One of:
PROGRAM_BINARY_RETRIEVABLE_HINTPROGRAM_SEPARABLE
pname
,
int
the new value of the parameter specified by pname for program
value
)

Specifies the integer value of a program object parameter.

public static void
nglGetProgramBinary(int program, int
the size of the buffer whose address is given by binary
bufSize
,
long length, long binaryFormat, long binary)

Unsafe version of: GetProgramBinary

public static void
nglProgramBinary(int program, int binaryFormat, long binary, int
the number of bytes contained in binary
length
)

Unsafe version of: ProgramBinary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_NUM_PROGRAM_BINARY_FORMATSback to summary
public static final int GL_NUM_PROGRAM_BINARY_FORMATS

Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv and GetDoublev.

GL_PROGRAM_BINARY_FORMATSback to summary
public static final int GL_PROGRAM_BINARY_FORMATS

Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv and GetDoublev.

GL_PROGRAM_BINARY_LENGTHback to summary
public static final int GL_PROGRAM_BINARY_LENGTH

Accepted by the pname parameter of GetProgramiv.

GL_PROGRAM_BINARY_RETRIEVABLE_HINTback to summary
public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT

Accepted by the pname parameter of ProgramParameteri and GetProgramiv.

Constructor Detail

ARBGetProgramBinaryback to summary
protected ARBGetProgramBinary()

Method Detail

glGetProgramBinaryback to summary
public static void glGetProgramBinary(int program, IntBuffer length, IntBuffer binaryFormat, ByteBuffer binary)

Returns a binary representation of a program object's compiled and linked executable source.

Parameters
program:int

the name of a program object whose binary representation to retrieve

length:IntBuffer

the address of a variable to receive the number of bytes written into binary

binaryFormat:IntBuffer

a variable to receive a token indicating the format of the binary data returned by the GL

binary:ByteBuffer

an array into which the GL will return program's binary representation

glGetProgramBinaryback to summary
public static void glGetProgramBinary(int program, int[] length, int[] binaryFormat, ByteBuffer binary)

Array version of: GetProgramBinary

glProgramBinaryback to summary
public static void glProgramBinary(int program, int binaryFormat, ByteBuffer binary)

Loads a program object with a program binary.

Parameters
program:int

the name of a program object into which to load a program binary

binaryFormat:int

the format of the binary data in binary

binary:ByteBuffer

an array containing the binary to be loaded into program

glProgramParameteriback to summary
public static void glProgramParameteri(int program, int pname, int value)

Specifies the integer value of a program object parameter.

Parameters
program:int

the name of a program object whose parameter to modify

pname:int

the name of the parameter to modify. One of:

PROGRAM_BINARY_RETRIEVABLE_HINTPROGRAM_SEPARABLE
value:int

the new value of the parameter specified by pname for program

nglGetProgramBinaryback to summary
public static void nglGetProgramBinary(int program, int bufSize, long length, long binaryFormat, long binary)

Unsafe version of: GetProgramBinary

Parameters
bufSize:int

the size of the buffer whose address is given by binary

nglProgramBinaryback to summary
public static void nglProgramBinary(int program, int binaryFormat, long binary, int length)

Unsafe version of: ProgramBinary

Parameters
length:int

the number of bytes contained in binary