-
Set texture environment parameter
(if not common for all texture, this has to be done later):
gl.glTexEnvf( .... );
-
Read the texture into main memory
(usually from a file) into a ByteBuffer.
-
Create texture object(s), one ID for each texture
we want in texture memory:
gl.glGenTextures( ... );
-
Specify a texture for an object
and load the texture from client memory (main memory)
into OpenGL's texture memory:
gl.glBindTexture( ... ); // Set current texture.
gl.glTexImage2D( ... );
OR
glu.gluBuild2DMipmaps( ... )
-
Set the textures' parameter:
gl.glBindTexture( ... ); // Set current texture.
gl.glTexParameteri( ... );
-
Enable texture mapping:
gl.glEnable( GL.GL_TEXTURE_2D );
-
Indicate how the texture
is to be applied to each pixel
Draw the scene, supplying both
texture and geometric coordinates:
gl.glBindTexture( ... ); // Set current texture.
gl.glTexCoord2f( .. );
gl.glVertex3f( .. );
gl.glTexCoord2f( .. );
gl.glVertex3f( .. );
-
Delete texture from texture memory
(maybe disable textureing):
gl.glDeleteTextures( ... );
gl.glDisable( ... );