LoadTexture.htm 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>LoadTexture ( file$[,flags] )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. file$ - filename of image file to be used as texture <br />
  13. <br />
  14. flags (optional) - texture flag: <br />
  15. 1: Color (default) <br />
  16. 2: Alpha <br />
  17. 4: Masked <br />
  18. 8: Mipmapped <br />
  19. 16: Clamp U <br />
  20. 32: Clamp V <br />
  21. 64: Spherical environment map <br />
  22. 128: Cubic environment map <br />
  23. 256: Store texture in vram <br />
  24. 512: Force the use of high color textures
  25. </td>
  26. </tr>
  27. </table>
  28. <h1>Description</h1>
  29. <table>
  30. <tr>
  31. <td>
  32. Load a texture from an image file and returns the texture's handle. Supported file formats include: BMP, PNG, TGA and JPG. Only PNG and TGA support alpha. <br />
  33. <br />
  34. <br />
  35. The optional flags parameter allows you to apply certain effects to the texture. Flags can be added to combine two or more effects, e.g. 3 (1+2) = texture with colour and alpha maps. <br />
  36. <br />
  37. <br />
  38. See <a class=small href=../3d_commands/CreateTexture.htm>CreateTexture</a> for more detailed descriptions of the texture flags. <br />
  39. <br />
  40. <br />
  41. Something to consider when applying texture flags to loaded textures is that the texture may have already had certain flags applied to it via the <a class=small href=../3d_commands/TextureFilter.htm>TextureFilter</a> command. The default for the <a class=small href=../3d_commands/TextureFilter.htm>TextureFilter</a> command is 9 (1+8), which is a coloured, mipmapped texture. This cannot be overridden via the flags parameter of the LoadTexture command - if you wish for the filters to be removed you will need to use the <a class=small href=../3d_commands/ClearTextureFilters.htm>ClearTextureFilters</a> command, which must be done after setting the graphics mode (setting the graphics mode restores the default texture filters).
  42. <br>
  43. <br>
  44. See also: <a class=small href=CreateTexture.htm>CreateTexture</a>, <a class=small href=LoadAnimTexture.htm>LoadAnimTexture</a>.
  45. </td>
  46. </tr>
  47. </table>
  48. <h1><a href=../3d_examples/LoadTexture.bb>Example</a></h1>
  49. <table>
  50. <tr>
  51. <td>
  52. ; LoadTexture Example <br />
  53. ; ------------------- <br />
  54. <br />
  55. Graphics3D 640,480 <br />
  56. SetBuffer BackBuffer() <br />
  57. <br />
  58. camera=CreateCamera() <br />
  59. <br />
  60. light=CreateLight() <br />
  61. RotateEntity light,90,0,0 <br />
  62. <br />
  63. cube=CreateCube() <br />
  64. PositionEntity cube,0,0,5 <br />
  65. <br />
  66. ; Load texture <br />
  67. tex=LoadTexture( "media/b3dlogo.jpg" ) <br />
  68. <br />
  69. ; Texture cube with texture <br />
  70. EntityTexture cube,tex <br />
  71. <br />
  72. While Not KeyDown( 1 ) <br />
  73. <br />
  74. pitch#=0 <br />
  75. yaw#=0 <br />
  76. roll#=0 <br />
  77. <br />
  78. If KeyDown( 208 )=True Then pitch#=-1 <br />
  79. If KeyDown( 200 )=True Then pitch#=1 <br />
  80. If KeyDown( 203 )=True Then yaw#=-1 <br />
  81. If KeyDown( 205 )=True Then yaw#=1 <br />
  82. If KeyDown( 45 )=True Then roll#=-1 <br />
  83. If KeyDown( 44 )=True Then roll#=1 <br />
  84. <br />
  85. TurnEntity cube,pitch#,yaw#,roll# <br />
  86. <br />
  87. RenderWorld <br />
  88. Flip <br />
  89. <br />
  90. Wend <br />
  91. <br />
  92. End
  93. </td>
  94. </tr>
  95. </table>
  96. <br>
  97. <a target=_top href=../index.htm>Index</a><br>
  98. <br>
  99. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=LoadTexture&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  100. </html>