next up previous contents
Next: Transformation functions Up: KGL API Previous: Query functions   Contents

Subsections

Texture functions

Allowable texture size height and width in pixels are 8, 16, 32, 64, 128, 256, 512, and 1024. You can load a texture using any combination of the previous values. Only 2D textures are supported. Textures are loaded upside down in keeping with the sprit of OpenGL. Be aware of this when mixing KGL and the PVR API. You may have to flip the V texture coordinates (V = 1 - V) depending upon your application.

void glBindTexture(GLenum target, GLuint texture)

The only supported target is GL_TEXTURE_2D.

void glDeleteTextures(GLsizei n, const GLuint *textures)

void glGenTextures(GLsizei n, GLuint *textures)

void glKosTex2D(GLint internal_fmt, GLsizei width, GLsizei height, pvr_ptr_t txr_address, )

If you have already allocated and loaded a texture you can use this shortcut function to make it available to KGL. The internal_fmt varies from from the OpenGL spec. The table shows the internal formats supported by the PVR2.

internal_fmt
GL_ARGB1555
GL_RGB565
GL_ARGB4444
GL_YUV422
GL_BUMP
GL_ARGB1555_TWID
GL_RGB565_TWID
GL_ARGB4444_TWID
GL_YUV422_TWID
GL_BUMP_TWID

void glTexEnvi(GLenum target, GLenum pname, GLint param)

Setup the texture environment. See the following table for valid arguments to this function.

target pname param
GL_TEXTURE_2D GL_TEXTURE_ENV_MODE GL_REPLACE
    GL_MODULATE (default)
    GL_DECAL
    GL_MODULATEALPHA

void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)

Defines a two-dimensional texture. The only supported target is GL_TEXTURE_2D. Border, level, and pixel conversion (type) are not supported. The internalFormat and format arguments must be the same. See the table in section [*], on page [*].

void glTexParameteri(GLenum target, GLenum pname, GLint param)

Allows specification of additional texture attributes.

target pname param
GL_TEXTURE_2D GL_TEXTURE_FILTER
GL_FILTER_NONE (default)
GL_FILTER_BILINEAR
  GL_TEXTURE_WRAP_S
GL_REPEAT (default)
GL_CLAMP
  GL_TEXTURE_WRAP_T
GL_REPEAT (default)
GL_CLAMP


next up previous contents
Next: Transformation functions Up: KGL API Previous: Query functions   Contents
Dan Potter 2002-07-29