427 429














Open GL Super Bible:Texture Mapping















To access the contents, click the chapter and section titles.


Open GL Super Bible


(Publisher: Macmillan Computer Publishing)

Author(s): Waite group Press

ISBN: 1571690735

Publication Date: 08/01/96

 




Previous
Table of Contents
Next




glTexImage1D

Purpose
Defines a one-dimensional texture image.
Include File
<GL/gl.h>
Syntax
void glTexImage1D(GLenum target, GLint level, Glint components, GLsizei width, GLint border GLenum format, GLenum type, const GLvoid *pixels);
Description
This function defines a one-dimensional texture
image. The image data is subject to modes defined with glPixelMap,
glPixelStore, and glPixelTransfer.


Parameters

target

GLenum: Must be GL_TEXTURE_1D.
level

GLint: The level of detail. Usually 0 unless mipmapping is used.
components

GLint: The number of color components, from 1 to 4.
width

GLsizei: The width of the texture image. This must be a power of 2 or follow the formula 2n + 2*border.
border

GLint: The width of the border. Must be 0, 1, or 2.
format

GLenum: The format of the pixel data. Valid
formats are as follows:





GL_COLOR_INDEX
Pixel values are color indices.

GL_RED
Pixel values are red intensities.

GL_GREEN
Pixel values are green intensities.

GL_BLUE
Pixel values are blue intensities.

GL_ALPHA
Pixel values are alpha intensities.

GL_RGB
Pixel values are RGB colors.

GL_RGBA
Pixel values are RGBA colors.

GL_LUMINANCE
Pixel values are grayscale colors.

GL_ALPHA_LUMINANCE
Pixel values are alpha and grayscale
colors.



type

GLenum: The data type of each pixel value (see glDrawPixels).
pixels

GLvoid *: The pixel data.
Returns
None.
Known Bugs
The GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT parameters for glPixelStore are presently ignored.
Example
See the example in CH12\TEX1D.C on the source code CD-ROM.
See Also
glPixelMap, glPixelStore, glPixelTransfer,
glTexImage2D


glTexImage2D

Purpose
Defines a two-dimensional texture image.
Include File
<GL/gl.h>
Syntax
void glTexImage2D(GLenum target, GLint level, Glint components, GLsizei width, GLsizei height, GLint border GLenum format, GLenum type, const GLvoid *pixels);
Description
This function defines a two-dimensional texture
image. The image data is subject to modes defined with glPixelMap,
glPixelStore, and glPixelTransfer.


Parameters

target

GLenum: Must be GL_TEXTURE_2D.
level

GLint: The level of detail. Usually 0 unless mipmapping is used.
components

GLint: The number of color components, from 1 to 4.
width

GLsizei: The width of the texture image. This must be a power of 2 or follow the formula 2n + 2*border.
height

GLsizei: The height of the texture image. This must be a power of two or follow the formula 2m+2*border.
border

GLint: The width of the border. Must be 0, 1, or 2.
format

GLenum: The format of the pixel data. Valid
formats are as follows:





GL_COLOR_INDEX
Pixel values are color indices.

GL_RED
Pixel values are red intensities.

GL_GREEN
Pixel values are green intensities.

GL_BLUE
Pixel values are blue intensities.

GL_ALPHA
Pixel values are alpha intensities.

GL_RGB
Pixel values are RGB colors.

GL_RGBA
Pixel values are RGBA colors.

GL_LUMINANCE
Pixel values are grayscale colors.

GL_ALPHA_LUMINANCE
Pixel values are alpha and grayscale
colors.



type

GLenum: The data type of each pixel value (see glDrawPixels).
pixels

GLvoid *: The pixel data.
Returns
None.
Known Bugs
The GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT parameters for glPixelStore are presently ignored.
Example
See the example in CH12\TEX2D.C on the source code CD-ROM.
See Also
glPixelMap, glPixelStore, glPixelTransfer,
glTexImage1D


glTexParameter

Purpose
Sets texture image parameters.
Include File
<GL/gl.h>
Syntax
void glTexParameterf(GLenum target, GLenum pname, GLfloat param);

void glTexParameterfv(GLenum target, GLenum pname, GLfloat *param);

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

void glTexParameteriv(GLenum target, GLenum pname, GLint *param);
Description
This function sets filter and repetition
parameters for texture images.


Parameters

target

GLenum: Must be one of GL_TEXTURE_1D or GL_TEXTURE_2D.
pname

GLenum: The texturing parameter to set. Valid
names are:





Parameter
Description

GL_TEXTURE_MIN_FILTER
Specifies the texture image minification (reduction) method or filter.

GL_TEXTURE_MAX_FILTER
Specifies the texture image magnification (enlargement) method or filter.

GL_TEXTURE_WRAP_S
Specifies handling of texture S coordinates outside the range of 0.0 to 1.0.

GL_TEXTURE_WRAP_T
Specifies handling of texture T coordinates outside the range of 0.0 to 1.0.

GL_BORDER_COLOR
Specifies a border color for textures
without borders.



param

For GL_TEXTURE_MIN_FILTER, param is one of the following:
For GL_TEXTURE_MAX_FILTER, param is either GL_NEAREST or GL_LINEAR.GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T can be set to GL_REPEAT or GL_CLAMP. GL_REPEAT causes the texture image to be repeated over the polygon. GL_CLAMP uses the specified border pixels or a constant border color (see below) on areas that fall outside of the 0.0
1.0 texture coordinate range.
For GL_BORDER_COLOR, param is an RGBA color array that is used as a constant border color when a texture image has no border pixels defined.
Returns
None.
Example
See the example in CH12\TEXSCENE.C on the source code CD-ROM.
See Also
glTexCoord, glTexEnv, glTexGen, glTexImage1D,
glTexImage2D






Previous
Table of Contents
Next














 


Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.












Wyszukiwarka

Podobne podstrony:
424 427
429 16
03 (427)
429 431
INDEX (429)
429 02
429 07
15 (427)
index (429)
429 432

więcej podobnych podstron