"Initial commit to Gerrit"
[profile/ivi/cogl.git] / doc / reference / cogl-2.0-experimental / html / cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Rectangle textures (non-normalized coordinates)</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="Cogl 2.0 Reference Manual">
8 <link rel="up" href="cogl-textures.html" title="Textures">
9 <link rel="prev" href="cogl-2.0-experimental-3D-textures.html" title="3D textures">
10 <link rel="next" href="cogl-meta-textures.html" title="Meta Textures">
11 <meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="cogl-2.0-experimental-3D-textures.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="cogl-textures.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">Cogl 2.0 Reference Manual</th>
21 <td><a accesskey="n" href="cogl-meta-textures.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates)"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).top_of_page"></a>Rectangle textures (non-normalized coordinates)</span></h2>
34 <p>Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle
35                     textures for use with non-normalized coordinates.</p>
36 </td>
37 <td valign="top" align="right"></td>
38 </tr></table></div>
39 <div class="refsynopsisdiv">
40 <a name="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).synopsis"></a><h2>Synopsis</h2>
41 <pre class="synopsis">                    <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#CoglTextureRectangle" title="CoglTextureRectangle">CoglTextureRectangle</a>;
42 #define             <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#cogl-texture-rectangle-new-with-size" title="cogl_texture_rectangle_new_with_size">cogl_texture_rectangle_new_with_size</a>
43 #define             <a class="link" href="cogl-2.0-experimental-2D-textures.html#cogl-is-texture-rectangle" title="cogl_is_texture_rectangle">cogl_is_texture_rectangle</a>
44 </pre>
45 </div>
46 <div class="refsect1">
47 <a name="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).description"></a><h2>Description</h2>
48 <p>
49 These functions allow low-level "rectangle" textures to be allocated.
50 These textures are never constrained to power-of-two sizes but they
51 also don't support having a mipmap and can only be wrapped with
52 <code class="literal">COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE</code>.
53 </p>
54 <p>
55 The most notable difference between rectangle textures and 2D
56 textures is that rectangle textures are sampled using un-normalized
57 texture coordinates, so instead of using coordinates (0,0) and
58 (1,1) to map to the top-left and bottom right corners of the
59 texture you would instead use (0,0) and (width,height).
60 </p>
61 <p>
62 The use of non-normalized coordinates can be particularly
63 convenient when writing glsl shaders that use a texture as a lookup
64 table since you don't need to upload separate uniforms to map
65 normalized coordinates to texels.
66 </p>
67 <p>
68 If you want to sample from a rectangle texture from GLSL you should
69 use the sampler2DRect sampler type.
70 </p>
71 <p>
72 Applications wanting to use <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#CoglTextureRectangle" title="CoglTextureRectangle"><span class="type">CoglTextureRectangle</span></a> should first check
73 for the <a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#COGL-FEATURE-ID-TEXTURE-RECTANGLE:CAPS"><code class="literal">COGL_FEATURE_ID_TEXTURE_RECTANGLE</code></a> feature using
74 <a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#cogl-has-feature" title="cogl_has_feature ()"><code class="function">cogl_has_feature()</code></a>.
75 </p>
76 </div>
77 <div class="refsect1">
78 <a name="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).details"></a><h2>Details</h2>
79 <div class="refsect2">
80 <a name="CoglTextureRectangle"></a><h3>CoglTextureRectangle</h3>
81 <pre class="programlisting">typedef struct _CoglTextureRectangle CoglTextureRectangle;</pre>
82 </div>
83 <hr>
84 <div class="refsect2">
85 <a name="cogl-texture-rectangle-new-with-size"></a><h3>cogl_texture_rectangle_new_with_size</h3>
86 <pre class="programlisting">#define             cogl_texture_rectangle_new_with_size</pre>
87 <p>
88 Allocates a new <span class="type">CoglRectangle</span> texture with a given <em class="parameter"><code>width</code></em>, <em class="parameter"><code>height</code></em>
89 and <em class="parameter"><code>internal_format</code></em>. This texture is a low-level texture that
90 the GPU can sample from directly unlike high-level textures such
91 as <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="type">CoglTexture2DSliced</span></a> and <span class="type">CoglAtlasTexture</span>.
92 </p>
93 <p>
94 </p>
95 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
96 <h3 class="title">Note</h3>If you want to sample from a rectangle texture from GLSL you
97 should use the sampler2DRect sampler type.</div>
98 <p>
99 </p>
100 <p>
101 </p>
102 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
103 <h3 class="title">Note</h3>Applications wanting to use <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#CoglTextureRectangle" title="CoglTextureRectangle"><span class="type">CoglTextureRectangle</span></a> should
104 first check for the <a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#COGL-FEATURE-ID-TEXTURE-RECTANGLE:CAPS"><code class="literal">COGL_FEATURE_ID_TEXTURE_RECTANGLE</code></a> feature
105 using <a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#cogl-has-feature" title="cogl_has_feature ()"><code class="function">cogl_has_feature()</code></a>.</div>
106 <p>
107 </p>
108 <div class="variablelist"><table border="0">
109 <col align="left" valign="top">
110 <tbody>
111 <tr>
112 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
113 <td>A <span class="type">CoglContext</span> pointer</td>
114 </tr>
115 <tr>
116 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
117 <td>The texture width to allocate</td>
118 </tr>
119 <tr>
120 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
121 <td>The texture height to allocate</td>
122 </tr>
123 <tr>
124 <td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
125 <td>The desired internal texture format</td>
126 </tr>
127 <tr>
128 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
129 <td>An optional GError pointer for reporting exceptions</td>
130 </tr>
131 <tr>
132 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
133 <td>A pointer to a newly allocated <span class="type">CoglRectangle</span> texture
134 or if the size was too large or there wasn't enough memory
135 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned and <em class="parameter"><code>error</code></em> set.</td>
136 </tr>
137 </tbody>
138 </table></div>
139 <p class="since">Since 1.10</p>
140 <p class="stability">Stability Level: Unstable</p>
141 </div>
142 <hr>
143 <div class="refsect2">
144 <a name="cogl-is-texture-rectangle"></a><h3>cogl_is_texture_rectangle</h3>
145 <pre class="programlisting">#define cogl_is_texture_rectangle cogl_is_texture_rectangle_EXP
146 </pre>
147 <p>
148 Gets whether the given object references an existing
149 <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#CoglTextureRectangle" title="CoglTextureRectangle"><span class="type">CoglTextureRectangle</span></a> object.
150 </p>
151 <div class="variablelist"><table border="0">
152 <col align="left" valign="top">
153 <tbody>
154 <tr>
155 <td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
156 <td>A <a class="link" href="cogl-2.0-experimental-The-Object-Interface.html#CoglObject" title="CoglObject"><span class="type">CoglObject</span></a>
157 </td>
158 </tr>
159 <tr>
160 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
161 <td>
162 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the object references a
163 <a class="link" href="cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html#CoglTextureRectangle" title="CoglTextureRectangle"><span class="type">CoglTextureRectangle</span></a>, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
164 </tr>
165 </tbody>
166 </table></div>
167 </div>
168 </div>
169 </div>
170 <div class="footer">
171 <hr>
172           Generated by GTK-Doc V1.18.1</div>
173 </body>
174 </html>