Skip to content
jsgf edited this page Jan 21, 2011 · 1 revision

PSPGL supports only 2D textures with power-of-two dimensions. 1D textures can be easily emulated with a Nx1 (or 1xN) texture; 3D textures are just not available.

PSPGL will convert textures you provide into the native hardware format, but it will only perform a limited range of conversions. In general, it will rearrange bits in a pixel format, but it won't convert the type or format of a texture. Therefore, if you want an GL_RGB internal format, you must provide a GL_RGB format texture.

glTexImage2D and glTexSubImage2D work mostly as expected, though glPixelStore has not been implemented, so all textures are assumed to be tightly packed in contigious memory (no 4-byte rounding for each row either). PSPGL will make a copy of your texture data, so you can free/overwrite/reuse your copy immediately. PSPGL will also manage cache flushing, etc, so you don't need to.

Mipmapping mostly works as expected. GL_GENERATE_MIPMAPS texture parameter is supported, so you can get the hardware to generate mipmaps for you. It also supports a GL_GENERATE_MIPMAP_DEBUG_PSP flag, which will add tinting to each mipmap level to make them easier to see. Automatic mipmap generation only works for RGBA texures - not compressed, indexed or luminance/intensity formats.

The PSP hardware seems to have a bug where a texture viewed from a particular angle will use larger mipmaps than necessary, which means the appearance will change on screen as view angle changes, and there may be a performance impact.

The following types and formats are supported:

Format Type Hardware bytes/pixel
GL_RGB GL_UNSIGNED_BYTE 4
GL_RGB GL_UNSIGNED_SHORT_5_5_5_1 2
GL_RGB GL_UNSIGNED_SHORT_5_6_5 2
GL_RGB GL_UNSIGNED_SHORT_4_4_4_4 2
GL_RGB GL_UNSIGNED_SHORT_1_5_5_5_REV 2*
GL_RGB GL_UNSIGNED_SHORT_5_6_5_REV 2*
GL_RGB GL_UNSIGNED_SHORT_4_4_4_4_REV 2*
GL_BGR GL_UNSIGNED_SHORT_5_6_5 2*
GL_RGBA GL_UNSIGNED_BYTE 4*
GL_RGBA GL_UNSIGNED_SHORT_5_5_5_1 2
GL_RGBA GL_UNSIGNED_SHORT_4_4_4_4 2
GL_RGBA GL_UNSIGNED_SHORT_1_5_5_5_REV 2*
GL_RGBA GL_UNSIGNED_SHORT_4_4_4_4_REV 2*
GL_ABGR_EXT GL_UNSIGNED_SHORT_4_4_4_4 2*
GL_LUMINANCE_ALPHA GL_UNSIGNED_BYTE 4
GL_LUMINANCE GL_UNSIGNED_BYTE 1*
GL_ALPHA GL_UNSIGNED_BYTE 1*
GL_INTENSITY GL_UNSIGNED_BYTE 1*

Formats marked with * are native and require no conversion.

EXT_paletted_texture

The PSP hardware supports paletted textures, and PSPGL exposes that with the EXT_paletted_texture extension. Each texture object has its own colour map, which is set with glColorTableEXT using the GL_TEXTURE_2D target. The colour table can be in any of the GL_RGB or GL_RGBA format/type combinations supported for textures. The paletted textures themselves can use a format of GL_COLOR_INDEX4_EXT, GL_COLOR_INDEX8_EXT or GL_COLOR_INDEX16_EXT. There's no way to share a colour table between textures.

glTexSubImage2D does not work properly on 4-bit/texel paletted textures.

GL_ARB_texture_compression and GL_EXT_texture_compression_dxt1

The PSP hardware supports DXTn (aka S3TC) compressed textures. PSPGL implements the glCompressedTexImage2D call to allow compressed textures to be copied into GL. It supports these compressed formats:

  • GL_COMPRESSED_RGB_S3TC_DXT1_EXT
  • GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
  • GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
  • GL_COMPRESSED_RGBA_S3TC_DXT5_EXT glCompressedTexSubImage2D has not been implemented.

Transform, etc

Texture matrix transforms don't work.

Texture coord generation (used for environment mapping, projectors, etc) are not implemented. It seems from looking at the implementation of environment mapping with libgu, some of the lights are used as parameters for texcoord generation, which means that it will interact with lighting (you lose some lights while generating texture coords).

Clone this wiki locally