Chromium defines several extensions to the OpenGL API to provide special features. This section documents those extensions.
All Chromium extensions to OpenGL are identified by CR in the same way that SGI is used to identify SGI's OpenGL extensions.
At compile time the application should use #ifdef extension_name /
#endif
around Chromium-related code so that it'll compile when the
extension is not defined.
At runtime the application should call
glGetString(GL_EXTENSIONS)
to see if the particular
extension is supported. Then the application should use
wglGetProcAddress()
or glXGetProcAddress()
to
obtain a pointer to any extension functions that are needed.
The following extensions are available.
This extension adds three new functions to OpenGL. By itself, this extension provides no new features. Instead, other Chromium extensions are layered on top of this one.
target
specifies the parameter being set.value
is the integer value.GL_INVALID_ENUM
will be recorded if
target
is not a recognized value.
target
specifies the parameter being set.value
is the floating point value.GL_INVALID_ENUM
will be recorded if
target
is not a recognized value.
target
specifies the parameter being set.type
specifies the datatype of the value(s) and may be
GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT,
GL_UNSIGNED_INT, GL_FLOAT or GL_DOUBLE
.count
specifies the number of values in the vector and
must be greater than or equal to one.values
points to the beginning of the values vector.GL_INVALID_ENUM
will be recorded if
target
or type
is not a recognized value. The
error GL_INVALID_VALUE
will be recorded if
count
is less than one.
target
specifies the parameter to query.index
specifies the element in an array of target values,
if applicable.type
specifies the datatype of the return value(s) and may
be GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT,
GL_INT, GL_UNSIGNED_INT, GL_FLOAT or GL_DOUBLE
.count
specifies the number of values in the return values
vector and must be greater than or equal to one.values
points to the beginning of the return values
vector.GL_INVALID_ENUM
will be recorded if
target
or type
is not a recognized value. The
error GL_INVALID_VALUE
will be recorded if
count
is less than one.
This extension is used internally to Chromium to specify the position of the virtual cursor.
This extension requires the GL_CR_state_parameter extension.
The new token CR_CURSOR_POSITION_CR
may be specified as the
target
parameter to glChromiumParametervCR
. The
type
parameter must be GL_INTEGER
and
count
must be 2. The values
parameter points to
an array of two integers with represents the cursor's (x,y) position.
This extension is used to inform Chromium that subsequent geometry is bounded by a specific bounding box. This information can be used to improve the performance of the tile-sort, readback and binaryswap SPUs.
This extension requires the GL_CR_state_parameter extension.
New tokens accepted by the target
parameter to glChromiumParametervCR
:
count
parameter
should be zero. The type
parameter value is not
significant.
count
should be 8.
type
should be GL_FLOAT. values
is an array
of eight floating point values specifying the window-space bounding
box: [xmin, ymin, zmin, wmin, xmax, ymax, zmax, wmax]
.
count
should be 6.
type
should be GL_FLOAT. values
is an array
of six floating point values specifying the object-space bounding box:
[xmin, ymin, zmin, xmax, ymax, zmax]
.
This extension is allows the application to insert its own text into the output produced by the printSPU.
This extension requires the GL_CR_state_parameter extension.
The print SPU can emit user text by calling
glChromiumParametervCR(GL_PRINT_STRING_CR, GL_BYTE, count,
string)
where count
is the length of the text and
string
is the text.
XXX what about printing integers and floats?
XXX should we rely on count specifying the string length, or assume that it's a null-terminated string?
This extension is allows the application to query and set parameters of the tilesort SPU, if present.
This extension requires the GL_CR_state_parameter extension.
The query targets currently supported with the glGetChromiumParametervCR
function are:
index
is ignored.type
must be GL_INT
.count
must be 2.values[0]
will return the widthvalues[1]
will return the height.
index
is ignored.type
must be GL_INT
.count
must be 1.values[0]
will return the number of servers.
index
is ignored.type
must be GL_INT
.count
should be N, where N is the number of servers
returned by querying GL_NUM_SERVERS_CR
.values[i]
will return the number of vertices sent to
server i where 0 <= i < N.
index
specifies the server number.type
must be GL_INT
.count
must be 1.values[0]
will return the number of tiles on the given
server.
index
encodes both the server number and tile number:
index = server * 65536 + tile. Alternately, index = (server <<
16) | tile.type
must be GL_INT
.count
must be 4.values[0]
will return x1 (left).values[1]
will return y1 (bottom).values[2]
will return x2 (right).values[3]
will return y2 (top).
The vertex counters which are queried with
GL_VERTEX_COUNTS_CR
may be reset to zero with either of the
following commands:
glChromiumParameteriCR(GL_RESET_VERTEX_COUNTERS_CR, 0);
glChromiumParameterfCR(GL_RESET_VERTEX_COUNTERS_CR, 0.0);
This extension allows you to query the size of the currently bound rendering window. This extension requires the GL_CR_state_parameter extension.
New tokens accepted by the target
parameter to glGetChromiumParametervCR
:
count
parameter should be 2. The type
parameter should be GL_INT. values[0]
will be the window
width. values[1]
will be the window height.
This extension allows you to specify the number of clients which should synchronize on barriers within the readback SPU. This does not set the barrier size for the application's barriers. This extension requires the GL_CR_state_parameter extension.
See the threadtest.c file for an example.
New tokens accepted by the target
parameter to glChromiumParameteriCR
:
value
parameter indicates the barrier size.
This extension allows you to specify the tilesort parameters (number of tiles and their sizes) to the tilesort SPU and servers. This extension requires the GL_CR_state_parameter extension.
New tokens accepted by the target
parameter to glChromiumParametervCR
:
count
parameter indicates the number of tile
parameters, defined below.
type
parameter should be GL_INT. The
values
parameter defines an array of values as follows:
values[0] = the server number values[1] = the overall mural width values[2] = the overall mural height values[3] = number of tiles values[4] = first tile x pos values[5] = first tile y pos values[6] = first tile width values[7] = first tile height values[8] = second tile x pos values[9] = second tile y pos values[10] = second tile width ...
count
should be 4 + 4 * (number of tiles).
This extension defines semaphore and barrier functions for synchronization.
See the Writing a parallel application section for more information.
This extension allows control over display list, texture object and vertex program ID management in network/server nodes. This is useful for parallel applications.
Specifically, it allows a program to set the values for the server configuration options: shared_display_lists, shared_texture_objects and shared_programs at runtime.
New tokens accepted by the target
parameter to glChromiumParameteriCR
:
value
parameter may be GL_TRUE or GL_FALSE to indicate
whether display list IDs should be shared or unshared by all clients,
respectively. This corresponds to the shared_display_lists
network node configuration option. The default value is GL_TRUE.
value
parameter may be GL_TRUE or GL_FALSE to indicate
whether texture object IDs should be shared or unshared by all clients,
respectively. This corresponds to the shared_texture_objects
network node configuration option. The default value is GL_TRUE.
value
parameter may be GL_TRUE or GL_FALSE to indicate
whether vertex/fragment program IDs should be shared or unshared by all
clients, respectively. This corresponds to the shared_programs
network node configuration option. The default value is GL_TRUE.
In general, only parallel applications need to be concerned with these parameters. For example, if each of N instances of a parallel application create a display list named K and each application puts different OpenGL commands into the N instances of K, then GL_SHARED_DISPLAY_LISTS_CR should be set to GL_FALSE. The server will then distinguish between the N different lists named K.
This extension allows an application to specify unique projection and viewing matrices for each server in a tilesort configuration. This is typically used to support a non-planar rendering environment, such as a CAVE. See the Non-planer tilesort section for details.
Three new tokens for glChromiumParametervCR
are introduced:
To set the per-server view matrix, call:
glChromiumParameterv(GL_SERVER_VIEW_MATRIX_CR, GL_FLOAT, 17, m)
where m[0] is the server index, starting at zero and m[1] through m[16] specify the sixteen elements of the view matrix.
To set the per-server projection matrix, call:
glChromiumParametervCR(GL_SERVER_PROJECTION_MATRIX_CR, GL_FLOAT, 17, m)
where m[0] is the server index, starting at zero and m[1] through m[16] specify the sixteen elements of the projection matrix.
Alternately, the per-server projection matrix may be set by calling:
glChromiumParametervCR(GL_SERVER_FRUSTUM_CR, GL_FLOAT, 7, m)
where m[0] is the server index, starting at zero and m[1] through m[7] are the left, right, bottom, top, near and far frustum parameters.
Note that these functions are meant to be used by applications which are running with a tilesort SPU.
Also note that if the application sets the view or projection matrices then the Python configuration file should not set the matrices via configuration options. I.e. either set the matrices in the configuration file or the application, but not both places.