Export (0) Print
Expand All

glTexEnvf function

Applies to: desktop apps only

The glTexEnvf function sets a texture environment parameter.

Syntax

void WINAPI glTexEnvf(
  GLenum target,
  GLenum pname,
  GLfloat param
);

Parameters

target

A texture environment. Must be GL_TEXTURE_ENV.

pname

The symbolic name of a single-valued texture environment parameter. Must be GL_TEXTURE_ENV_MODE.

param

A single symbolic constant, one of GL_MODULATE, GL_DECAL, GL_BLEND, or GL_REPLACE.

Return value

This function does not return a value.

Error codes

The following error codes can be retrieved by the glGetError function.

NameMeaning
GL_INVALID_ENUM

target or pname was not one of the accepted defined values, or when params should have had a defined constant value (based on the value of pname) and did not.

GL_INVALID_OPERATION

The function was called between a call to glBegin and the corresponding call to glEnd.

Remarks

A texture environment specifies how texture values are interpreted when a fragment is textured. The target parameter must be GL_TEXTURE_ENV. The pname parameter is GL_TEXTURE_ENV_MODE. Three texture functions are defined: GL_MODULATE, GL_DECAL, and GL_BLEND.

A texture function acts on the fragment to be textured using the texture image value that applies to the fragment (see glTexParameter) and produces an RGBA color for that fragment. The following table shows how the RGBA color is produced for each of the three texture functions that can be chosen. C is a triple of color values (RGB) and A is the associated alpha value. RGBA values extracted from a texture image are in the range [0, 1]. The subscript f refers to the incoming fragment, the subscript t to the texture image, the subscript c to the texture environment color, and subscript v indicates a value produced by the texture function.

A texture image can have up to four components per texture element (see glTexImage1D and glTexImage2D). In a one-component image, Lt indicates that single component. A two-component image uses Lt  and At . A three-component image has only a color value, Ct . A four-component image has both a color value Ct  and an alpha value At .

Number of componentsGL_MODULATEGL_DECALGL_BLEND
1Cv = Lt CfundefinedC v = (1 - Lt )Cf + Lt Cc
Av = AfAv = Af
2Cv = Lt CfundefinedCv = (1 - Lt )Cf + Lt Cc
Av = AfAv = Af
3Cv = Ct CfCv = Ctundefined
Av = Af Av = Af
4Cv = Ct CfCv = (1 - At )Cf + At Ctundefined
Av = At Af Av = Af

 

GL_TEXTURE_ENV_MODE defaults to GL_MODULATE.

The following function retrieves information related to glTexEnvf:

glTexGetEnvfv

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Gl.h

Library

Opengl32.lib

DLL

Opengl32.dll

See also

glBegin
glEnd
glTexImage1D
glTexImage2D
glTexParameter

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2015 Microsoft