2003-2004 Silicon Graphics, Inc.
glDrawTex 3G
glDrawTex glDrawTexsOES glDrawTexiOES glDrawTexfOES glDrawTexxOES glDrawTexsvOES glDrawTexivOES glDrawTexfvOES glDrawTexxvOES draws a texture rectangle to the screen

## C Specification

void `glDrawTexsOES` GLshort x GLshort y GLshort z GLshort width GLshort height void `glDrawTexiOES` GLint x GLint y GLint z GLint width GLint height void `glDrawTexfOES` GLfloat x GLfloat y GLfloat z GLfloat width GLfloat height void `glDrawTexxOES` GLfixed x GLfixed y GLfixed z GLfixed width GLfixed height

## Parameters

x, y, z

  Specify the position of the affected screen rectangle.

width, height

  Specifies the width and height of the affected screen rectangle in pixels.

## C Specification

void `glDrawTexsvOES` GLshort* coords void `glDrawTexivOES` GLint* coords void `glDrawTexfvOES` GLfloat* coords void `glDrawTexxvOES` GLfixed* coords

## Parameters

coords

  Specifies a pointer to the coords for the affected screen rectangle.

## Description

`glDrawTexOES` draws a texture rectangle to the screen.

x and y are given directly in window (viewport) coordinates.

z is mapped to window depth Zw as follows:

If z<=0 then Zw=n

If z>=1 then Zw=f

Otherwise Zw= n+z * (f-n)

where n and f are the near and far values of `GL_DEPTH_RANGE` respectively.

width and height specify the width and height of the affected screen rectangle in pixels. These values may be positive or negative; however if either of these are negative, nothing is drawn.

Calling one of the DrawTex functions generates a fragment for each pixel that overlaps the screen rectangle bounded by (x, y) and (x + width), (y + height). For each generated fragment, the depth is given by Zw as defined above, and the color by the current color.

Texture coordinates for each texture unit are computed as follows:

Let X and Y be the screen x and y coordinates of each sample point associated with the fragment. Let Wt and Ht be the width and height in texels of the texture currently bound to the texture unit. (If the texture is a mipmap, let Wt and Ht be the dimensions of the level specified by `GL_TEXTURE_BASE_LEVEL`). Let Ucr, Vcr, Wcr and Hcr be (respectively) the four integers that make up the texture crop rectangle parameter for the currently bound texture. The fragment texture coordinates (s, t, r, q) are given by:

s= (Ucr+ (X-x)* (Wcr/width)) /Wt

t= (Vcr+ (Y-y)* (Hcr/height)) /Ht

r=0

q=1

## Notes

In the specific case where X, Y, x and y are all integers, Wcr/width and Hcr/height are both equal to one, the base level is used for the texture read, and fragments are sampled at pixel centers, implementations are required to ensure that the resulting u, v texture indices are also integers. This results in a one-to-one mapping of texels to fragments.

Note that Wcr and/or Hcr can be negative. The formulas given above for s and t still apply in this case. The result is that if Wcr is negative, the source rectangle for `glDrawTexOES` operations lies to the left of the reference point (Ucr, Vcr) rather than to the right of it, and appears right-to-left reversed on the screen after a call to DrawTex. Similarly, if Hcr is negative, the source rectangle lies below the reference point (Ucr, Vcr) rather than above it, and appears upside-down on the screen.

Note also that s, t, r, and q are computed for each fragment as part of `glDrawTexOES` rendering. This implies that the texture matrix is ignored and has no effect on the rendered result.

`glDrawTexOES` is available only if the `GL_OES_draw_texture` extension is supported by your implementation.

## See Also

glGetTexParameter, glTexParameter,

## Copyright

Copyright 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.