Name

    SGIX_texture_coordinate_clamp

Name Strings

    GL_SGIX_texture_coordinate_clamp

Version

    $Date: 2005/06/02 18:12:32 $ $Revision: 1.1 $

Number

    235

Dependencies

    EXT_texture3D affects the definition of this extension

Overview

    This extension provides a mechanism to specify the maximum texture coordinate
    clamping values. Standard OpenGL always clamps the upper bound to 1.0 when
    the wrap mode is set to CLAMP. This mechanism can be used to  guarantee 
    that non-existent texel data will not be accessed when the texture image has 
    dimensions that are not a power of 2.

Issues

    *	What is the effect of wrap modes?
        -- This mode is only effective when the wrap mode is set to clamp
    
    *   Are border modes supported?
	-- Border modes are independent of texture coordinate clamping. Borders
	   live outside the 0.0 to 1.0 texture coordinate range. However, a
	   particular filtering method may access texels beyond the clamped
	   values. It is the users responsibility to ensure that adequate
	   texels are defined or to set the border mode to CLAMP_TO_EDGE_SGIS
	   to prevent access outside this range. The texel value used past
	   the clamped edge is otherwise undefined.

    *   Can defining the clamp values before the texture is defined be used to
	allocate less texture memory for the texture?
	-- Maybe. This is an implementation issue that the hardware may or may
	   not take advantage of. However, the clamp value may be increased
	   later to download data into a larger region.
    
    *   Does subloading a texture image to a region outside the clamped area 
	preserve the contents in the outside area?
	-- Yes. Downloading texels outside the clamped region should make the 
	   data be preserved. 

    *   Only the upper limit of the clamp region may be specified. Might 
	other more generic needs be met by allowing both min and max to be 
	defined? For example, you could define a large texture of smaller 
	"tiles" that could be selected for various surfaces.
	-- Intel has a pending spec to do texture clipping. This is somewhat
	   similar to what is mentioned above. This extension defines a 
	   mechanism to clamp and also provides a hint to the size of the
	   texture to be allocated.

    *   Since wrapped textures aren't supported, the only real functionality
	this appears to add is when the geometry (s,t,r) ranges are not 
	aligned with or matching the (x,y,z) ranges. For example, mapping 
	video to a sphere.  Is this correct? Otherwise, one could just define
	a rectangle with the right (s,t) ranges.
	-- Yes. However that does not provide OpenGL any hint as to the size
	   of texture that actually needs to be allocated.

New Procedures and Functions

    None

New Tokens

    Accepted by the <pname> parameter of TexParameteri, TexParameterf,
    TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv:

	TEXTURE_MAX_CLAMP_S_SGIX	0x8369
	TEXTURE_MAX_CLAMP_T_SGIX	0x836A
	TEXTURE_MAX_CLAMP_R_SGIX	0x836B


Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation)

    None

Additions to Chapter 3 of the 1.1 Specification (Rasterization)

    GL Specification Table 3.9 is updated as follows:

	Name				Type	    Legal Values
	----				----	    ------------
	TEXTURE_WRAP_S			integer	    CLAMP, REPEAT
	TEXTURE_WRAP_T			integer	    CLAMP, REPEAT
	TEXTURE_WRAP_R_EXT		integer	    CLAMP, REPEAT
	TEXTURE_MIN_FILTER		integer	    NEAREST, LINEAR,
						    NEAREST_MIPMAP_NEAREST,
						    NEAREST_MIPMAP_LINEAR,
						    LINEAR_MIPMAP_NEAREST,
						    LINEAR_MIPMAP_LINEAR,
						    FILTER4_SGIS,
						    LINEAR_CLIPMAP_LINEAR_SGIX,
	TEXTURE_MAG_FILTER		integer	    NEAREST, LINEAR,
						    FILTER4_SGIS,
						    LINEAR_DETAIL_SGIS,
						    LINEAR_DETAIL_ALPHA_SGIS,
						    LINEAR_DETAIL_COLOR_SGIS,
						    LINEAR_SHARPEN_SGIS,
						    LINEAR_SHARPEN_ALPHA_SGIS,
						    LINEAR_SHARPEN_COLOR_SGIS
	TEXTURE_BORDER_COLOR		4 floats    any 4 values in [0,1]
	DETAIL_TEXTURE_LEVEL_SGIS	integer	    any non-negative integer
	DETAIL_TEXTURE_MODE_SGIS	integer	    ADD, MODULATE
	TEXTURE_MIN_LOD_SGIS		float	    any value
	TEXTURE_MAX_LOD_SGIS		float	    any value
	TEXTURE_BASE_LEVEL_SGIS		integer	    any non-negative integer
	TEXTURE_MAX_LEVEL_SGIS		integer	    any non-negative integer
        GENERATE_MIPMAP_SGIS            boolean     TRUE or FALSE
        TEXTURE_CLIPMAP_FRAME_SGIX      float       any non-negative value
        TEXTURE_CLIPMAP_CENTER_SGIX     2 integers  any 2 non-negative integers
        TEXTURE_CLIPMAP_OFFSET_SGIX     2 integers  any 2 non-negative integers
        TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 3 integers  any 3 non-negative integer
	TEXTURE_LOD_BIAS_S_SGIX		float	    any value
	TEXTURE_LOD_BIAS_T_SGIX		float	    any value
	TEXTURE_LOD_BIAS_R_SGIX		float	    any value
        TEXTURE_MIPMAP_ANISOTROPY	int	    any value >= 1
        TEXTURE_MAX_CLAMP_S_SGIX	float	    any value in [0.0, 1.0]
        TEXTURE_MAX_CLAMP_T_SGIX	float	    any value in [0.0, 1.0]
        TEXTURE_MAX_CLAMP_R_SGIX	float	    any value in [0.0, 1.0]

	Table 3.9: Texture parameters and their values.

    Texture Minification
    --------------------
    Let s(x,y) be the function that associates an s texture coordinate with each 
    set of window coordinates (x,y) that lie within a primitive; define t(x, y)
    analogously. Let

                / 2^n.TEXTURE_MAX_CLAMP_S_SGIX  if (TEXTURE_WRAP_S == CLAMP and
      u(x,y) = (                                    s(x,y) > TEXTURE_MAX_CLAMP_S_SGIX)
	        \ 2^n.s(x,y),		 	otherwise


                / 2^n.TEXTURE_MAX_CLAMP_T_SGIX  if (TEXTURE_WRAP_T == CLAMP and
      v(x,y) = (                                    t(x,y) > TEXTURE_MAX_CLAMP_T_SGIX)
	        \ 2^n.t(x,y),		 	otherwise

    and

                / 2^n.TEXTURE_MAX_CLAMP_R_SGIX  if (TEXTURE_WRAP_R == CLAMP and
      w(x,y) = (                                    r(x,y) > TEXTURE_MAX_CLAMP_R_SGIX)
	        \ 2^n.r(x,y),		 	otherwise

    (For a one-dimensional texture, define v(x,y) = 0, w(x,y) = 0)


    Query support
    -------------
    In the initial state the values assigned to TEXTURE_MAX_CLAMP_S_SGIX, 
    TEXTURE_MAX_CLAMP_T_SGIX and TEXTURE_MAX_CLAMP_R_SGIX are 1.0, 1.0, 1.0
    respectively.


Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations
and the Frame Buffer)

    None

Additions to Chapter 5 of the 1.1 Specification (Special Functions)

    None

Additions to Chapter 6 of the 1.1 Specification (State and State Requests)

    None

Additions to the GLX Specification

    None

Dependencies on EXT_texture3D

    If EXT_texture3D is not implemented, then the reference to clamping of 3D
    texture coordinates in this file are invalid, and references to 
    TEXTURE_MAX_CLAMP_R_SGIX should be ignored.

Errors

    None

New State

								Initial
    Get Value			   Get Command	    Type	Value	 Attrib
    ---------			   -----------	    ----	-------	 ------
    TEXTURE_MAX_CLAMP_S_SGIX      GetTexParameteriv R          1.0  	texture
    TEXTURE_MAX_CLAMP_T_SGIX      GetTexParameteriv R          1.0  	texture
    TEXTURE_MAX_CLAMP_R_SGIX      GetTexParameteriv R          1.0  	texture

New Implementation Dependent State

    None
