1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/manpage.css" type="text/css" />
7<title>glViewport</title>
8  </head>
9  <body>
10<h1><CODE>glViewport</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14GL_APICALL void GL_APIENTRY glViewport(
15     GLint x,
16     GLint y,
17     GLsizei width,
18     GLsizei height
19);
20</pre>
21    </div>
22<h2>Parameters</h2>
23    <div class="section">
24      <table class="arguments">
25        <thead>
26          <tr>
27            <td width="15" />
28<th>Name</th>
29<td>Description</td>
30          </tr>
31        </thead>
32        <tr>
33<td>in</td>
34<th>x</th>
35<td>X coordinate of the viewport's lower-left corner</td>
36        </tr>
37        <tr>
38<td>in</td>
39<th>y</th>
40<td>Y coordinate of the viewport's lower-left corner</td>
41        </tr>
42        <tr>
43<td>in</td>
44<th>width</th>
45<td>Viewport width</td>
46        </tr>
47        <tr>
48<td>in</td>
49<th>height</th>
50<td>Viewport height</td>
51        </tr> </table>
52    </div>
53<h2>Return Values</h2>
54<div class="section">No values are returned. </div>
55<h2>Description</h2>
56    <div class="section">
57<p>Configures the viewport.</p><P>
58Set <span class="argument">x</span> to the x coordinate of the viewport's lower-left corner. Set <span class="argument">y</span> to the y coordinate of the viewport's lower-left corner. Unlike in the OpenGL ES 2.0 standard, <span class="argument">x</span> and <span class="argument">y</span> must be no less than 0. The values of <span class="argument">x</span> and <span class="argument">y</span> affect rendering performance. Performance degrades when <span class="argument">x</span> and <span class="argument">y</span> are not multiples of 4. Specifically, performance drops to approximately one-half for any multiple of 2 that is not a multiple of 4, and drops to approximately one-third for odd numbers. We recommend that you adjust for this using the frustum for perspective projection transformations and that you exclude unnecessary areas via scissoring in order to set <span class="argument">x</span> and <span class="argument">y</span> to multiples of 4 and thus avoid performance degradation.
59            </P><P>
60To enable the early depth test, you must set the viewport offset (argument x,y) to <CODE>0</CODE>. The depth test will not be performed correctly if a value other than <CODE>0</CODE> is set. If you need to perform a process equivalent to using the offset, you can offset the viewport by using a model view transform and then delete the unneeded area using scissoring instead.
61            </P><P>
62Set <span class="argument">width</span> to the viewport width.
63            </P><P>
64Set <span class="argument">height</span> to the viewport height.
65            </P><P>
66Specify a viewport size of 1023 x 1016 or less. If a larger size is specified, polygons may not be rendered properly or the GPU may hang. This restriction is due to a hardware bug and cannot be improved.
67            </P><P>
68This function generates the following errors.
69<TABLE><TR><TH>GL_INVALID_VALUE</TH><TD>The <span class="argument">x</span>, <span class="argument">y</span>, <span class="argument">width</span>, or <span class="argument">height</span> argument was set to a negative value.</TD></TR><TR><TH>GL_INVALID_OPERATION</TH><TD>This function was called without any command-list objects bound.</TD></TR></TABLE><!-- source                      x、y、width、heightに負の値を指定した場合エラーGL_INVALID_VALUEを生成します。 コマンドリストオブジェクトをバインドしていない状態で呼び出すとエラーGL_INVALID_OPERATIONを生成します。                 --></P></div>
70<h2>Revision History</h2>
71    <div class="section">
72      <dl class="history">
73        <dt>2011/02/07</dt>
74<dd>Added information about viewport limitations and size restrictions when an early depth test is enabled. <br />
75        </dd>
76        <dt>2010/01/07</dt>
77<dd>Initial version.<br />
78        </dd>
79      </dl>
80    </div>
81  <hr><p>CONFIDENTIAL</p></body>
82</html>