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 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleGLImages</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<h1 class="unit">Unit CastleGLImages</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Uses">Uses</a></td><td><a class="section" href="#PasDoc-Classes">Classes, Interfaces, Objects and Records</a></td><td><a class="section" href="#PasDoc-FuncsProcs">Functions and Procedures</a></td><td><a class="section" href="#PasDoc-Types">Types</a></td><td><a class="section" href="#PasDoc-Constants">Constants</a></td><td><a class="section" href="#PasDoc-Variables">Variables</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="description">Description</h2>
<p>
Using images in OpenGL (as textures and as normal images).
<p>For non-OpenGL image management, see <a class="normal" href="CastleImages.html">CastleImages</a> and <a class="normal" href="CastleTextureImages.html">CastleTextureImages</a> units. They contain functions and classes to load, save and process images.
<p>This unit has functions and classes to:
<p></p>
<ul class="paragraph_spacing">
<li><p>Load images as OpenGL textures. You usually do not use these directly, instead <a class="normal" href="CastleScene.TCastleScene.html">TCastleScene</a> automatically uses these to load and render textures as part of 3D models.
<p>A lot of utilities included: for 2D textures (see <a class="normal" href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a>), cube maps (see <a class="normal" href="CastleGLImages.html#glTextureCubeMap">glTextureCubeMap</a>), 3D textures (see <a class="normal" href="CastleGLImages.html#glTextureImage3D">glTextureImage3D</a>). These functions wrap OpenGL calls like glTexImage2D to handle our images (<a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a> (and descendant <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>), <a class="normal" href="CastleDDS.TDDSImage.html">TDDSImage</a>), and to automatically set texture parameters, mipmaps and such.</p></li>
<li><p>Load and draw images in 2D. This is useful to implement various 2D controls. See <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> class and friends.</p></li>
<li><p>Save the current OpenGL screen contents to our <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a>. You usually use this through <a class="normal" href="CastleWindow.TCastleWindowCustom.html#SaveScreen">TCastleWindowCustom.SaveScreen</a> or TCastleControl.SaveScreen, based on <a class="normal" href="CastleGLImages.html#SaveScreen_NoFlush">SaveScreen_NoFlush</a> in this unit.</p></li>
<li><p>Render to texture, see <a class="normal" href="CastleGLImages.TGLRenderToTexture.html">TGLRenderToTexture</a> class. This is our abstraction over OpenGL framebuffer (or glCopyTexSubImage for ancient GPUs).</p></li>
</ul>
<p>
<p>This unit hides from your some details about OpenGL images handling. For example, you don't have to worry about "pixel store alignment", we handle it here internally when transferring images between memory and GPU. You also don't have to worry about texture sizes being power of 2, or about maximum texture sizes — we will resize textures if necessary.
<p>Routines in this unit that take <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> or <a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a> parameter are limited to <a class="normal" href="CastleTextureImages.html#TextureImageClassesAll">TextureImageClassesAll</a> (for routines dealing with textures) or <a class="normal" href="CastleGLImages.html#PixelsImageClasses">PixelsImageClasses</a> (for routines dealing with images drawn on 2D screen).</p>
<a name="PasDoc-Uses"></a><h2 class="uses">Uses</h2>
<ul class="useslist"><li>SysUtils</li><li>FGL</li><li>GL</li><li>GLU</li><li>GLExt</li><li><a href="CastleImages.html">CastleImages</a></li><li><a href="CastleVectors.html">CastleVectors</a></li><li><a href="CastleGLUtils.html">CastleGLUtils</a></li><li><a href="CastleVideos.html">CastleVideos</a></li><li><a href="CastleDDS.html">CastleDDS</a></li><li><a href="CastleRectangles.html">CastleRectangles</a></li><li><a href="CastleGLShaders.html">CastleGLShaders</a></li><li><a href="CastleColors.html">CastleColors</a></li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Classes"></a><h3 class="cio">Classes, Interfaces, Objects and Records</h3>
<table class="classestable wide_list">
<tr class="listheader">
<th class="itemname">Name</th>
<th class="itemdesc">Description</th>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.ETextureLoadError.html"><code>ETextureLoadError</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html"><code>EImageClassNotSupportedForOpenGL</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.ECannotLoadCompressedTexture.html"><code>ECannotLoadCompressedTexture</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EInvalidImageForOpenGLTexture.html"><code>EInvalidImageForOpenGLTexture</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Object <a class="bold" href="CastleGLImages.TTextureFilter.html"><code>TTextureFilter</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EGenerateMipmapNotAvailable.html"><code>EGenerateMipmapNotAvailable</code></a></td>
<td class="itemdesc">Part of <a class="normal" href="CastleGLImages.html">CastleGLImages</a> unit: mipmaps utils.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TGLImage.html"><code>TGLImage</code></a></td>
<td class="itemdesc">Image ready to be drawn on 2D screen.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EFramebufferError.html"><code>EFramebufferError</code></a></td>
<td class="itemdesc">Part of <a class="normal" href="CastleGLImages.html">CastleGLImages</a> unit: rendering to texture (<a class="normal" href="CastleGLImages.TGLRenderToTexture.html">TGLRenderToTexture</a>).</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EFramebufferSizeTooLow.html"><code>EFramebufferSizeTooLow</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.EFramebufferInvalid.html"><code>EFramebufferInvalid</code></a></td>
<td class="itemdesc"> </td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TGLRenderToTexture.html"><code>TGLRenderToTexture</code></a></td>
<td class="itemdesc">Rendering to texture with OpenGL.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TTextureMemoryProfiler.html"><code>TTextureMemoryProfiler</code></a></td>
<td class="itemdesc">Part of <a class="normal" href="CastleGLImages.html">CastleGLImages</a> unit: texture memory profiler (<a class="normal" href="CastleGLImages.html#TextureMemoryProfiler">TextureMemoryProfiler</a>).</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TGLVideo.html"><code>TGLVideo</code></a></td>
<td class="itemdesc">Video as a sequence of OpenGL textures that can be easily played.</td>
</tr>
<tr class="list2">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TGLVideo3D.html"><code>TGLVideo3D</code></a></td>
<td class="itemdesc">Video expressed as a series of textures, to play as texture on any 3D object.</td>
</tr>
<tr class="list">
<td class="itemname">Class <a class="bold" href="CastleGLImages.TGLVideo2D.html"><code>TGLVideo2D</code></a></td>
<td class="itemdesc">Video expressed as a series of <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a>, to play as 2D GUI control.</td>
</tr>
</table>
<a name="PasDoc-FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ImageGLFormat">ImageGLFormat</a></b>(const Img: <a href="CastleImages.TCastleImage.html">TCastleImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ImageGLInternalFormat">ImageGLInternalFormat</a></b>(const Img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ImageGLType">ImageGLType</a></b>(const Img: <a href="CastleImages.TCastleImage.html">TCastleImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#glFreeTexture">glFreeTexture</a></b>(var Tex: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#TexParameterMaxAnisotropy">TexParameterMaxAnisotropy</a></b>(const target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>; const Anisotropy: <a href="CastleGLUtils.html#TGLfloat">TGLfloat</a>);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>operator = (const V1, V2: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>): boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#TextureFilter">TextureFilter</a></b>(const Minification: <a href="CastleGLImages.html#TMinificationFilter">TMinificationFilter</a>; const Magnification: <a href="CastleGLImages.html#TMagnificationFilter">TMagnificationFilter</a>): <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#SetTextureFilter">SetTextureFilter</a></b>(const Target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>operator = (const W1, W2: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>): boolean;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>operator = (const W1, W2: <a href="CastleGLImages.html#TTextureWrap3D">TTextureWrap3D</a>): boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#Texture2DClampToEdge">Texture2DClampToEdge</a></b>: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#HasGenerateMipmap">HasGenerateMipmap</a></b>: boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a></b>(target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#ImageDraw">ImageDraw</a></b>(const Image: <a href="CastleImages.TCastleImage.html">TCastleImage</a>); deprecated;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#ResizeForTextureSize">ResizeForTextureSize</a></b>(var r: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ResizeToTextureSize">ResizeToTextureSize</a></b>(const r: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ResizeToTextureSize">ResizeToTextureSize</a></b>(const Size: Cardinal; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): Cardinal;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#IsTextureSized">IsTextureSized</a></b>(const r: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): boolean;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#IsTextureSized">IsTextureSized</a></b>(const Width, Height: Cardinal; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): boolean;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a></b>(const image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false): <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a></b>(const URL: string; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false): <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#LoadGLGeneratedTexture">LoadGLGeneratedTexture</a></b>(const TextureId: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; const image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false); overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#GLDecompressTexture">GLDecompressTexture</a></b>(Image: <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#glTextureImage3D">glTextureImage3D</a></b>(const TextureIdForProfiler: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; const Image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a>);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#IsCubeMapTextureSized">IsCubeMapTextureSized</a></b>(const Size: Cardinal): boolean;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#ResizeToCubeMapTextureSize">ResizeToCubeMapTextureSize</a></b>(const Size: Cardinal): Cardinal;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#glTextureCubeMap">glTextureCubeMap</a></b>(const TextureIdForProfiler: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; PositiveX, NegativeX, PositiveY, NegativeY, PositiveZ, NegativeZ: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a>; Mipmaps: boolean);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#SaveScreen_NoFlush">SaveScreen_NoFlush</a></b>( const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>): <a href="CastleImages.TRGBImage.html">TRGBImage</a>; overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#SaveScreen_NoFlush">SaveScreen_NoFlush</a></b>(const ImageClass: <a href="CastleImages.html#TCastleImageClass">TCastleImageClass</a>; const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>procedure <b><a href="CastleGLImages.html#SaveScreen_NoFlush">SaveScreen_NoFlush</a></b>(const Image: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Left, Bottom: Integer; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>); overload;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#SaveScreenToGL_NoFlush">SaveScreenToGL_NoFlush</a></b>(const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>; const ScalingPossible: boolean = false): <a href="CastleGLImages.TGLImage.html">TGLImage</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code>function <b><a href="CastleGLImages.html#TextureMemoryProfiler">TextureMemoryProfiler</a></b>: <a href="CastleGLImages.TTextureMemoryProfiler.html">TTextureMemoryProfiler</a>;</code></td>
</tr>
</table>
<a name="PasDoc-Types"></a><h3 class="summary">Types</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a></b> = <a href="CastleGLUtils.html#TGLuint">TGLuint</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TMinificationFilter">TMinificationFilter</a></b> = (...);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TMagnificationFilter">TMagnificationFilter</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a></b> = array [0..1] of <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TTextureWrap3D">TTextureWrap3D</a></b> = array [0..2] of <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a></b> = (...);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#TGLRenderToTextureBuffer">TGLRenderToTextureBuffer</a></b> = (...);</code></td>
</tr>
</table>
<a name="PasDoc-Constants"></a><h3 class="summary">Constants</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#PixelsImageClasses">PixelsImageClasses</a></b>: array [0..3] of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a> = (
<a href="CastleImages.TRGBImage.html">TRGBImage</a>,
<a href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>,
<a href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a>,
<a href="CastleImages.TGrayscaleAlphaImage.html">TGrayscaleAlphaImage</a>);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#Texture2DRepeat">Texture2DRepeat</a></b>: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a> = (GL_REPEAT, GL_REPEAT);</code></td>
</tr>
</table>
<a name="PasDoc-Variables"></a><h3 class="summary">Variables</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="CastleGLImages.html#GLTextureScale">GLTextureScale</a></b>: Cardinal = 1;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="CastleGLImages.html#GLTextureMinSize">GLTextureMinSize</a></b>: Cardinal = 16;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Functions and Procedures</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageGLFormat"></a><code>function <b>ImageGLFormat</b>(const Img: <a href="CastleImages.TCastleImage.html">TCastleImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Return appropriate OpenGL format and type constants for given <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> descendant. If you will pass here Img that is not a descendant of one of <a class="normal" href="CastleTextureImages.html#TextureImageClassesAll">TextureImageClassesAll</a> or <a class="normal" href="CastleGLImages.html#PixelsImageClasses">PixelsImageClasses</a>, they will raise <a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a>.
<p><a class="normal" href="CastleGLImages.html#ImageGLInternalFormat">ImageGLInternalFormat</a> works with <a class="normal" href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a> classes also, returning appropriate enum, suitable for glCompressedTexImage2D.
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Img class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageGLInternalFormat"></a><code>function <b>ImageGLInternalFormat</b>(const Img: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageGLType"></a><code>function <b>ImageGLType</b>(const Img: <a href="CastleImages.TCastleImage.html">TCastleImage</a>): <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="glFreeTexture"></a><code>procedure <b>glFreeTexture</b>(var Tex: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
If Tex <> 0 then it does glDeleteTextures on Tex and sets Tex to 0. In other words, this is a simple wrapper over glDeleteTextures that </p>
<ol class="paragraph_spacing">
<li value="1"><p>checks if Tex really should be deleted</p></li>
<li value="2"><p>sets Tex to 0 to not free it once again</p></li>
</ol>
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TexParameterMaxAnisotropy"></a><code>procedure <b>TexParameterMaxAnisotropy</b>(const target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>; const Anisotropy: <a href="CastleGLUtils.html#TGLfloat">TGLfloat</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Call glTexParameterf to set GL_TEXTURE_MAX_ANISOTROPY_EXT on given texture target.
<p>Takes care to check for appropriate OpenGL extension (if not present, does nothing), and to query OpenGL limit for Anisotropy (eventually clamping provided Anisotropy down).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="="></a><code>operator = (const V1, V2: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TextureFilter"></a><code>function <b>TextureFilter</b>(const Minification: <a href="CastleGLImages.html#TMinificationFilter">TMinificationFilter</a>; const Magnification: <a href="CastleGLImages.html#TMagnificationFilter">TMagnificationFilter</a>): <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SetTextureFilter"></a><code>procedure <b>SetTextureFilter</b>(const Target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Set current texture minification and magnification filter.
<p>This is just a thin wrapper for calling </p>
<pre class="longcode">
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, <span class="pascal_numeric"></span>...);
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, <span class="pascal_numeric"></span>...);
</pre>
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="="></a><code>operator = (const W1, W2: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="="></a><code>operator = (const W1, W2: <a href="CastleGLImages.html#TTextureWrap3D">TTextureWrap3D</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="Texture2DClampToEdge"></a><code>function <b>Texture2DClampToEdge</b>: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Return wrap GL_CLAMP_TO_EDGE in both directions.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="HasGenerateMipmap"></a><code>function <b>HasGenerateMipmap</b>: boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Is <a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a> avaiable. This checks some GL extensions/versions that give us glGenerateMipmap or glGenerateMipmapEXT call, used by <a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="GenerateMipmap"></a><code>procedure <b>GenerateMipmap</b>(target: <a href="CastleGLUtils.html#TGLenum">TGLenum</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Call glGenerateMipmap (or analogous function from some OpenGL extension).
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.EGenerateMipmapNotAvailable.html">EGenerateMipmapNotAvailable</a></dt>
<dd>If no glGenerateMipmap version is available on this OpenGL version. If you don't want to get this exception, you can always check <a class="normal" href="CastleGLImages.html#HasGenerateMipmap">HasGenerateMipmap</a> before calling this.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ImageDraw"></a><code>procedure <b>ImageDraw</b>(const Image: <a href="CastleImages.TCastleImage.html">TCastleImage</a>); deprecated;</code></td>
</tr>
<tr><td colspan="1">
<p class="hint_directive">Warning: this symbol is deprecated.</p><p>
Draw the image on 2D screen. Note that if you want to use this many times, it will be much faster to create <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> instance.
<p> Deprecated, always use <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> to draw 2D images.
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ResizeForTextureSize"></a><code>procedure <b>ResizeForTextureSize</b>(var r: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Resize the image to a size accepted as GL_TEXTURE_2D texture size for OpenGL. It tries to resize to a larger size, not smaller, to avoid losing image information.
<p>It also makes texture have power-of-two size, if Sizing <> tsAny (or if GLFeatures.TextureNonPowerOfTwo = <code>False</code>). This is a must for normal textures, used for 3D rendering (with mipmapping and such). Using OpenGL non-power-of-2 textures is not good for such usage case, some OpenGLs crash (ATI), some are ultra slow (NVidia), some cause artifacts (Mesa). OpenGL ES explicitly limits what you can do with non-power-of-2. Sample model using non-power-of-2 is in inlined_textures.wrl.
<p>Use Sizing = tsAny only for textures that you plan to use for drawing GUI images by <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a>.
<p></p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ResizeToTextureSize"></a><code>function <b>ResizeToTextureSize</b>(const r: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ResizeToTextureSize"></a><code>function <b>ResizeToTextureSize</b>(const Size: Cardinal; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): Cardinal;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="IsTextureSized"></a><code>function <b>IsTextureSized</b>(const r: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Does image have proper size for 2D OpenGL texture. See <a class="normal" href="CastleGLImages.html#ResizeForTextureSize">ResizeForTextureSize</a>. Note that this checks glGet(GL_MAX_TEXTURE_SIZE), so requires initialized OpenGL context.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="IsTextureSized"></a><code>function <b>IsTextureSized</b>(const Width, Height: Cardinal; const Sizing: <a href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>): boolean;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadGLTexture"></a><code>function <b>LoadGLTexture</b>(const image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false): <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Load new texture to OpenGL. Generates new texture number by glGenTextures, then binds this texture, and loads it's data.
<p>Takes care of UNPACK_ALIGNMENT inside (if needed, we'll change it and later revert back, so that the texture is correctly loaded).
<p>Sets texture minification, magnification filters and wrap parameters.
<p>Changes currently bound texture to this one (returned).
<p>If mipmaps will be needed (this is decided looking at Filter.Minification) we will load them too.
<p></p>
<ol class="paragraph_spacing">
<li value="1"><p> As a first try, if DDSForMipmaps is non-nil and has mipmaps (DDSForMipmaps.Mipmaps), we will load these mipmaps. DDSForMipmaps must be a normal 2D texture (DDSType = dtTexture).
<p>Otherwise, we'll try to generate mipmaps, using various OpenGL mechanisms.</p></li>
<li value="2"><p> We will try using <a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a> functionality to generate mipmaps on GPU. If not available, for uncompressed textures, we will generate mipmaps on CPU. For compressed textures, we will change minification filter to simple minLinear and make <a class="normal" href="CastleWarnings.html#OnWarning">OnWarning</a>.</p></li>
</ol>
<p>
<p>
<p>
<p>
<p></p>
<h6 class="description_section">Parameters</h6>
<dl class="parameters">
<dt>GUITexture</dt>
<dd>If <code>True</code>, the texture is not forced to have sizes as power-of-two. For <a class="normal" href="CastleGLImages.html#TTextureSizing">TTextureSizing</a>, it is like tsAny instead of tsScalablePowerOf2. Also, mipmaps are always disabled, regardless of requested Filter value, since mipmaps cannot work without power-of-two.</dd>
</dl>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.ETextureLoadError.html">ETextureLoadError</a></dt>
<dd>If texture cannot be loaded for whatever reason. This includes <a class="normal" href="CastleGLImages.ECannotLoadCompressedTexture.html">ECannotLoadCompressedTexture</a> if the compressed texture cannot be loaded for whatever reason. This includes <a class="normal" href="CastleGLImages.EInvalidImageForOpenGLTexture.html">EInvalidImageForOpenGLTexture</a> if Image class is invalid for an OpenGL texture.</dd>
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadGLTexture"></a><code>function <b>LoadGLTexture</b>(const URL: string; const Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false): <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="LoadGLGeneratedTexture"></a><code>procedure <b>LoadGLGeneratedTexture</b>(const TextureId: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; const image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; const Wrap: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a>; const DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a> = nil; const GUITexture: boolean = false); overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Load OpenGL texture into already reserved texture number. It uses existing OpenGL texture number (TextureId). Everything else works exactly the same as <a class="normal" href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a>.
<p>You can also use this to set "default unnamed OpenGL texture" parameters by passing TextureId = 0.
<p>
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.ETextureLoadError.html">ETextureLoadError</a></dt>
<dd>Raised in the same situations as <a class="normal" href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a>.</dd>
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="GLDecompressTexture"></a><code>function <b>GLDecompressTexture</b>(Image: <a href="CastleImages.TGPUCompressedImage.html">TGPUCompressedImage</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Decompress texture image by loading it to temporary OpenGL texture and reading back. So this internally uses current OpenGL context.
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.ECannotLoadCompressedTexture.html">ECannotLoadCompressedTexture</a></dt>
<dd>If cannot decompress S3TC, for example because we cannot load to OpenGL this compressed texture (for example because appropriate OpenGL extensions are not available, or such).</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="glTextureImage3D"></a><code>procedure <b>glTextureImage3D</b>(const TextureIdForProfiler: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; const Image: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; Filter: <a href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a>);</code></td>
</tr>
<tr><td colspan="1">
<p>
Comfortably load a 3D texture. Think about this as doing glTexImage3D(...) for you. It also sets texture minification, magnification filters and creates mipmaps if necessary.
<p>It checks OpenGL 3D texture size requirements, and throws exceptions if not satisfied.
<p>It takes care about OpenGL unpack parameters. Just don't worry about it.
<p>If Filter uses mipmaps, then all mipmap levels will be loaded.
<p></p>
<ol class="paragraph_spacing">
<li value="1"><p> As a first try, if DDSForMipmaps is non-nil and has mipmaps (DDSForMipmaps.Mipmaps), we will load these mipmaps. DDSForMipmaps must be a 3D texture (DDSType = dtVolume).</p></li>
<li value="2"><p>Otherwise, we'll generate mipmaps.
<p><a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a> functionality will be required for this. When it is not available on this OpenGL implementation, we will change minification filter to simple linear and make <a class="normal" href="CastleWarnings.html#OnWarning">OnWarning</a>. So usually you just don't have to worry about this.</p></li>
</ol>
<p>
<p>Pass TextureIdForProfiler only for profiling purposes (for <a class="normal" href="CastleGLImages.html#TextureMemoryProfiler">TextureMemoryProfiler</a>). This procedure assumes that the texture is already bound.
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.ETextureLoadError.html">ETextureLoadError</a></dt>
<dd>If texture cannot be loaded for whatever reason, for example it's size is not correct for OpenGL 3D texture (we cannot automatically resize 3D textures, at least for now). Or it's compressed (although we support here <a class="normal" href="CastleImages.TEncodedImage.html">TEncodedImage</a>, OpenGL doesn't have any 3D texture compression available.)</dd>
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="IsCubeMapTextureSized"></a><code>function <b>IsCubeMapTextureSized</b>(const Size: Cardinal): boolean;</code></td>
</tr>
<tr><td colspan="1">
<p>
Part of <a class="normal" href="CastleGLImages.html">CastleGLImages</a> unit: cubemaps sizing and loading.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="ResizeToCubeMapTextureSize"></a><code>function <b>ResizeToCubeMapTextureSize</b>(const Size: Cardinal): Cardinal;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="glTextureCubeMap"></a><code>procedure <b>glTextureCubeMap</b>(const TextureIdForProfiler: <a href="CastleGLImages.html#TGLTextureId">TGLTextureId</a>; PositiveX, NegativeX, PositiveY, NegativeY, PositiveZ, NegativeZ: <a href="CastleImages.TEncodedImage.html">TEncodedImage</a>; DDSForMipmaps: <a href="CastleDDS.TDDSImage.html">TDDSImage</a>; Mipmaps: boolean);</code></td>
</tr>
<tr><td colspan="1">
<p>
Comfortably load all six cube map texture images. Think about this as doing glTexImage2D(Side, ...) for each cube side. It takes care of (almost?) everything you need to prepare OpenGL cube map texture.
<p>It automatically takes care to adjust the texture size to appropriate size, honoring the "power of two" requirement and the GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB limit of OpenGL. So texture image may be resized (preferably up) internally before loading. Although, if texture is compressed, we cannot resize it — so <a class="normal" href="CastleGLImages.ECannotLoadCompressedTexture.html">ECannotLoadCompressedTexture</a> will be raised if texture is not appropriate size.
<p>It takes care about OpenGL unpack parameters. Just don't worry about it.
<p>Pass TextureIdForProfiler only for profiling purposes (for <a class="normal" href="CastleGLImages.html#TextureMemoryProfiler">TextureMemoryProfiler</a>). This procedure assumes that the texture is already bound.
<p>If mipmaps are requested:
<p></p>
<ol class="paragraph_spacing">
<li value="1"><p>First of all, if DDSForMipmaps is non-nil and has mipmaps defined, we will load them from this DDS image. DDSForMipmaps must have DDSType = dtCubeMap.</p></li>
<li value="2"><p>Otherwise, we'll try to generate images using OpenGL <a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a>.</p></li>
<li value="3"><p>As a last resort, if <a class="normal" href="CastleGLImages.html#GenerateMipmap">GenerateMipmap</a> is not available, we will fallback to generating mipmaps on CPU by good old gluBuild2DMipmaps call.</p></li>
</ol>
<p>
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.ETextureLoadError.html">ETextureLoadError</a></dt>
<dd>If texture cannot be loaded for whatever reason. This includes <a class="normal" href="CastleGLImages.ECannotLoadCompressedTexture.html">ECannotLoadCompressedTexture</a> if the compressed texture cannot be loaded for whatever reason (not availble appropriate extension, not correct texture size, mipmaps requested and DDSForMipmaps/glGenerateMipmap not available). This includes <a class="normal" href="CastleGLImages.EInvalidImageForOpenGLTexture.html">EInvalidImageForOpenGLTexture</a> if Image class is invalid for an OpenGL texture.</dd>
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveScreen_NoFlush"></a><code>function <b>SaveScreen_NoFlush</b>( const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>): <a href="CastleImages.TRGBImage.html">TRGBImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
<p>
Save the current color buffer contents to image.
<p>The suffix "NoFlush" is there to remind you that this function grabs the <i>current</i> buffer contents. Usually you want to redraw the screen to the back buffer, and call this function to capture back buffer <i>before</i> swapping, since this is the only reliable way to capture OpenGL screen. Just use <a class="normal" href="CastleWindow.TCastleWindowCustom.html#SaveScreen">TCastleWindowCustom.SaveScreen</a> to do it automatically.
<p>Version with ImageClass can save to any image format from <a class="normal" href="CastleGLImages.html#PixelsImageClasses">PixelsImageClasses</a>.
<p>Version with <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> instance just uses this instance to save the image. You must pass here already created <a class="normal" href="CastleImages.TCastleImage.html">TCastleImage</a> instance, it's class, Width and Height will be used when saving.
<p>
<p></p>
<h6 class="description_section">Exceptions raised</h6>
<dl class="exceptions_raised">
<dt><a class="normal" href="CastleGLImages.EImageClassNotSupportedForOpenGL.html">EImageClassNotSupportedForOpenGL</a></dt>
<dd>When Image class is not supported by OpenGL.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveScreen_NoFlush"></a><code>function <b>SaveScreen_NoFlush</b>(const ImageClass: <a href="CastleImages.html#TCastleImageClass">TCastleImageClass</a>; const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>): <a href="CastleImages.TCastleImage.html">TCastleImage</a>; overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveScreen_NoFlush"></a><code>procedure <b>SaveScreen_NoFlush</b>(const Image: <a href="CastleImages.TCastleImage.html">TCastleImage</a>; const Left, Bottom: Integer; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>); overload;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="SaveScreenToGL_NoFlush"></a><code>function <b>SaveScreenToGL_NoFlush</b>(const Rect: <a href="CastleRectangles.TRectangle.html">TRectangle</a>; const ReadBuffer: <a href="CastleGLImages.html#TColorBuffer">TColorBuffer</a>; const ScalingPossible: boolean = false): <a href="CastleGLImages.TGLImage.html">TGLImage</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Captures current screen as a <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> instance, ready to be drawn on 2D screen.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TextureMemoryProfiler"></a><code>function <b>TextureMemoryProfiler</b>: <a href="CastleGLImages.TTextureMemoryProfiler.html">TTextureMemoryProfiler</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
OpenGL texture memory profiler, to detect which textures use up the GPU texture memory. Especially useful on mobile devices, where texture memory is limited and your application must really optimize texture usage. Also useful to detect texture memory leaks.
<p>Simply enable it (<code>TextureMemoryProfiler.Enabled := true</code>), load your game, then query texture usage by <code>TTextureMemoryProfiler.UsageOverview</code>, e.g. show it by <code><a class="normal" href="CastleLog.html#WritelnLog">WritelnLog</a>('Textures', TextureMemoryProfiler.UsageOverview)</code>.</p>
</td></tr>
</table>
<h3 class="detail">Types</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TGLTextureId"></a><code><b>TGLTextureId</b> = <a href="CastleGLUtils.html#TGLuint">TGLuint</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TMinificationFilter"></a><code><b>TMinificationFilter</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Texture minification filter (what happens when many texture pixels are squeezed in one screen pixel).</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
minNearest: </li>
<li>
minLinear: </li>
<li>
minNearestMipmapNearest: </li>
<li>
minNearestMipmapLinear: </li>
<li>
minLinearMipmapNearest: </li>
<li>
minLinearMipmapLinear: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TMagnificationFilter"></a><code><b>TMagnificationFilter</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Texture magnification filter (what happens when a single texture pixel in stretched over many screen pixels).</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
magNearest: </li>
<li>
magLinear: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TTextureWrap2D"></a><code><b>TTextureWrap2D</b> = array [0..1] of <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TTextureWrap3D"></a><code><b>TTextureWrap3D</b> = array [0..2] of <a href="CastleGLUtils.html#TGLenum">TGLenum</a>;</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TTextureSizing"></a><code><b>TTextureSizing</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
———————————————————————- Adjusting image sizes to load them as textures. Usually you don't need these functions, <a class="normal" href="CastleGLImages.html#LoadGLTexture">LoadGLTexture</a>* and <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> and such call it automatically when needed.</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
tsAny: Texture size does not have to be a power of two (unless GLFeatures.TextureNonPowerOfTwo = <code>False</code>, in which case all textures must have power-of-two, and then tsAny may be scaled to satisfy it (but it still will not be scaled for <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>)). It is not affected by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>.</li>
<li>
tsRequiredPowerOf2: Texture size must be a power of two. It is not affected by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>, because we cannot scale it.</li>
<li>
tsScalablePowerOf2: Texture size must be a power of two. It is affected by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>, we can scale it.</li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TColorBuffer"></a><code><b>TColorBuffer</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<p>
Part of <a class="normal" href="CastleGLImages.html">CastleGLImages</a> unit: saving screen.</p>
<h6 class="description_section">Values</h6>
<ul>
<li>
cbFront: </li>
<li>
cbBack: </li>
<li>
cbColorAttachment0: </li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TGLRenderToTextureBuffer"></a><code><b>TGLRenderToTextureBuffer</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
<h6 class="description_section">Values</h6>
<ul>
<li>
tbColor: </li>
<li>
tbDepth: </li>
<li>
tbColorAndDepth: </li>
<li>
tbNone: </li>
</ul>
</td></tr>
</table>
<h3 class="detail">Constants</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="PixelsImageClasses"></a><code><b>PixelsImageClasses</b>: array [0..3] of <a href="CastleImages.html#TEncodedImageClass">TEncodedImageClass</a> = (
<a href="CastleImages.TRGBImage.html">TRGBImage</a>,
<a href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>,
<a href="CastleImages.TGrayscaleImage.html">TGrayscaleImage</a>,
<a href="CastleImages.TGrayscaleAlphaImage.html">TGrayscaleAlphaImage</a>);</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="Texture2DRepeat"></a><code><b>Texture2DRepeat</b>: <a href="CastleGLImages.html#TTextureWrap2D">TTextureWrap2D</a> = (GL_REPEAT, GL_REPEAT);</code></td>
</tr>
<tr><td colspan="1">
</td></tr>
</table>
<h3 class="detail">Variables</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="GLTextureScale"></a><code><b>GLTextureScale</b>: Cardinal = 1;</code></td>
</tr>
<tr><td colspan="1">
<p>
Scaling for all textures loaded to OpenGL. This allows you to conserve GPU memory. Each size (width, height, and (for 3D textures) depth) is scaled by 1 / 2ˆ<code>GLTextureScale</code>. So value = 1 means no scaling, value = 2 means that each size is 1/2 (texture area is 1/4), value = 3 means that each size is 1/4 and so on.
<p>Note that textures used for GUI, by <a class="normal" href="CastleGLImages.TGLImage.html">TGLImage</a> (more precisely: all non-power-of-2 textures) avoid this scaling entirely.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="GLTextureMinSize"></a><code><b>GLTextureMinSize</b>: Cardinal = 16;</code></td>
</tr>
<tr><td colspan="1">
<p>
Contraints the scaling done by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>. Scaling caused by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a> cannot scale texture to something less than <code>GLTextureMinSize</code>. If texture size was already < <code>GLTextureMinSize</code>, it is not scaled at all by <a class="normal" href="CastleGLImages.html#GLTextureScale">GLTextureScale</a>. This must be a power of two.</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:10</em>
</span>
</td></tr></table></body></html>
|