-
Notifications
You must be signed in to change notification settings - Fork 9
Extensions
PSPGL implements a number of extensions to OpenGL. Some of these subtle extensions of existing behaviour, and some are full OpenGL extensions.
The gl*Pointer functions take a different set of types, which (mostly) match the hardware's capabilities:
Function | Types |
glVertexPointer |
GL_BYTE, GL_SHORT, GL_FLOAT |
glTexCoordPointer |
GL_BYTE, GL_SHORT, GL_FLOAT |
glColorPointer |
GL_UNSIGNED_BYTE, GL_FLOAT (not-native) |
glNormalPointer |
GL_BYTE, GL_SHORT, GL_FLOAT |
A future extension will be to allow glColorPointer to take a variety of packed colour formats, to make better use of the PSP's vertex colour formats.
This is an extension which is return in the GL_EXTENSIONS string. It allows an application to get various performance meaurements out of PSPGL. It defines the following functions:
glEnableStatsPSP(GLenum)
- This enables one aspect of statistics gathering. Currently, the only value it
accepts is
GL_STATS_TIMING_PSP
. glDisableStatsPSP(GLenum)
- Disable statistics gathering.
glResetStatsPSP(GLenum)
- Reset a particular counter or timer. Accepts the values:
- GL_STATS_CMDISSUES_PSP
- Reset the "command issue" counter.
- GL_STATS_QUEUEWAITTIME_PSP
- Reset the "queue wait time" timer.
glGetStatisticsuivPSP(GLenum, GLuint *)
- Return a measturement. Values available are:
- GL_STATS_FRAMETIME_PSP
- Return the total frame time from the end of swap-buffers to swap-buffers for the previous frame.
- GL_STATS_APPTIME_PSP
- Return the amount of time between the end of one swap-buffers to the start of the next.
- GL_STATS_SWAPTIME_PSP
- Return the amount of time spent in the last swap-buffers.
- GL_STATS_CMDISSUES_PSP
- Return the number of buffer flushes since it was last reset.
- GL_STATS_QUEUEWAITTIME_PSP
- Return the amount of time spent waiting for the graphics processor to finish a queue of commands.
All times are in microseconds.
All times are in microseconds.
This extension exposes the PSP's hardware bezier patch drawing abilities. Bezier patches may only be drawn using vertex arrays; there is no immediate mode interface.
Bezier patches are composed of 4x4 control points. You may specify control point arrays larger than 4x4, but they are used in groups of 4x4, with adjacent patches sharing a set of control points. The size of the array should be of the form 4+3n; the hardware will ignore any left-over control points.
The primitives emitted by the hardware when subdividing the patch are treated like primitives specified normally; they are textured, lit, culled. depth tested, etc as usual. Lighting is computed at the subdivided vertices, and so using a patch is an efficient way to tesselate a surface for high-quality lighting.
Functions:
void glDrawBezierArraysPSP(Glenum mode, GLuint u, GLuint v, GLint first)
- This function draws the patch, using a u by v array of control points.
mode
specifies which primitive is to be used for the patch; it may be one of GL_TRIANGLES, GL_LINES or GL_POINTS. void glDrawBezierElementsPSP(GLenum mode, GLuint u, GLuint v, GLenum idx_type, const GLvoid *indices)
void glDrawBezierRangeElementsPSP(GLenum mode, GLuint u, GLuint v, GLenum idx_type, const GLvoid *indices)
- The obvious indexed version of glDrawBezierArrays
void glPatchSubdivisionPSP(GLuint u, GLuint v)
- Sets the level of subdivision performed for each patch. The default value for u and v is 4. 64 seems to be the upper limit.
void glDrawSplineArraysPSP(GLenum mode, GLuint u, GLuint v, GLenum uflags, GLenum vflags, GLint first);
- This draws a spline patch. This is much like a bezier patch, but the whole patch is smooth, rather than being smooth in 4x4 sub-patches. The two flags specify whether the patch is intended to abut another spline patch. There are four flag combinations: GL_PATCH_INNER_INNER_PSP, GL_PATCH_INNER_OUTER_PSP GL_PATCH_OUTER_INNER_PSP and GL_PATCH_OUTER_OUTER_PSP. Each of these specified whether the (u,v)=(1,0) is an inner edge or an outer edge. An inner edge is only drawn up to the 2nd last row of control points; an abutting patch needs to have 3 rows of control points to match up properly. An outer edge goes out to the edge of the control mesh.
void glDrawSplineElementsPSP(GLenum mode, GLuint u, GLuint v, GLenum uflags, GLenum vflags, GLenum idx_type, const GLvoid *indices);
void glDrawSplineRangeElementsPSP(GLenum mode, GLuint start, GLuint end, GLuint u, GLuint v, GLenum uflags, GLenum vflags, GLenum idx_type, const GLvoid *indices);
- The indexed form of glDrawSplineArraysPSP
This extension exposes the PSP's vertex blending (or "skinning") capabilies. When this mode is enabled with glEnable(GL_VERTEX_BLEND_PSP), and a weight array is specified and enabled with glWeightPointerPSP and glEnableClientState(GL_WEIGHT_ARRAY_PSP), each vertex is transformed by the matrices GL_BONE[0-7]_PSP, weighted by the per-vertex weights.
The GL_BONE[0-7]_PSP matrices are normal matricies; they are selected with glMatrixMode, transformed with the normal functions, etc. The only exception is that glPushMatrix will always fail, because they have a max stack depth of 1.
The MODELVIEW matrix still works as expected; it is applied to the result of the weighted summed transforms of the BONE matrices.
Vertex blending is not supported for immediate mode (glBegin/End). Code which mixes immediate mode and vertex arrays while using vertex blending will get unexpected results.
Functions:
void glWeightPointerPSP(GLint size, GLenum type, GLsizei stride, const GLvoid *array)
- Sets the weight pointer.
size
may be 1 to 8, and type may be GL_BYTE, GL_SHORT or GL_FLOAT. Weights must go between texture coords and colour to get a native vertex format.
The PSP transform pipeline contains an extra matrix above OpenGL's transform pipeline. This matrix corresponds to the camera transform, and is applied after the modelview transform. It seems to be mostly redundant, in that you can incorporate it into the modelview matrix without loss of functionality; it might save on some matrix multiplies though. The view matrix also transforms lights, so it allows moving the viewpoint without having to respecify all your lights.
You can operate on this matrix by passing GL_VIEW_PSP to glMatrixMode.
PSPGL supports a debugging mode for mipmap generation, where each mipmap level is tinted to distinguish it from its neighbouring mipmaps. You can enable this mode for a texture by setting the GL_GENERATE_MIPMAP_DEBUG_PSP flag with glTexParameter[if]. It only has an effect when GL_GENERATE_MIPMAP is enabled.