Texture Mapping in OpenGL
An Introduction |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
void glGenTextures(GLsizei n, GLuint* names)
n
unused "names" (actually integers)
void glBindTexture(GLenum target, GLuint name)
GL_TEXTURE_1D
, GL_TEXTURE_2D
,
GL_TEXTURE_3D
or GL_TEXTURE_CUBE_MAP
void glTexParameter*(GLenum target, GLenum name, TYPE value)
target
is either
GL_TEXTURE_1D
, GL_TEXTURE_2D
,
GL_TEXTURE_3D
or GL_TEXTURE_CUBE_MAP
GL_TEXTURE_WRAP_S
or
GL_TEXTURE_WRAP_T
(the \(s\) and \(t\)
directions)
GL_CLAMP
, GL_REPEAT
,
(GL_CLAMP_TO_EDGE
, GL_CLAMP_TO_BORDER
,
GL_MIRRORED_REPEAT
)
GL_TEXTURE_BORDER_COLOR
GL_TEXTURE_MAG_FILTER
and
GL_TEXTURE_MIN_FILTER
GL_NEAREST
and GL_LINEAR
(and others)
void glTexEnvf(GLenum target, Glenum name, TYPE value)
target
is GL_TEXTURE_ENV
and name
is
GL_TEXTURE_ENV_MODE
GL_REPLACE
, GL_ADD
,
GL_COMBINE
, or GL_BLEND
void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint borderWidth, GLenum format, Glenum type const GLvoid* texels)
target
is GL_TEXTURE_2D (or one of several
other values)
GL_RGB
, GL_RGBA
,
GL_COLOR_INDEX
(or others)
glDeleteTextures()
void glEnable(GLenum capability)
GL_TEXTURE_2D
, GL_TEXTURE_3D
,
(or one of several others)
glBindTexture()
again
glTexCoord*(TYPE coords)
glmReadPPM()
that reads .ppm files
SDL_LoadBMP()
for
reading .bmp files
gluScaleImage()
glCopyTexImage2D()
glTexSubImage2D()
glTexParameter*()
with a
GL_TEXTURE_MIN_FILTER
of either
GL_NEAREST_MIMPAP_NEAREST
,
GL_NEAREST_MIMPAP_LINEAR
,
GL_LINEAR_MIMPAP_NEAREST
or
GL_LINEAR_MIMPAP_LINEAR