Unofficial OpenGL Software Development Kit: glimg::ImageCreator Class Reference

Unofficial OpenGL Software Development Kit 0.5.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members | Public Member Functions
glimg::ImageCreator Class Reference
Image Creation

`#include <ImageCreator.h>`

##

A factory object for creating ImageSet objects.

Creating a valid ImageSet is a complicated task. To ensure the validity and veracity of data for ImageSet objects, the task of creating them is managed by this factory object.

This object can be copy constructed (but not copy-assigned), which will copy all of the pixel data uploaded thus far.

The ImageFormat given to this class's constructor serves double-duty. It will be the ImageFormat that the resulting ImageSet gets, but it also describes the expected arrangement of any pixel data given to the object. This includes the alignment part of the ImageFormat.

Since ImageCreator is designed to be used with OpenGL, it can flip any incoming pixel data written to it. If you send image data in top-left coordinates, it will flip the pixels to bottom-left. This includes compressed textures.

## Public Member Functions

| ImageCreator (ImageFormat format, Dimensions dimensions, int mipmapCount, int arrayCount, int faceCount)
| Creates an ImageCreator factory for making ImageSet objects. More...
void | SetImageData (const void *pixelData, bool isTopLeft, int mipmapLevel, int arrayIx=0, int faceIx=0)
| Sets the data for a single image. More...
void | SetFullMipmapLevel (const void *pixelData, bool isTopLeft, int mipmapLevel)
| Sets the data for an entire mipmap layer. More...
ImageSet * | CreateImage ()
| Creates an ImageSet from the stored data. After the completion of this function, this ImageCreator object is now dead. More...

## Constructor & Destructor Documentation

glimg::ImageCreator::ImageCreator | ( | ImageFormat | format,
|  | Dimensions | dimensions,
|  | int | mipmapCount,
|  | int | arrayCount,
|  | int | faceCount
| ) |  |

Creates an ImageCreator factory for making ImageSet objects.

This constructor will initialize all pixel data to 0. All memory allocation is done by the constructor; this ensures that there will be data for images that were asked for even if the user does not specify them.

Parameters

  format | The ImageFormat for the ImageSet to be created.
  dimensions | The dimensionality of the base layer of the image.
  mipmapCount | The number of mipmaps in the image.
  arrayCount | The number of arrays of the image.
  faceCount | The number of faces of the image. Must be either 1 or 6.

Exceptions

  BadFaceCountException | If faceCount is not 1 or 6.
  CubemapsMustBe2DException | If faceCount is 6 and dimensions.numDimensions != 2.
  No3DTextureArrayException | If arrayCount > 1 and dimensions.numDimensions == 3.
  NoImagesSpecifiedException | If mipmapCount or arrayCount is <= 0, thus specifying no images.

## Member Function Documentation

ImageSet* glimg::ImageCreator::CreateImage | ( |  | ) |

Creates an ImageSet from the stored data. After the completion of this function, this ImageCreator object is now dead.

Do not use the ImageCreator object after calling this. Deleting it is fine, but the data has been transferred to the ImageSet, and no longer resides in the ImageCreator. Any attempt to use this object afterwards will result in a ImageSetAlreadyCreatedException exception.

This object is a copyable object (so long as you use copy construction, not copy assignment), so if you want to make multiple ImageSet objects from the same ImageCreator, just copy construct the object before creating it. The copy will replicate the data.

void glimg::ImageCreator::SetFullMipmapLevel | ( | const void * | pixelData,
|  | bool | isTopLeft,
|  | int | mipmapLevel
| ) |  |

Sets the data for an entire mipmap layer.

Each mipmap layer contains a number of array images and faces. This function will specify all of this data in one shot. Each array of the image data contains faceCount faces. These cubemap faces are ordered as defined by the ARB_texture_cube_map_array extension.

If faceCount was 1, then there will only be one face instead of the 6. If arrayCount was 1 then there will only be one set of faces. And if they were both 1, then there is only one image per mipmap level.

Parameters

  pixelData | The pixel data for the mipmap. It is expected to be formatted exactly as specified by the ImageFormat given to this ImageCreator at creation time. It must contain all of the pixel data in the order as above.
  isTopLeft | True if the orientation of the given image data is top-left. False if it is bottom-left.
  mipmapLevel | The mipmap layer to set to.

Exceptions

  ImageSetAlreadyCreatedException | If CreateImage has already been called for this ImageCreator.
  MipmapLayerOutOfBoundsException | If mipmapLevel is outside of the mipmapCount range specified in the constructor.

void glimg::ImageCreator::SetImageData | ( | const void * | pixelData,
|  | bool | isTopLeft,
|  | int | mipmapLevel,
|  | int | arrayIx = `0`,
|  | int | faceIx = `0`
| ) |  |

Sets the data for a single image.

The pixel data from the given buffer will be copied into the given image in the ImageCreator.

Parameters

  pixelData | The pixel data for the mipmap. It is expected to be formatted exactly as specified by the ImageFormat given to this ImageCreator at creation time.
  isTopLeft | True if the orientation of the given image data is top-left. False if it is bottom-left.
  mipmapLevel | The mipmap layer of the image to set.
  arrayIx | The array index of the image to set.
  faceIx | The face index of the image to set.

Exceptions

  ImageSetAlreadyCreatedException | If CreateImage has already been called for this ImageCreator.
  MipmapLayerOutOfBoundsException | If mipmapLevel is outside of the mipmapCount range specified in the constructor.
  ArrayOutOfBoundsException | If arrayIx is outside of the arrayCount range specified in the constructor.
  FaceIndexOutOfBoundsException | If faceIx is outside of the faceCount range specified in the constructor.

The documentation for this class was generated from the following file:

- C:/Projects/distro/glsdk_0_5_1/glimg/include/glimg/ImageCreator.h