The following code example is an IRIS GL texture definition:
float texprops[] = { TX_MINFILTER, TX_POINT,
TX_MAGFILTER, TX_POINT,
TX_WRAP_S, TX_REPEAT,
TX_WRAP_T, TX_REPEAT,
TX_NULL };
textdef2d(1, 1, 6, 6, granite_texture, 7, texprops);
In the preceding example, texdef specifies the TX_POINT filter as both the magnification and the minimizing filter, and TX_REPEAT as the wrapping mechanism. It also specifies the texture image: granite_texture.
In OpenGL, glTexImage specifies the image and glTexParameter sets the property. To translate IRIS GL texture definitions, replace the textdef function with glTexImage and one or more calls to glTexParameter.
The preceding IRIS GL code looks like this when translated to OpenGL:
GLfloat nearest[] = {GL_NEAREST};
GLfloat repeat = {GL_REPEAT};
glTexParameterfv( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, nearest);
glTexParameterfv( GL_TEXTURE_1D, GL_TEXTURE_MAGILTER, nearest);
glTexParameterfv( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, repeat);
glTexParameterfv( GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, nearest);
glTexImage1D( GL_TEXTURE_1D, 0, 1, 6, 0, GL_RGB,
GL_UNSIGNED_SHORT, granite_texture);
The following table lists the IRIS GL texture parameters and their equivalent OpenGL parameters.
IRIS GL Texture Parameter | OpenGL Texture Parameter |
---|---|
TX_MINFILTER | GL_TEXTURE_MIN_FILTER |
TX_MAGFILTER | GL_TEXTURE_MAG_FILTER |
TX_WRAP, TX_WRAP_S | GL_TEXTURE_WRAP_S |
TX_WRAP, TX_WRAP_T | GL_TEXTURE_WRAP_T GL_TEXTURE_BORDER_COLOR |
The following table lists the possible values of the IRIS GL texture parameters and their equivalent OpenGL parameters.
IRIS GL Texture Parameter | OpenGL Texture Parameter |
---|---|
TX_POINT | GL_NEAREST |
TX_BILINEAR | GL_LINEAR |
TX_MIPMAP_POINT | GL_NEAREST_MIPMAP_NEAREST |
TX_MIPMAP_BILINEAR | GL_LINEAR_MIPMAP_NEAREST |
TX_MIPMAP_LINEAR | GL_NEAREST_MIPMAP_LINEAR |
TX_TRILINEAR | GL_LINEAR_MIPMAP_LINEAR |