21.06.2014 Views

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.17. COORDINATE TRANSFORMATIONS 193<br />

• the input primitive type of the current geometry shader is TRIANGLES_-<br />

ADJACENCY and mode is not TRIANGLES_ADJACENCY or TRIANGLE_-<br />

STRIP_ADJACENCY.<br />

2.17 Coordinate Transformations<br />

Clip coordinates for a vertex result from fixed-function transformation of the vertex<br />

coordinates, or from vertex or, if active, geometry shader execution, which yields<br />

a vertex coordinate gl_Position. Perspective division on clip coordinates yields<br />

normalized device coordinates, followed by a viewport transformation to convert<br />

these coordinates into window coordinates. ⎛ ⎞<br />

x c<br />

If a vertex in clip coordinates is given by ⎜y c<br />

⎟<br />

⎝ z c<br />

⎠<br />

w c<br />

then the vertex’s normalized device coordinates are<br />

⎛ ⎛<br />

⎞<br />

x d<br />

⎝y d<br />

⎠ = ⎝<br />

z d<br />

2.17.1 Controlling the Viewport<br />

x c<br />

⎞<br />

w c<br />

y c<br />

w c<br />

z c<br />

w c<br />

The viewport transformation is determined by the selected viewport’s width and<br />

height in pixels, p x and p y , respectively,<br />

⎛ ⎞<br />

and its center (o x , o y ) (also in pixels).<br />

x w<br />

The vertex’s window coordinates, ⎝y w<br />

⎠ , are given by<br />

z w<br />

⎠ .<br />

⎛ ⎞ ⎛ p<br />

x x2<br />

⎞<br />

w x d + o x<br />

⎝y w<br />

⎠ = ⎝<br />

p y<br />

2 y d + o y<br />

⎠ .<br />

f−n<br />

z w 2 z d + n+f<br />

2<br />

Multiple viewports are available and are numbered zero through the value of<br />

MAX_VIEWPORTS minus one. If a geometry shader is active and writes to gl_-<br />

ViewportIndex, the viewport transformation uses the viewport corresponding<br />

to the value assigned to gl_ViewportIndex taken from an implementationdependent<br />

primitive vertex. If the value of the viewport index is outside the range<br />

zero to the value of MAX_VIEWPORTS minus one, the results of the viewport transformation<br />

are undefined. If no geometry shader is active, or if the active geometry<br />

<strong>OpenGL</strong> <strong>4.2</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>April</strong> <strong>27</strong>, <strong>2012</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!