1 #ifndef MSP_GL_TEXTURECUBE_H_
2 #define MSP_GL_TEXTURECUBE_H_
5 #include "pixelformat.h"
13 POSITIVE_X = GL_TEXTURE_CUBE_MAP_POSITIVE_X,
14 NEGATIVE_X = GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
15 POSITIVE_Y = GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
16 NEGATIVE_Y = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
17 POSITIVE_Z = GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
18 NEGATIVE_Z = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
22 Cube map texture, consisting of six square faces. All of the faces must be of
23 the same size. A cube map texture is addressed by three-dimensional texture
24 coordinates, with a principal range of [-1, 1]. The face is first selected
25 according to the largest coordinate, and the remaining two coordinates are used
26 to sample the face image.
28 All faces of a cube map texture must be allocated for it to be usable.
30 Requires OpenGL version 1.3.
32 class TextureCube: public Texture
42 /** Defines storage structure for the texture. Must be called before an
43 image can be uploaded. Once storage is defined, it can't be changed. */
44 void storage(PixelFormat fmt, unsigned size);
46 /** Allocates storage for the cube faces. The contents are initially
47 undefined. If storage has already been allocated, does nothing. */
48 void allocate(unsigned level);
50 /** Uploads image data to a face. Storage must be defined beforehand. The
51 image data must have dimensions and format compatible with the defined
53 void image(TextureCubeFace face, unsigned level,
54 PixelFormat fmt, DataType type, const void *data);
56 /** Updates a rectangular region of a face. Storage must be defined and
57 allocated beforehand. The update region must be fully inside the texture.
58 The data format must be compatible with the defined storage. */
59 void sub_image(TextureCubeFace face, unsigned level,
60 int x, int y, unsigned w, unsigned h,
61 PixelFormat fmt, DataType type, const void *data);
63 unsigned get_size() const { return size; }
65 unsigned get_level_size(unsigned);