FPLBase
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
texture.h
Go to the documentation of this file.
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef FPLBASE_TEXTURE_H
16 #define FPLBASE_TEXTURE_H
17 
18 #include <vector>
19 
20 #include "fplbase/config.h" // Must come first.
21 
22 #include "fplbase/async_loader.h"
23 #include "fplbase/handles.h"
24 #include "mathfu/constants.h"
25 #include "mathfu/glsl_mappings.h"
26 
27 namespace fplbase {
28 
29 class Renderer;
30 struct TextureImpl;
31 
32 /// @file
33 /// @addtogroup fplbase_texture
34 /// @{
35 
37  kFormatAuto = 0, ///< @brief The default, picks based on loaded data.
38  kFormat8888,
39  kFormat888,
40  kFormat5551,
41  kFormat565,
42  kFormatLuminance,
43  kFormatASTC,
44  kFormatPKM,
45  kFormatKTX,
46  kFormatNative, ///< @brief Uses the same format as the source file.
47  kFormatLuminanceAlpha,
48  kFormatCount // Must be at end.
49 };
50 
51 /// Flags affecting loading and sampler modes for a texture
53  /// Default behavior.
55  /// If not set, use repeating texcoords.
57  /// Uses (or generates) mipmaps.
59  /// Data represents a 1x6 cubemap.
61  /// Load texture asynchronously.
63  /// Premultiply by alpha on load.
64  /// Not supported for ASTC, PKM, or KTX images.
66 };
67 
68 inline TextureFlags operator|(TextureFlags a, TextureFlags b) {
69  return static_cast<TextureFlags>(static_cast<int>(a) | static_cast<int>(b));
70 }
71 
72 /// @brief determines if the format has an alpha component.
73 inline bool HasAlpha(TextureFormat format) {
74  switch (format) {
75  case kFormat8888:
76  case kFormat5551:
77  case kFormatASTC:
78  case kFormatKTX: // TODO(wvo): depends on the internal format.
79  return true;
80  default:
81  return false;
82  }
83 }
84 
85 /// @brief determines if the format is already compressed in some way.
86 /// If image data is supplied in these formats, we use them as-is.
87 inline bool IsCompressed(TextureFormat format) {
88  switch (format) {
89  case kFormat5551:
90  case kFormat565:
91  case kFormatASTC:
92  case kFormatPKM:
93  case kFormatKTX:
94  return true;
95  default:
96  return false;
97  }
98 }
99 
100 /// @class Texture
101 /// @brief Abstraction for a texture object loaded on the GPU.
102 ///
103 /// Contains functions for loading, marshalling, and disposal of textures.
104 class Texture : public AsyncAsset {
105  public:
106  /// @brief Constructor for a Texture.
107  explicit Texture(const char *filename = nullptr,
110 
111  /// @brief Destructor for a Texture.
112  /// @note Calls `Delete()`.
113  virtual ~Texture();
114 
115  /// @brief Loads and unpacks the Texture from `filename_` into `data_`. It
116  /// also sets the original size, if it has not yet been set.
117  virtual void Load();
118 
119  /// @brief Create a texture from data in memory.
120  /// @param[in] data The Texture data in memory to load from.
121  /// @param[in] size A const `mathfu::vec2i` reference to the original
122  /// Texture size `x` and `y` components.
123  /// @param[in] texture_format The format of `data`.
124  virtual void LoadFromMemory(const uint8_t *data, const mathfu::vec2i &size,
125  TextureFormat texture_format);
126 
127  /// @brief Creates a Texture from `data_` and stores the handle in `id_`.
128  virtual bool Finalize();
129 
130  /// @brief Whether this object loaded and finalized correctly. Call after
131  /// Finalize has been called (by AssetManager::TryFinalize).
132  bool IsValid() { return ValidTextureHandle(id_); }
133 
134  /// @brief Set the active Texture and binds `id_` to `GL_TEXTURE_2D`.
135  /// @param[in] unit Specifies which texture unit to make active.
136  /// @param[in] renderer Pointer to the Renderer
137  /// @note Modifies global OpenGL state.
138  void Set(size_t unit, Renderer *renderer);
139  /// @overload void Set(size_t unit)
140  void Set(size_t unit);
141 
142  /// @brief Set the active Texture and binds `id_` to `GL_TEXTURE_2D`.
143  /// @param[in] unit Specifies which texture unit to make active.
144  /// @param[in] renderer Pointer to the Renderer
145  /// @note Modifies global OpenGL state.
146  void Set(size_t unit, Renderer *renderer) const;
147  /// @overload void Set(size_t unit) const
148  void Set(size_t unit) const;
149 
150  /// @brief Delete the Texture stored in `id_`, and reset `id_` to `0`.
151  void Delete();
152 
153  /// @brief Update (part of) the current texture with new pixel data.
154  /// For now, must always update at least entire row.
155  /// @param[in] unit Specifies which texture unit to do the update with.
156  /// @param[in] texture_format The format of `data`.
157  /// @param[in] xoffset Lowest x-pixel coordinate to update.
158  /// @param[in] yoffset Lowest y-pixel coordinate to update.
159  /// @param[in] width Number of pixels along x-axis to update.
160  /// @param[in] hegiht Number of pixels along y-axis to update.
161  /// @param[in] data The Texture data in memory to load from.
162  void UpdateTexture(size_t unit, TextureFormat format, int xoffset,
163  int yoffset, int width, int height, const void *data);
164 
165  /// @brief Unpacks a memory buffer containing a TGA format file.
166  /// @note May only be uncompressed RGB or RGBA data, Y-flipped or not.
167  /// @param[in] tga_buf The TGA image data.
168  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
169  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the TGA
170  /// width and height.
171  /// @param[out] texture_format The format of the returned buffer, always
172  /// either 888 or 8888.
173  /// @return Returns RGBA array of returned dimensions or `nullptr` if the
174  /// format is not understood.
175  /// @note You must `free()` the returned pointer when done.
176  static uint8_t *UnpackTGA(const void *tga_buf, TextureFlags flags,
177  mathfu::vec2i *dimensions,
178  TextureFormat *texture_format);
179 
180  /// @brief Unpacks a memory buffer containing a Webp format file.
181  /// @param[in] webp_buf The WebP image data.
182  /// @param[in] size The size of the memory block pointed to by `webp_buf`.
183  /// @param[in] scale A scale value must be a power of two to have correct
184  /// Texture sizes.
185  /// @param[in] flags Texture flag, allowing premultiply
186  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
187  /// width and height.
188  /// @param[out] texture_format The format of the returned buffer, always
189  /// either 888 or 8888.
190  /// @return Returns a RGBA array of the returned dimensions or `nullptr`, if
191  /// the format is not understood.
192  /// @note You must `free()` on the returned pointer when done.
193  static uint8_t *UnpackWebP(const void *webp_buf, size_t size,
194  const mathfu::vec2 &scale, TextureFlags flags,
195  mathfu::vec2i *dimensions,
196  TextureFormat *texture_format);
197 
198  /// @brief Reads a memory buffer containing an ASTC format (.astc) file.
199  /// @param[in] astc_buf The ASTC image data.
200  /// @param[in] size The size of the memory block pointed to by `astc_buf`.
201  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
202  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
203  /// width and height.
204  /// @param[out] texture_format The format of the returned buffer, always
205  /// kFormatASTC.
206  /// @return Returns a buffer ready to be uploaded to GPU memory or `nullptr`,
207  /// if the format is not understood.
208  /// @note You must `free()` on the returned pointer when done.
209  static uint8_t *UnpackASTC(const void *astc_buf, size_t size,
210  TextureFlags flags, mathfu::vec2i *dimensions,
211  TextureFormat *texture_format);
212 
213  /// @brief Reads a memory buffer containing an ETC2 format (.pkm) file.
214  /// @param[in] file_buf the loaded file.
215  /// @param[in] size The size of the memory block pointed to by `file_buf`.
216  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
217  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
218  /// width and height.
219  /// @param[out] texture_format The format of the returned buffer, always
220  /// kFormatETC2.
221  /// @return Returns a buffer ready to be uploaded to GPU memory or `nullptr`,
222  /// if the format is not understood.
223  /// @note You must `free()` on the returned pointer when done.
224  static uint8_t *UnpackPKM(const void *file_buf, size_t size,
225  TextureFlags flags, mathfu::vec2i *dimensions,
226  TextureFormat *texture_format);
227 
228  /// @brief Reads a memory buffer containing an KTX format (.ktx) file.
229  /// @param[in] file_buf the loaded file.
230  /// @param[in] size The size of the memory block pointed to by `file_buf`.
231  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
232  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
233  /// width and height.
234  /// @param[out] texture_format The format of the returned buffer, always
235  /// kFormatETC2.
236  /// @return Returns a buffer ready to be uploaded to GPU memory or `nullptr`,
237  /// if the format is not understood.
238  /// @note You must `free()` on the returned pointer when done.
239  static uint8_t *UnpackKTX(const void *file_buf, size_t size,
240  TextureFlags flags, mathfu::vec2i *dimensions,
241  TextureFormat *texture_format);
242 
243  /// @brief Unpacks a memory buffer containing a Png format file.
244  /// @param[in] png_buf The Png image data.
245  /// @param[in] size The size of the memory block pointed to by `data`.
246  /// @param[in] scale A scale value must be a power of two to have correct
247  /// Texture sizes.
248  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
249  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
250  /// width and height.
251  /// @param[out] texture_format Pixel format of unpacked image.
252  /// @return Returns a RGBA array of the returned dimensions or `nullptr`, if
253  /// the format is not understood.
254  /// @note You must `free()` on the returned pointer when done.
255  static uint8_t *UnpackPng(const void *png_buf, size_t size,
256  const mathfu::vec2 &scale, TextureFlags flags,
257  mathfu::vec2i *dimensions,
258  TextureFormat *texture_format) {
259  return UnpackImage(png_buf, size, scale, flags, dimensions, texture_format);
260  }
261 
262  /// @brief Unpacks a memory buffer containing a Jpeg format file.
263  /// @param[in] jpg_buf The Jpeg image data.
264  /// @param[in] size The size of the memory block pointed to by `data`.
265  /// @param[in] scale A scale value must be a power of two to have correct
266  /// Texture sizes.
267  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
268  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
269  /// width and height.
270  /// @param[out] texture_format Pixel format of unpacked image.
271  /// @return Returns a RGBA array of the returned dimensions or `nullptr`, if
272  /// the format is not understood.
273  /// @note You must `free()` on the returned pointer when done.
274  static uint8_t *UnpackJpg(const void *jpg_buf, size_t size,
275  const mathfu::vec2 &scale, TextureFlags flags,
276  mathfu::vec2i *dimensions,
277  TextureFormat *texture_format) {
278  return UnpackImage(jpg_buf, size, scale, flags, dimensions, texture_format);
279  }
280 
281  /// @brief Loads the file in filename, and then unpacks the file format
282  /// (supports TGA, WebP, KTX, PKM, ASTC).
283  /// @note KTX/PKM/ASTC will automatically fall-back on WebP if the file is not
284  /// present or not supported by the GPU.
285  /// @note `last_error()` contains more information if `nullptr` is returned.
286  /// You must `free()` the returned pointer when done.
287  /// @param[in] filename A C-string corresponding to the name of the file
288  /// containing the Texture.
289  /// @param[in] scale A scale value must be a power of two to have correct
290  /// Texture sizes.
291  /// @param[in] flags Texture flag, allowing premultiply (only webp now)
292  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the Texture
293  /// width and height.
294  /// @param[out] texture_format The format of the returned buffer, always
295  /// either 888 or 8888.
296  /// @return Returns a RGBA array of the returned dimensions or `nullptr`, if
297  /// the format is not understood.
298  /// @note You must `free()` on the returned pointer when done.
299  static uint8_t *LoadAndUnpackTexture(const char *filename,
300  const mathfu::vec2 &scale,
302  mathfu::vec2i *dimensions,
303  TextureFormat *texture_format);
304 
305  /// @brief Utility function to convert 32bit RGBA (8-bits each) to 16bit RGB
306  /// in hex 5551 format.
307  /// @note You must `delete[]` the return value afterwards.
308  static uint16_t *Convert8888To5551(const uint8_t *buffer,
309  const mathfu::vec2i &size);
310  /// @brief Utility function to convert 24bit RGB (8-bits each) to 16bit RGB in
311  /// hex 565 format.
312  /// @note You must `delete[]` the return value afterwards.
313  static uint16_t *Convert888To565(const uint8_t *buffer,
314  const mathfu::vec2i &size);
315 
316  /// @brief Set texture target and id directly for textures that have been
317  /// created outside of this class. The creator is responsible for deleting
318  /// the texture id.
319  /// @param[in] target Texture target to use when binding texture to context.
320  /// @param[in] id Texture handle ID.
321  void SetTextureId(TextureTarget target, TextureHandle id);
322 
323  /// @brief Get the Texture handle ID.
324  /// @return Returns the TextureHandle ID.
325  const TextureHandle &id() const { return id_; }
326 
327  /// @brief Get the Texture size.
328  /// @return Returns a const `mathfu::vec2i` reference to the size of the
329  /// Texture.
330  const mathfu::vec2i &size() const { return size_; }
331 
332  /// @brief Get the Texture scale.
333  /// @return Returns a const `mathfu::vec2` reference to the scale of the
334  /// Texture.
335  const mathfu::vec2 &scale() const { return scale_; }
336 
337  /// @brief Set the Texture scale.
338  /// @param[in] scale A const `mathfu::vec2` reference containing the
339  /// `x` and `y` scale components to set for the Texture.
340  void set_scale(const mathfu::vec2 &scale) { scale_ = scale; }
341 
342  /// @brief returns the texture flags.
343  TextureFlags flags() const { return flags_; }
344 
345  /// @brief Get the original size of the Texture.
346  /// @return Returns a const `mathfu::vec2i` reference to the original size of
347  /// the Texture.
348  const mathfu::vec2i &original_size() const { return original_size_; }
349 
350  /// @brief Set the original size of the Texture.
351  /// @param[in] size A `mathfu::vec2i` containing the original Texture
352  /// `x` and `y` sizes.
353  void set_original_size(const mathfu::vec2i &size) { original_size_ = size; }
354 
355  /// @brief Get the Texture format.
356  /// @return Returns the texture format.
357  TextureFormat format() const { return texture_format_; }
358 
359  /// @brief If the original size has not yet been set, then set it.
360  /// @param[in] size A `mathfu::vec2i` containing the original Texture
361  /// `x` and `y` sizes.
362  void SetOriginalSizeIfNotYetSet(const mathfu::vec2i &size) {
363  if (original_size_.x == 0 && original_size_.y == 0) {
364  original_size_ = size;
365  }
366  }
367 
368  // For internal use only.
369  TextureImpl *impl() { return impl_; }
370 
371  MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE
372 
373  private:
374  // Backend-specific create and destroy calls. These just call new and delete
375  // on the platform-specific MeshImpl structs.
376  static TextureImpl *CreateTextureImpl();
377  static void DestroyTextureImpl(TextureImpl *impl);
378 
379  /// @brief Create a texture from a memory buffer containing `xsize` * `ysize`
380  /// RGBA pixels.
381  /// @param[in] buffer The data to create the Texture from.
382  /// @param[in] size A const `mathfu::vec2i` reference to the original
383  /// Texture size `x` and `y` components.
384  /// @param[in] texture_format The format of `buffer`.
385  /// @param[in] desired The desired TextureFormat.
386  /// @param[in] flags Options for the texture.
387  /// @return Returns the Texture handle. Otherwise, it returns `0`, if not a
388  /// power of two in size.
389  static TextureHandle CreateTexture(
390  const uint8_t *buffer, const mathfu::vec2i &size,
391  TextureFormat texture_format, TextureFormat desired,
392  TextureFlags flags, TextureImpl *impl);
393 
394  /// @brief Unpacks a memory buffer containing a PNG/JPEG/TGA format file.
395  /// @param[in] img_buf The PNG/JPEG/TGA image data including an image header.
396  /// @param[in] size The size of the memory block pointed to by `data`.
397  /// @param[in] scale A scale value must be a power of two to have correct
398  /// Texture sizes.
399  /// @param[in] flags Texture flag, allowing premultiply
400  /// @param[out] dimensions A `mathfu::vec2i` pointer the captures the image
401  /// width and height.
402  /// @param[out] has_alpha A `bool` pointer that captures whether the Png
403  /// image has an alpha.
404  /// @return Returns a RGBA array of the returned dimensions or `nullptr`, if
405  /// the format is not understood.
406  /// @note You must `free()` on the returned pointer when done.
407  static uint8_t *UnpackImage(const void *img_buf, size_t size,
408  const mathfu::vec2 &scale, TextureFlags flags,
409  mathfu::vec2i *dimensions,
410  TextureFormat *texture_format);
411 
412  /// @brief Backend specific conversion of flags to TextureTarget.
413  static TextureTarget TextureTargetFromFlags(TextureFlags flags);
414 
415  TextureImpl *impl_;
416  TextureHandle id_;
417  mathfu::vec2i size_;
418  mathfu::vec2i original_size_;
419  mathfu::vec2 scale_;
420  TextureFormat texture_format_;
421  TextureTarget target_;
422  TextureFormat desired_;
423  TextureFlags flags_;
424  bool is_external_;
425 };
426 
427 /// @brief used by some functions to allow the texture loading mechanism to
428 /// be specified by the caller.
429 typedef std::function<Texture *(const char *filename, TextureFormat format,
430  TextureFlags flags)>
432 
433 /// @}
434 } // namespace fplbase
435 
436 #endif // FPLBASE_TEXTURE_H
static uint8_t * UnpackWebP(const void *webp_buf, size_t size, const mathfu::vec2 &scale, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Unpacks a memory buffer containing a Webp format file.
static uint8_t * UnpackASTC(const void *astc_buf, size_t size, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Reads a memory buffer containing an ASTC format (.astc) file.
const mathfu::vec2 & scale() const
Get the Texture scale.
Definition: texture.h:335
Texture(const char *filename=nullptr, TextureFormat format=kFormatAuto, TextureFlags flags=kTextureFlagsUseMipMaps)
Constructor for a Texture.
TextureFlags flags() const
returns the texture flags.
Definition: texture.h:343
Load texture asynchronously.
Definition: texture.h:62
void Delete()
Delete the Texture stored in id_, and reset id_ to 0.
static uint8_t * UnpackJpg(const void *jpg_buf, size_t size, const mathfu::vec2 &scale, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Unpacks a memory buffer containing a Jpeg format file.
Definition: texture.h:274
const std::string & filename() const
The name of the file associated with the resource.
Definition: async_loader.h:107
static uint16_t * Convert8888To5551(const uint8_t *buffer, const mathfu::vec2i &size)
Utility function to convert 32bit RGBA (8-bits each) to 16bit RGB in hex 5551 format.
If not set, use repeating texcoords.
Definition: texture.h:56
Abstraction for a texture object loaded on the GPU.
Definition: texture.h:104
const mathfu::vec2i & size() const
Get the Texture size.
Definition: texture.h:330
static uint8_t * UnpackTGA(const void *tga_buf, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Unpacks a memory buffer containing a TGA format file.
bool IsValid()
Whether this object loaded and finalized correctly. Call after Finalize has been called (by AssetMana...
Definition: texture.h:132
TextureFormat
Definition: texture.h:36
Default behavior.
Definition: texture.h:54
const TextureHandle & id() const
Get the Texture handle ID.
Definition: texture.h:325
const mathfu::vec2i & original_size() const
Get the original size of the Texture.
Definition: texture.h:348
static uint8_t * UnpackPng(const void *png_buf, size_t size, const mathfu::vec2 &scale, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Unpacks a memory buffer containing a Png format file.
Definition: texture.h:255
void UpdateTexture(size_t unit, TextureFormat format, int xoffset, int yoffset, int width, int height, const void *data)
Update (part of) the current texture with new pixel data. For now, must always update at least entire...
static uint8_t * UnpackPKM(const void *file_buf, size_t size, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Reads a memory buffer containing an ETC2 format (.pkm) file.
void set_scale(const mathfu::vec2 &scale)
Set the Texture scale.
Definition: texture.h:340
void set_original_size(const mathfu::vec2i &size)
Set the original size of the Texture.
Definition: texture.h:353
TextureFlags
Flags affecting loading and sampler modes for a texture.
Definition: texture.h:52
Uses (or generates) mipmaps.
Definition: texture.h:58
virtual void LoadFromMemory(const uint8_t *data, const mathfu::vec2i &size, TextureFormat texture_format)
Create a texture from data in memory.
static uint8_t * LoadAndUnpackTexture(const char *filename, const mathfu::vec2 &scale, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Loads the file in filename, and then unpacks the file format (supports TGA, WebP, KTX...
Data represents a 1x6 cubemap.
Definition: texture.h:60
virtual bool Finalize()
Creates a Texture from data_ and stores the handle in id_.
Uses the same format as the source file.
Definition: texture.h:46
virtual ~Texture()
Destructor for a Texture.
internal::OpaqueHandle TextureHandle
Backend agnostic handles to various resources.
Definition: handles.h:40
TextureFormat format() const
Get the Texture format.
Definition: texture.h:357
static uint8_t * UnpackKTX(const void *file_buf, size_t size, TextureFlags flags, mathfu::vec2i *dimensions, TextureFormat *texture_format)
Reads a memory buffer containing an KTX format (.ktx) file.
void Set(size_t unit, Renderer *renderer)
Set the active Texture and binds id_ to GL_TEXTURE_2D.
static uint16_t * Convert888To565(const uint8_t *buffer, const mathfu::vec2i &size)
Utility function to convert 24bit RGB (8-bits each) to 16bit RGB in hex 565 format.
bool HasAlpha(TextureFormat format)
determines if the format has an alpha component.
Definition: texture.h:73
std::function< Texture *(const char *filename, TextureFormat format, TextureFlags flags)> TextureLoaderFn
used by some functions to allow the texture loading mechanism to be specified by the caller...
Definition: texture.h:431
The default, picks based on loaded data.
Definition: texture.h:37
virtual void Load()
Loads and unpacks the Texture from filename_ into data_. It also sets the original size...
void SetTextureId(TextureTarget target, TextureHandle id)
Set texture target and id directly for textures that have been created outside of this class...
Renderer is the main API class for rendering commands.
Definition: renderer.h:310
void SetOriginalSizeIfNotYetSet(const mathfu::vec2i &size)
If the original size has not yet been set, then set it.
Definition: texture.h:362
Definition: handles.h:24
Definition: async_loader.h:48
bool IsCompressed(TextureFormat format)
determines if the format is already compressed in some way. If image data is supplied in these format...
Definition: texture.h:87