4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>Sliced Textures</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7
7
<link rel="home" href="index.html" title="Cogl 2.0 Reference Manual">
8
8
<link rel="up" href="cogl-meta-textures.html" title="Meta Textures">
9
9
<link rel="prev" href="cogl-2.0-experimental-Sub-Textures.html" title="Sub Textures">
10
10
<link rel="next" href="cogl-2.0-experimental-X11-Texture-From-Pixmap.html" title="X11 Texture From Pixmap">
11
<meta name="generator" content="GTK-Doc V1.17.1 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
41
41
<a name="cogl-2.0-experimental-Sliced-Textures.synopsis"></a><h2>Synopsis</h2>
42
42
<pre class="synopsis"> <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced">CoglTexture2DSliced</a>;
43
43
<a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="returnvalue">CoglTexture2DSliced</span></a> * <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#cogl-texture-2d-sliced-new-with-size" title="cogl_texture_2d_sliced_new_with_size ()">cogl_texture_2d_sliced_new_with_size</a>
44
(<em class="parameter"><code><span class="type">CoglContext</span> *ctx</code></em>,
45
<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
46
<em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
44
(<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#CoglContext" title="CoglContext"><span class="type">CoglContext</span></a> *ctx</code></em>,
45
<em class="parameter"><code><span class="type">int</span> width</code></em>,
46
<em class="parameter"><code><span class="type">int</span> height</code></em>,
47
47
<em class="parameter"><code><span class="type">int</span> max_waste</code></em>,
48
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
49
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);
50
<span class="returnvalue">CoglBool</span> <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#cogl-is-texture-2d-sliced" title="cogl_is_texture_2d_sliced ()">cogl_is_texture_2d_sliced</a> (<em class="parameter"><code><span class="type">void</span> *object</code></em>);
48
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);
49
<a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#cogl-is-texture-2d-sliced" title="cogl_is_texture_2d_sliced ()">cogl_is_texture_2d_sliced</a> (<em class="parameter"><code><span class="type">void</span> *object</code></em>);
53
52
<div class="refsect1">
90
89
<div class="refsect2">
91
90
<a name="cogl-texture-2d-sliced-new-with-size"></a><h3>cogl_texture_2d_sliced_new_with_size ()</h3>
92
91
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="returnvalue">CoglTexture2DSliced</span></a> * cogl_texture_2d_sliced_new_with_size
93
(<em class="parameter"><code><span class="type">CoglContext</span> *ctx</code></em>,
94
<em class="parameter"><code>unsigned <span class="type">int</span> width</code></em>,
95
<em class="parameter"><code>unsigned <span class="type">int</span> height</code></em>,
92
(<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#CoglContext" title="CoglContext"><span class="type">CoglContext</span></a> *ctx</code></em>,
93
<em class="parameter"><code><span class="type">int</span> width</code></em>,
94
<em class="parameter"><code><span class="type">int</span> height</code></em>,
96
95
<em class="parameter"><code><span class="type">int</span> max_waste</code></em>,
97
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>,
98
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
96
<em class="parameter"><code><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglPixelFormat" title="enum CoglPixelFormat"><span class="type">CoglPixelFormat</span></a> internal_format</code></em>);</pre>
100
98
Creates a <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="type">CoglTexture2DSliced</span></a> that may internally be comprised of
101
1 or more <a class="link" href="cogl-2.0-experimental-2D-textures.html#CoglTexture2D" title="CoglTexture2D"><span class="type">CoglTexture2D</span></a> textures with power-of-two sizes.
99
1 or more <a class="link" href="cogl-2.0-experimental-2D-textures.html#CoglTexture2D" title="CoglTexture2D"><span class="type">CoglTexture2D</span></a> textures depending on GPU limitations.
100
For example if the GPU only supports power-of-two sized textures
101
then a sliced texture will turn a non-power-of-two size into a
102
combination of smaller power-of-two sized textures. If the
103
requested texture size is larger than is supported by the hardware
104
then the texture will be sliced into smaller textures that can be
105
accessed by the hardware.
102
108
<em class="parameter"><code>max_waste</code></em> is used as a threshold for recursively slicing the
103
right-most or bottom-most slices into smaller power-of-two sizes
104
until the wasted padding at the bottom and right of the
105
power-of-two textures is less than specified.
107
<div class="variablelist"><table border="0">
109
right-most or bottom-most slices into smaller sizes until the
110
wasted padding at the bottom and right of the textures is less than
111
specified. A negative <em class="parameter"><code>max_waste</code></em> will disable slicing.
114
The storage for the texture is not allocated before this function
115
returns. You can call <code class="function">cogl_texture_allocate()</code> to explicitly
116
allocate the underlying storage or let Cogl automatically allocate
121
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
122
<h3 class="title">Note</h3>It's possible for the allocation of a sliced texture to fail
123
later due to impossible slicing constraints if a negative
124
<em class="parameter"><code>max_waste</code></em> value is given. If the given virtual texture size size
125
is larger than is supported by the hardware but slicing is disabled
126
the texture size would be too large to handle.</div>
129
<div class="variablelist"><table border="0" class="variablelist">
108
131
<col align="left" valign="top">
111
136
<td><p><span class="term"><em class="parameter"><code>ctx</code></em> :</span></p></td>
112
<td>A <span class="type">CoglContext</span>
137
<td>A <a class="link" href="cogl-2.0-experimental-The-Top-Level-Context.html#CoglContext" title="CoglContext"><span class="type">CoglContext</span></a>
124
149
<td><p><span class="term"><em class="parameter"><code>max_waste</code></em> :</span></p></td>
125
150
<td>The threshold of how wide a strip of wasted texels
126
are allowed in the non-power-of-two textures before
127
they must be sliced to reduce the amount of waste.</td>
151
are allowed along the right and bottom textures before
152
they must be sliced to reduce the amount of waste. A
153
negative can be passed to disable slicing.</td>
130
156
<td><p><span class="term"><em class="parameter"><code>internal_format</code></em> :</span></p></td>
131
157
<td>The format of the texture</td>
134
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
135
<td>A <span class="type">GError</span> for exceptions.</td>
138
160
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
139
<td>A newly allocated <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="type">CoglTexture2DSliced</span></a> or if there was
140
an error allocating any of the internal slices <code class="literal">NULL</code> is
141
returned and <em class="parameter"><code>error</code></em> is updated.</td>
161
<td>A new <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="type">CoglTexture2DSliced</span></a> object with no storage
149
170
<div class="refsect2">
150
171
<a name="cogl-is-texture-2d-sliced"></a><h3>cogl_is_texture_2d_sliced ()</h3>
151
<pre class="programlisting"><span class="returnvalue">CoglBool</span> cogl_is_texture_2d_sliced (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
172
<pre class="programlisting"><a class="link" href="cogl-2.0-experimental-Common-Types.html#CoglBool" title="CoglBool"><span class="returnvalue">CoglBool</span></a> cogl_is_texture_2d_sliced (<em class="parameter"><code><span class="type">void</span> *object</code></em>);</pre>
153
Gets whether the given object references a <span class="type">CoglTexture2dSliced</span>.
174
Gets whether the given object references a <a class="link" href="cogl-2.0-experimental-Sliced-Textures.html#CoglTexture2DSliced" title="CoglTexture2DSliced"><span class="type">CoglTexture2DSliced</span></a>.
155
<div class="variablelist"><table border="0">
176
<div class="variablelist"><table border="0" class="variablelist">
156
178
<col align="left" valign="top">
159
183
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>