Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class ARBShadingLanguageInclude

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

Native bindings to the ARB_shading_language_include extension.

This extension introduces a #include GLSL directive to allow reusing the same shader text in multiple shaders and defines the semantics and syntax of the names allowed in #include directives. It also defines API mechanisms to define the named string backing a #include.

Introduction

The GLSL #include mechanism looks up paths in a tree built through the OpenGL API. This appendix describes the syntax and semantic model of the tree and paths into the tree. How the tree is used is up to users of the tree, like the OpenGL API or GLSL.

The Tree

The tree is a singly rooted hierarchy of tree locations. The root may have one or more child locations, and any location may in turn have its own children. Except for the root, each location has exactly one parent; the root has no parent.

Paths into the Tree

The locations in the tree are created or looked up by path strings. The path string "/" locates the root of the tree. The path "/foo" locates the child "foo" of the root. Formally, a valid path is a sequence of tokens delimited by the beginning of the string, by the path-separator forward slash ( / ), and by the end of the string. The string "foo/bar" has two tokens; "foo" and "bar". The string "/foo/./bar" has 3 tokens; "foo", ".", and "bar". The string "/foo/.." has two tokens; "foo" and "..". The string "/foo/.bar" has two tokens; "foo" and ".bar". A path is invalid if

There are no path escape characters, so there is no way to get the forward slash delimiter within a single token.

When using a path to lookup a tree location, the path tokens are used to walk the tree. The initial location to start the walk is specified by the user of the tree and is updated as follows by the tokens in the path. (Paths starting with "/" will start at the root.) Taken left to right:

The token ".." walks to the parent. Or, if already at the root, then the location remains at the root.

The token "." leaves the location unchanged.

Any other token is considered the name of a child of the current location, and walks to that child. (If there is no child of that name, this may result in a failed lookup or in the child being created, as specified by the user of the tree for the operation being performed.)

Associated Strings

Each location in the tree can have an additional string associated with it (that a user like the #include mechanism can use as an included string). This is true even for locations that have children: "/foo/bar" can exist in the tree at the same time that "/foo" has an additional string associated with it. Typically, when a path is used to find a location in the tree, it is for the purpose of returning this associated string.

Hence, the tree can be built from a collection of (path,string) pairs, where path is a string establishing the existence of a location in the tree and string is the string associated with the node. Details of how to do this are specified by the user of the tree.

Requires GLSL 1.10.

Field Summary

Modifier and TypeField and Description
public static final int
GL_NAMED_STRING_LENGTH_ARB

Accepted by the pname parameter of GetNamedStringivARB.

public static final int
GL_NAMED_STRING_TYPE_ARB

Accepted by the pname parameter of GetNamedStringivARB.

public static final int
GL_SHADER_INCLUDE_ARB

Accepted by the type parameter of NamedStringARB.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
glCompileShaderIncludeARB(int
the shader object compile
shader
,
PointerBuffer
an ordered array of count pointers to optionally null-terminated character strings defining search paths
path
,
IntBuffer
an array count values with the number of characters in each string (the string length). If an element in length is negative, its accompanying string is null-terminated. If length is NULL, all strings in the path argument are considered null-terminated.
length
)

Compiles a shader object.

public static void
glCompileShaderIncludeARB(int shader, PointerBuffer path, int[] length)

Array version of: CompileShaderIncludeARB

public static void
glDeleteNamedStringARB(ByteBuffer
the name associated with the string
name
)

Deletes a named string.

public static void
glDeleteNamedStringARB(CharSequence
the name associated with the string
name
)

Deletes a named string.

public static void
glGetNamedStringARB(ByteBuffer
the name associated with the string
name
,
IntBuffer
a buffer in which to place the actual number of characters written into string, excluding the null terminator. If NULL, no length is returned.
stringlen
,
ByteBuffer
a buffer in which to place the returned string
string
)

Returns in string the string corresponding to the specified name.

public static void
glGetNamedStringARB(CharSequence
the name associated with the string
name
,
IntBuffer
a buffer in which to place the actual number of characters written into string, excluding the null terminator. If NULL, no length is returned.
stringlen
,
ByteBuffer
a buffer in which to place the returned string
string
)

Returns in string the string corresponding to the specified name.

public static String
glGetNamedStringARB(CharSequence
the name associated with the string
name
,
int
the maximum number of characters that may be written into string, including the null terminator
bufSize
)

Returns in string the string corresponding to the specified name.

public static String
glGetNamedStringARB(CharSequence
the name associated with the string
name
)

Returns in string the string corresponding to the specified name.

public static void
glGetNamedStringARB(ByteBuffer name, int[] stringlen, ByteBuffer string)

Array version of: GetNamedStringARB

public static void
glGetNamedStringARB(CharSequence name, int[] stringlen, ByteBuffer string)

Array version of: GetNamedStringARB

public static int
glGetNamedStringiARB(CharSequence
the name associated with the string
name
,
int
the parameter to query. One of:
NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
pname
)

Returns properties of the named string whose tree location corresponds to name.

public static void
glGetNamedStringivARB(ByteBuffer
the name associated with the string
name
,
int
the parameter to query. One of:
NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
pname
,
IntBuffer
a buffer in which to place the returned value
params
)

Returns properties of the named string whose tree location corresponds to name.

public static void
glGetNamedStringivARB(CharSequence
the name associated with the string
name
,
int
the parameter to query. One of:
NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
pname
,
IntBuffer
a buffer in which to place the returned value
params
)

Returns properties of the named string whose tree location corresponds to name.

public static void
glGetNamedStringivARB(ByteBuffer name, int pname, int[] params)

Array version of: GetNamedStringivARB

public static void
glGetNamedStringivARB(CharSequence name, int pname, int[] params)

Array version of: GetNamedStringivARB

public static boolean
glIsNamedStringARB(ByteBuffer
the name associated with the string
name
)

Returns TRUE if the tree location corresponding to name has a string associated with it, and FALSE if the tree location has no string associated with it.

public static boolean
glIsNamedStringARB(CharSequence
the name associated with the string
name
)

Returns TRUE if the tree location corresponding to name has a string associated with it, and FALSE if the tree location has no string associated with it.

public static void
glNamedStringARB(int
the string type. Must be:
SHADER_INCLUDE_ARB
type
,
ByteBuffer
the name associated with the string
name
,
ByteBuffer
an arbitrary string of characters
string
)

Specifies a string and its name.

public static void
glNamedStringARB(int
the string type. Must be:
SHADER_INCLUDE_ARB
type
,
CharSequence
the name associated with the string
name
,
CharSequence
an arbitrary string of characters
string
)

Specifies a string and its name.

public static native void
nglCompileShaderIncludeARB(int shader, int count, long path, long length)

Unsafe version of: CompileShaderIncludeARB

public static native void
nglDeleteNamedStringARB(int
the number of characters in name. If negative, name is considered to be a null-terminated string.
namelen
,
long name)

Unsafe version of: DeleteNamedStringARB

public static native void
nglGetNamedStringARB(int
the number of characters in name. If negative, name is considered to be a null-terminated string.
namelen
,
long name, int
the maximum number of characters that may be written into string, including the null terminator
bufSize
,
long stringlen, long string)

Unsafe version of: GetNamedStringARB

public static native void
nglGetNamedStringivARB(int
the number of characters in name. If negative, name is considered to be a null-terminated string.
namelen
,
long name, int pname, long params)

Unsafe version of: GetNamedStringivARB

public static native boolean
nglIsNamedStringARB(int
the number of characters in name. If negative, name is considered to be a null-terminated string.
namelen
,
long name)

Unsafe version of: IsNamedStringARB

public static native void
nglNamedStringARB(int type, int
the number of characters in name. If negative, name is considered to be a null-terminated string.
namelen
,
long name, int
the number of characters in string. If negative, string is considered to be a null-terminated string.
stringlen
,
long string)

Unsafe version of: NamedStringARB

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_NAMED_STRING_LENGTH_ARBback to summary
public static final int GL_NAMED_STRING_LENGTH_ARB

Accepted by the pname parameter of GetNamedStringivARB.

GL_NAMED_STRING_TYPE_ARBback to summary
public static final int GL_NAMED_STRING_TYPE_ARB

Accepted by the pname parameter of GetNamedStringivARB.

GL_SHADER_INCLUDE_ARBback to summary
public static final int GL_SHADER_INCLUDE_ARB

Accepted by the type parameter of NamedStringARB.

Constructor Detail

ARBShadingLanguageIncludeback to summary
protected ARBShadingLanguageInclude()

Method Detail

glCompileShaderIncludeARBback to summary
public static void glCompileShaderIncludeARB(int shader, PointerBuffer path, IntBuffer length)

Compiles a shader object.

The ordered list of paths is used during compilation, together with the arguments of #include directives in the shader source, to search for named strings corresponding to the #include directives. If a #include directive does not correspond to a valid named string, compilation will fail.

Parameters
shader:int

the shader object compile

path:PointerBuffer

an ordered array of count pointers to optionally null-terminated character strings defining search paths

length:IntBuffer

an array count values with the number of characters in each string (the string length). If an element in length is negative, its accompanying string is null-terminated. If length is NULL, all strings in the path argument are considered null-terminated.

glCompileShaderIncludeARBback to summary
public static void glCompileShaderIncludeARB(int shader, PointerBuffer path, int[] length)

Array version of: CompileShaderIncludeARB

glDeleteNamedStringARBback to summary
public static void glDeleteNamedStringARB(ByteBuffer name)

Deletes a named string.

Parameters
name:ByteBuffer

the name associated with the string

glDeleteNamedStringARBback to summary
public static void glDeleteNamedStringARB(CharSequence name)

Deletes a named string.

Parameters
name:CharSequence

the name associated with the string

glGetNamedStringARBback to summary
public static void glGetNamedStringARB(ByteBuffer name, IntBuffer stringlen, ByteBuffer string)

Returns in string the string corresponding to the specified name. The returned string will be null-terminated.

Parameters
name:ByteBuffer

the name associated with the string

stringlen:IntBuffer

a buffer in which to place the actual number of characters written into string, excluding the null terminator. If NULL, no length is returned.

string:ByteBuffer

a buffer in which to place the returned string

glGetNamedStringARBback to summary
public static void glGetNamedStringARB(CharSequence name, IntBuffer stringlen, ByteBuffer string)

Returns in string the string corresponding to the specified name. The returned string will be null-terminated.

Parameters
name:CharSequence

the name associated with the string

stringlen:IntBuffer

a buffer in which to place the actual number of characters written into string, excluding the null terminator. If NULL, no length is returned.

string:ByteBuffer

a buffer in which to place the returned string

glGetNamedStringARBback to summary
public static String glGetNamedStringARB(CharSequence name, int bufSize)

Returns in string the string corresponding to the specified name. The returned string will be null-terminated.

Parameters
name:CharSequence

the name associated with the string

bufSize:int

the maximum number of characters that may be written into string, including the null terminator

Annotations
@NativeType:void
glGetNamedStringARBback to summary
public static String glGetNamedStringARB(CharSequence name)

Returns in string the string corresponding to the specified name. The returned string will be null-terminated.

Parameters
name:CharSequence

the name associated with the string

Annotations
@NativeType:void
glGetNamedStringARBback to summary
public static void glGetNamedStringARB(ByteBuffer name, int[] stringlen, ByteBuffer string)

Array version of: GetNamedStringARB

glGetNamedStringARBback to summary
public static void glGetNamedStringARB(CharSequence name, int[] stringlen, ByteBuffer string)

Array version of: GetNamedStringARB

glGetNamedStringiARBback to summary
public static int glGetNamedStringiARB(CharSequence name, int pname)

Returns properties of the named string whose tree location corresponds to name.

Parameters
name:CharSequence

the name associated with the string

pname:int

the parameter to query. One of:

NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
Annotations
@NativeType:void
glGetNamedStringivARBback to summary
public static void glGetNamedStringivARB(ByteBuffer name, int pname, IntBuffer params)

Returns properties of the named string whose tree location corresponds to name.

Parameters
name:ByteBuffer

the name associated with the string

pname:int

the parameter to query. One of:

NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
params:IntBuffer

a buffer in which to place the returned value

glGetNamedStringivARBback to summary
public static void glGetNamedStringivARB(CharSequence name, int pname, IntBuffer params)

Returns properties of the named string whose tree location corresponds to name.

Parameters
name:CharSequence

the name associated with the string

pname:int

the parameter to query. One of:

NAMED_STRING_LENGTH_ARBNAMED_STRING_TYPE_ARB
params:IntBuffer

a buffer in which to place the returned value

glGetNamedStringivARBback to summary
public static void glGetNamedStringivARB(ByteBuffer name, int pname, int[] params)

Array version of: GetNamedStringivARB

glGetNamedStringivARBback to summary
public static void glGetNamedStringivARB(CharSequence name, int pname, int[] params)

Array version of: GetNamedStringivARB

glIsNamedStringARBback to summary
public static boolean glIsNamedStringARB(ByteBuffer name)

Returns TRUE if the tree location corresponding to name has a string associated with it, and FALSE if the tree location has no string associated with it.

Parameters
name:ByteBuffer

the name associated with the string

Annotations
@NativeType:GLboolean
glIsNamedStringARBback to summary
public static boolean glIsNamedStringARB(CharSequence name)

Returns TRUE if the tree location corresponding to name has a string associated with it, and FALSE if the tree location has no string associated with it.

Parameters
name:CharSequence

the name associated with the string

Annotations
@NativeType:GLboolean
glNamedStringARBback to summary
public static void glNamedStringARB(int type, ByteBuffer name, ByteBuffer string)

Specifies a string and its name. Such strings can be included by name in shaders during compilation, allowing reuse of the same code segments.

After calling NamedStringARB, the contents of string are associated with the tree location corresponding to name. If a string is already associated with that tree location, it will be replaced with the new string.

Parameters
type:int

the string type. Must be:

SHADER_INCLUDE_ARB
name:ByteBuffer

the name associated with the string

string:ByteBuffer

an arbitrary string of characters

glNamedStringARBback to summary
public static void glNamedStringARB(int type, CharSequence name, CharSequence string)

Specifies a string and its name. Such strings can be included by name in shaders during compilation, allowing reuse of the same code segments.

After calling NamedStringARB, the contents of string are associated with the tree location corresponding to name. If a string is already associated with that tree location, it will be replaced with the new string.

Parameters
type:int

the string type. Must be:

SHADER_INCLUDE_ARB
name:CharSequence

the name associated with the string

string:CharSequence

an arbitrary string of characters

nglCompileShaderIncludeARBback to summary
public static native void nglCompileShaderIncludeARB(int shader, int count, long path, long length)

Unsafe version of: CompileShaderIncludeARB

nglDeleteNamedStringARBback to summary
public static native void nglDeleteNamedStringARB(int namelen, long name)

Unsafe version of: DeleteNamedStringARB

Parameters
namelen:int

the number of characters in name. If negative, name is considered to be a null-terminated string.

nglGetNamedStringARBback to summary
public static native void nglGetNamedStringARB(int namelen, long name, int bufSize, long stringlen, long string)

Unsafe version of: GetNamedStringARB

Parameters
namelen:int

the number of characters in name. If negative, name is considered to be a null-terminated string.

bufSize:int

the maximum number of characters that may be written into string, including the null terminator

nglGetNamedStringivARBback to summary
public static native void nglGetNamedStringivARB(int namelen, long name, int pname, long params)

Unsafe version of: GetNamedStringivARB

Parameters
namelen:int

the number of characters in name. If negative, name is considered to be a null-terminated string.

nglIsNamedStringARBback to summary
public static native boolean nglIsNamedStringARB(int namelen, long name)

Unsafe version of: IsNamedStringARB

Parameters
namelen:int

the number of characters in name. If negative, name is considered to be a null-terminated string.

nglNamedStringARBback to summary
public static native void nglNamedStringARB(int type, int namelen, long name, int stringlen, long string)

Unsafe version of: NamedStringARB

Parameters
namelen:int

the number of characters in name. If negative, name is considered to be a null-terminated string.

stringlen:int

the number of characters in string. If negative, string is considered to be a null-terminated string.