I know that sceGumDrawArray is similar to the vertex array functions in OpenGL but I want to know if there are some important differences I should look out for. For instance in OpenGL you have to set pointers to structures of separate information like color and texture. I've worked with sceGumDrawArray before, but don't know how versatile it is with separating and sharing information.
For instance, if I were to draw two cubes with same vertex coordinates but two different sets of texture coordinates, is there a way I can use the same struct that holds vertex info along with two different structs for the texture?
Also, not as related but still, is there a quick "cheat sheet" available somewhere online that shows most of the GU/GUM functions and OpenGL equivalents? Even if mostof the function names are straightforward, there are some subtle differences between both platforms' implementations, and having a guide that you can skim through would help people in writing cross-platform programs.
How flexible is sceGumDrawArray?
- tacoSunday
- Posts: 34
- Joined: Fri Aug 31, 2007 10:05 pm
Straight from the pspgu.h:
sceGumDrawArray is just the stack version of sceGuDrawArray.
Code: Select all
/**
* Draw array of vertices forming primitives
*
* Available primitive-types are:
* - GU_POINTS - Single pixel points (1 vertex per primitive)
* - GU_LINES - Single pixel lines (2 vertices per primitive)
* - GU_LINE_STRIP - Single pixel line-strip (2 vertices for the first primitive, 1 for every following)
* - GU_TRIANGLES - Filled triangles (3 vertices per primitive)
* - GU_TRIANGLE_STRIP - Filled triangles-strip (3 vertices for the first primitive, 1 for every following)
* - GU_TRIANGLE_FAN - Filled triangle-fan (3 vertices for the first primitive, 1 for every following)
* - GU_SPRITES - Filled blocks (2 vertices per primitive)
*
* The vertex-type decides how the vertices align and what kind of information they contain.
* The following flags are ORed together to compose the final vertex format:
* - GU_TEXTURE_8BIT - 8-bit texture coordinates
* - GU_TEXTURE_16BIT - 16-bit texture coordinates
* - GU_TEXTURE_32BITF - 32-bit texture coordinates (float)
*
* - GU_COLOR_5650 - 16-bit color (R5G6B5A0)
* - GU_COLOR_5551 - 16-bit color (R5G5B5A1)
* - GU_COLOR_4444 - 16-bit color (R4G4B4A4)
* - GU_COLOR_8888 - 32-bit color (R8G8B8A8)
*
* - GU_NORMAL_8BIT - 8-bit normals
* - GU_NORMAL_16BIT - 16-bit normals
* - GU_NORMAL_32BITF - 32-bit normals (float)
*
* - GU_VERTEX_8BIT - 8-bit vertex position
* - GU_VERTEX_16BIT - 16-bit vertex position
* - GU_VERTEX_32BITF - 32-bit vertex position (float)
*
* - GU_WEIGHT_8BIT - 8-bit weights
* - GU_WEIGHT_16BIT - 16-bit weights
* - GU_WEIGHT_32BITF - 32-bit weights (float)
*
* - GU_INDEX_8BIT - 8-bit vertex index
* - GU_INDEX_16BIT - 16-bit vertex index
*
* - GU_WEIGHTS(n) - Number of weights (1-8)
* - GU_VERTICES(n) - Number of vertices (1-8)
*
* - GU_TRANSFORM_2D - Coordinate is passed directly to the rasterizer
* - GU_TRANSFORM_3D - Coordinate is transformed before passed to rasterizer
*
* @note Every vertex must align to 32 bits, which means that you HAVE to pad if it does not add up!
*
* Vertex order:
* [for vertices(1-8)]
* [weights (0-8)]
* [texture uv]
* [color]
* [normal]
* [vertex]
* [/for]
*
* @par Example: Render 400 triangles, with floating-point texture coordinates, and floating-point position, no indices
* @code
* sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF,400*3,0,vertices);
* @endcode
*
* @param prim - What kind of primitives to render
* @param vtype - Vertex type to process
* @param count - How many vertices to process
* @param indices - Optional pointer to an index-list
* @param vertices - Pointer to a vertex-list
**/
void sceGuDrawArray(int prim, int vtype, int count, const void* indices, const void* vertices);