aboutsummaryrefslogtreecommitdiffstats
path: root/dev/MinGfx/docs/html/classmingfx_1_1_texture2_d.html
blob: 66749b645e6ea228613b70af3d31c3ed33238fe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<title>MinGfx Toolkit: mingfx::Texture2D Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">MinGfx Toolkit
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacemingfx.html">mingfx</a></li><li class="navelem"><a class="el" href="classmingfx_1_1_texture2_d.html">Texture2D</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classmingfx_1_1_texture2_d-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">mingfx::Texture2D Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A wrapper around a 2D texture that supports loading images from files or setting texture color data directly. </p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="classmingfx_1_1_texture2_d.html#aa15b86ec3b7312842c220b081c39980d">Texture2D</a> tex1;</div>
<div class="line"><a class="code" href="classmingfx_1_1_texture2_d.html#aa15b86ec3b7312842c220b081c39980d">Texture2D</a> tex2(GL_CLAMP_TO_EDGE);</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> MyGraphicsApp::InitOpenGL() {</div>
<div class="line">    std::vector&lt;std::string&gt; search_path;</div>
<div class="line">    search_path.push_back(<span class="stringliteral">&quot;.&quot;</span>);</div>
<div class="line">    search_path.push_back(<span class="stringliteral">&quot;./data&quot;</span>);</div>
<div class="line">    search_path.push_back(<span class="stringliteral">&quot;./shaders&quot;</span>);</div>
<div class="line">    tex1.InitFromFile(<a class="code" href="classmingfx_1_1_platform.html#a32a392f4bac832c95fabc2d10bd03ad1">Platform::FindFile</a>(<span class="stringliteral">&quot;earth-2k.png&quot;</span>, search_path));</div>
<div class="line">    tex2.InitFromFile(<a class="code" href="classmingfx_1_1_platform.html#a32a392f4bac832c95fabc2d10bd03ad1">Platform::FindFile</a>(<span class="stringliteral">&quot;toon-ramp.png&quot;</span>, search_path));</div>
<div class="line">}</div>
<div class="ttc" id="aclassmingfx_1_1_platform_html_a32a392f4bac832c95fabc2d10bd03ad1"><div class="ttname"><a href="classmingfx_1_1_platform.html#a32a392f4bac832c95fabc2d10bd03ad1">mingfx::Platform::FindFile</a></div><div class="ttdeci">static std::string FindFile(const std::string &amp;basename, const std::vector&lt; std::string &gt; &amp;searchpath)</div></div>
<div class="ttc" id="aclassmingfx_1_1_texture2_d_html_aa15b86ec3b7312842c220b081c39980d"><div class="ttname"><a href="classmingfx_1_1_texture2_d.html#aa15b86ec3b7312842c220b081c39980d">mingfx::Texture2D::Texture2D</a></div><div class="ttdeci">Texture2D(GLenum wrapMode=GL_REPEAT, GLenum filterMode=GL_LINEAR)</div><div class="ttdoc">Creates an empty texture. Optional parameters can be provided to set the texture wrap mode and filter...</div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="texture2d_8h_source.html#l00042">42</a> of file <a class="el" href="texture2d_8h_source.html">texture2d.h</a>.</p>
</div>
<p><code>#include &lt;<a class="el" href="texture2d_8h_source.html">texture2d.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa15b86ec3b7312842c220b081c39980d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#aa15b86ec3b7312842c220b081c39980d">Texture2D</a> (GLenum wrapMode=GL_REPEAT, GLenum filterMode=GL_LINEAR)</td></tr>
<tr class="memdesc:aa15b86ec3b7312842c220b081c39980d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an empty texture. Optional parameters can be provided to set the texture wrap mode and filter mode.  <a href="classmingfx_1_1_texture2_d.html#aa15b86ec3b7312842c220b081c39980d">More...</a><br /></td></tr>
<tr class="separator:aa15b86ec3b7312842c220b081c39980d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab734dbbcf6211507ab65d5bb94a4ef9"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#aab734dbbcf6211507ab65d5bb94a4ef9">~Texture2D</a> ()</td></tr>
<tr class="separator:aab734dbbcf6211507ab65d5bb94a4ef9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8eded044ccdf9bd3e1e5bcfe74526bdc"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a8eded044ccdf9bd3e1e5bcfe74526bdc">InitFromFile</a> (const std::string &amp;filename)</td></tr>
<tr class="memdesc:a8eded044ccdf9bd3e1e5bcfe74526bdc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. Internally, this uses the stbi library to load images. It supports png, jpg, bmp, and other file formats.  <a href="classmingfx_1_1_texture2_d.html#a8eded044ccdf9bd3e1e5bcfe74526bdc">More...</a><br /></td></tr>
<tr class="separator:a8eded044ccdf9bd3e1e5bcfe74526bdc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba57b01065096fe9f6483e8f68622944"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#aba57b01065096fe9f6483e8f68622944">InitFromBytes</a> (int <a class="el" href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869">width</a>, int <a class="el" href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88">height</a>, const unsigned char *data)</td></tr>
<tr class="memdesc:aba57b01065096fe9f6483e8f68622944"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. With this version of Init, you may pass in your own pointer to color data. The data argument must point to an array of 4-channel color data stored as unsigned chars in RGBA format. You are responsible for managing the memory for this array. If you will never call <a class="el" href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b" title="Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom ri...">Pixel()</a>, then it is safe to free data as soon as this function returns. Otherwise, you need to make sure data does not change in memory until you destroy the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a> object.  <a href="classmingfx_1_1_texture2_d.html#aba57b01065096fe9f6483e8f68622944">More...</a><br /></td></tr>
<tr class="separator:aba57b01065096fe9f6483e8f68622944"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aee8a0aad1795680cb840ffcf544ed7b8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#aee8a0aad1795680cb840ffcf544ed7b8">InitFromFloats</a> (int <a class="el" href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869">width</a>, int <a class="el" href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88">height</a>, const float *data)</td></tr>
<tr class="memdesc:aee8a0aad1795680cb840ffcf544ed7b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. With this version of Init, you may pass in your own pointer to color data. The data argument must point to an array of 4-channel color data stored as floats in RGBA format. You are responsible for managing the memory for this array. If you will never call <a class="el" href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b" title="Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom ri...">Pixel()</a>, then it is safe to free data as soon as this function returns. Otherwise, you need to make sure data does not change in memory until you destroy the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a> object.  <a href="classmingfx_1_1_texture2_d.html#aee8a0aad1795680cb840ffcf544ed7b8">More...</a><br /></td></tr>
<tr class="separator:aee8a0aad1795680cb840ffcf544ed7b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0783ad70829ef353aa92344d320b107c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a0783ad70829ef353aa92344d320b107c">UpdateFromBytes</a> (const unsigned char *data)</td></tr>
<tr class="memdesc:a0783ad70829ef353aa92344d320b107c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function may be called to re-read the texture data from an array formated the same as in InitFromBytes. The width and height of the texture must remain the same.  <a href="classmingfx_1_1_texture2_d.html#a0783ad70829ef353aa92344d320b107c">More...</a><br /></td></tr>
<tr class="separator:a0783ad70829ef353aa92344d320b107c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad7640f0cbda6398a6bb80202b80dd693"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#ad7640f0cbda6398a6bb80202b80dd693">UpdateFromFloats</a> (const float *data)</td></tr>
<tr class="memdesc:ad7640f0cbda6398a6bb80202b80dd693"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function may be called to re-read the texture data from an array formated the same as in InitFromFloats. The width and height of the texture must remain the same.  <a href="classmingfx_1_1_texture2_d.html#ad7640f0cbda6398a6bb80202b80dd693">More...</a><br /></td></tr>
<tr class="separator:ad7640f0cbda6398a6bb80202b80dd693"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15d5c319cf7e012e703668f4d4e7be87"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a15d5c319cf7e012e703668f4d4e7be87">initialized</a> () const</td></tr>
<tr class="memdesc:a15d5c319cf7e012e703668f4d4e7be87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if the texture data has been successfully transferred to OpenGL.  <a href="classmingfx_1_1_texture2_d.html#a15d5c319cf7e012e703668f4d4e7be87">More...</a><br /></td></tr>
<tr class="separator:a15d5c319cf7e012e703668f4d4e7be87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a401629d948aa144be81b94fe21938869"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869">width</a> () const</td></tr>
<tr class="memdesc:a401629d948aa144be81b94fe21938869"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the width in pixels of the texture.  <a href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869">More...</a><br /></td></tr>
<tr class="separator:a401629d948aa144be81b94fe21938869"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c396193b466053f23803894039d8d88"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88">height</a> () const</td></tr>
<tr class="memdesc:a3c396193b466053f23803894039d8d88"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the height in pixels of the texture.  <a href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88">More...</a><br /></td></tr>
<tr class="separator:a3c396193b466053f23803894039d8d88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4e0faadfe016e6ee501e66fc0244504"><td class="memItemLeft" align="right" valign="top">GLuint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#ad4e0faadfe016e6ee501e66fc0244504">opengl_id</a> () const</td></tr>
<tr class="memdesc:ad4e0faadfe016e6ee501e66fc0244504"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the unsigned int used as the texture handle by OpenGL.  <a href="classmingfx_1_1_texture2_d.html#ad4e0faadfe016e6ee501e66fc0244504">More...</a><br /></td></tr>
<tr class="separator:ad4e0faadfe016e6ee501e66fc0244504"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c8827426f43343c0ad171e181a741ea"><td class="memItemLeft" align="right" valign="top">GLenum&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a1c8827426f43343c0ad171e181a741ea">wrap_mode</a> () const</td></tr>
<tr class="memdesc:a1c8827426f43343c0ad171e181a741ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns an enumerated constant for the OpenGL wrap mode used by the texture.  <a href="classmingfx_1_1_texture2_d.html#a1c8827426f43343c0ad171e181a741ea">More...</a><br /></td></tr>
<tr class="separator:a1c8827426f43343c0ad171e181a741ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af0052203fcfd9bbb903a40d14700b13b"><td class="memItemLeft" align="right" valign="top">GLenum&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#af0052203fcfd9bbb903a40d14700b13b">filter_mode</a> () const</td></tr>
<tr class="memdesc:af0052203fcfd9bbb903a40d14700b13b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns an enumerated constant for the OpenGL filter mode used by the texture.  <a href="classmingfx_1_1_texture2_d.html#af0052203fcfd9bbb903a40d14700b13b">More...</a><br /></td></tr>
<tr class="separator:af0052203fcfd9bbb903a40d14700b13b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5cbe3396e4560ec0746e91dbc55bc9f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#aa5cbe3396e4560ec0746e91dbc55bc9f">set_wrap_mode</a> (GLenum wrapMode)</td></tr>
<tr class="memdesc:aa5cbe3396e4560ec0746e91dbc55bc9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the OpenGL texture wrap mode arguments.  <a href="classmingfx_1_1_texture2_d.html#aa5cbe3396e4560ec0746e91dbc55bc9f">More...</a><br /></td></tr>
<tr class="separator:aa5cbe3396e4560ec0746e91dbc55bc9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a3b2b550fefdf79f0fb392b04e7b013"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a4a3b2b550fefdf79f0fb392b04e7b013">set_filter_mode</a> (GLenum filterMode)</td></tr>
<tr class="memdesc:a4a3b2b550fefdf79f0fb392b04e7b013"><td class="mdescLeft">&#160;</td><td class="mdescRight">Uses the OpenGL texture filter mode arguments.  <a href="classmingfx_1_1_texture2_d.html#a4a3b2b550fefdf79f0fb392b04e7b013">More...</a><br /></td></tr>
<tr class="separator:a4a3b2b550fefdf79f0fb392b04e7b013"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e843f3d8904f9c7a99f7614f87de73b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmingfx_1_1_color.html">Color</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b">Pixel</a> (int x, int y) const</td></tr>
<tr class="memdesc:a1e843f3d8904f9c7a99f7614f87de73b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom right is (<a class="el" href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869" title="Returns the width in pixels of the texture.">width()</a>-1, <a class="el" href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88" title="Returns the height in pixels of the texture.">height()</a>-1).  <a href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b">More...</a><br /></td></tr>
<tr class="separator:a1e843f3d8904f9c7a99f7614f87de73b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aa15b86ec3b7312842c220b081c39980d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa15b86ec3b7312842c220b081c39980d">&#9670;&nbsp;</a></span>Texture2D()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mingfx::Texture2D::Texture2D </td>
          <td>(</td>
          <td class="paramtype">GLenum&#160;</td>
          <td class="paramname"><em>wrapMode</em> = <code>GL_REPEAT</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">GLenum&#160;</td>
          <td class="paramname"><em>filterMode</em> = <code>GL_LINEAR</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates an empty texture. Optional parameters can be provided to set the texture wrap mode and filter mode. </p>

</div>
</div>
<a id="aab734dbbcf6211507ab65d5bb94a4ef9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aab734dbbcf6211507ab65d5bb94a4ef9">&#9670;&nbsp;</a></span>~Texture2D()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual mingfx::Texture2D::~Texture2D </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="af0052203fcfd9bbb903a40d14700b13b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af0052203fcfd9bbb903a40d14700b13b">&#9670;&nbsp;</a></span>filter_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GLenum mingfx::Texture2D::filter_mode </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns an enumerated constant for the OpenGL filter mode used by the texture. </p>

</div>
</div>
<a id="a3c396193b466053f23803894039d8d88"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c396193b466053f23803894039d8d88">&#9670;&nbsp;</a></span>height()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int mingfx::Texture2D::height </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the height in pixels of the texture. </p>

</div>
</div>
<a id="aba57b01065096fe9f6483e8f68622944"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aba57b01065096fe9f6483e8f68622944">&#9670;&nbsp;</a></span>InitFromBytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::InitFromBytes </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. With this version of Init, you may pass in your own pointer to color data. The data argument must point to an array of 4-channel color data stored as unsigned chars in RGBA format. You are responsible for managing the memory for this array. If you will never call <a class="el" href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b" title="Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom ri...">Pixel()</a>, then it is safe to free data as soon as this function returns. Otherwise, you need to make sure data does not change in memory until you destroy the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a> object. </p>

</div>
</div>
<a id="a8eded044ccdf9bd3e1e5bcfe74526bdc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8eded044ccdf9bd3e1e5bcfe74526bdc">&#9670;&nbsp;</a></span>InitFromFile()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::InitFromFile </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>filename</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. Internally, this uses the stbi library to load images. It supports png, jpg, bmp, and other file formats. </p>

</div>
</div>
<a id="aee8a0aad1795680cb840ffcf544ed7b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aee8a0aad1795680cb840ffcf544ed7b8">&#9670;&nbsp;</a></span>InitFromFloats()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::InitFromFloats </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Call this from within the InitOpenGL() function since it will initialize not just the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a>'s internal data but also an OpenGL texture to be stored on the graphics card. With this version of Init, you may pass in your own pointer to color data. The data argument must point to an array of 4-channel color data stored as floats in RGBA format. You are responsible for managing the memory for this array. If you will never call <a class="el" href="classmingfx_1_1_texture2_d.html#a1e843f3d8904f9c7a99f7614f87de73b" title="Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom ri...">Pixel()</a>, then it is safe to free data as soon as this function returns. Otherwise, you need to make sure data does not change in memory until you destroy the <a class="el" href="classmingfx_1_1_texture2_d.html" title="A wrapper around a 2D texture that supports loading images from files or setting texture color data d...">Texture2D</a> object. </p>

</div>
</div>
<a id="a15d5c319cf7e012e703668f4d4e7be87"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a15d5c319cf7e012e703668f4d4e7be87">&#9670;&nbsp;</a></span>initialized()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::initialized </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns true if the texture data has been successfully transferred to OpenGL. </p>

</div>
</div>
<a id="ad4e0faadfe016e6ee501e66fc0244504"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad4e0faadfe016e6ee501e66fc0244504">&#9670;&nbsp;</a></span>opengl_id()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GLuint mingfx::Texture2D::opengl_id </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the unsigned int used as the texture handle by OpenGL. </p>

</div>
</div>
<a id="a1e843f3d8904f9c7a99f7614f87de73b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e843f3d8904f9c7a99f7614f87de73b">&#9670;&nbsp;</a></span>Pixel()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmingfx_1_1_color.html">Color</a> mingfx::Texture2D::Pixel </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>y</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the color at the specified pixel. The top left corner of the image is (0,0) and the bottom right is (<a class="el" href="classmingfx_1_1_texture2_d.html#a401629d948aa144be81b94fe21938869" title="Returns the width in pixels of the texture.">width()</a>-1, <a class="el" href="classmingfx_1_1_texture2_d.html#a3c396193b466053f23803894039d8d88" title="Returns the height in pixels of the texture.">height()</a>-1). </p>

</div>
</div>
<a id="a4a3b2b550fefdf79f0fb392b04e7b013"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a3b2b550fefdf79f0fb392b04e7b013">&#9670;&nbsp;</a></span>set_filter_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::Texture2D::set_filter_mode </td>
          <td>(</td>
          <td class="paramtype">GLenum&#160;</td>
          <td class="paramname"><em>filterMode</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Uses the OpenGL texture filter mode arguments. </p>

</div>
</div>
<a id="aa5cbe3396e4560ec0746e91dbc55bc9f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5cbe3396e4560ec0746e91dbc55bc9f">&#9670;&nbsp;</a></span>set_wrap_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mingfx::Texture2D::set_wrap_mode </td>
          <td>(</td>
          <td class="paramtype">GLenum&#160;</td>
          <td class="paramname"><em>wrapMode</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Uses the OpenGL texture wrap mode arguments. </p>

</div>
</div>
<a id="a0783ad70829ef353aa92344d320b107c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0783ad70829ef353aa92344d320b107c">&#9670;&nbsp;</a></span>UpdateFromBytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::UpdateFromBytes </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function may be called to re-read the texture data from an array formated the same as in InitFromBytes. The width and height of the texture must remain the same. </p>

</div>
</div>
<a id="ad7640f0cbda6398a6bb80202b80dd693"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7640f0cbda6398a6bb80202b80dd693">&#9670;&nbsp;</a></span>UpdateFromFloats()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mingfx::Texture2D::UpdateFromFloats </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function may be called to re-read the texture data from an array formated the same as in InitFromFloats. The width and height of the texture must remain the same. </p>

</div>
</div>
<a id="a401629d948aa144be81b94fe21938869"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a401629d948aa144be81b94fe21938869">&#9670;&nbsp;</a></span>width()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int mingfx::Texture2D::width </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the width in pixels of the texture. </p>

</div>
</div>
<a id="a1c8827426f43343c0ad171e181a741ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c8827426f43343c0ad171e181a741ea">&#9670;&nbsp;</a></span>wrap_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GLenum mingfx::Texture2D::wrap_mode </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns an enumerated constant for the OpenGL wrap mode used by the texture. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/<a class="el" href="texture2d_8h_source.html">texture2d.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.9.1
</small></address>
</body>
</html>