Public Member Functions | Static Public Member Functions | Protected Member Functions

VgEngine::VgITextureManager Interface Reference

The VgITextureManager class is used to create VgITexture given a VgBinaryBuffer. More...

List of all members.

Public Member Functions

virtual ~VgITextureManager ()
 Destructor.
virtual VgEngine::VgRefPtr
< VgEngine::VgITexture
createTexture (VgEngine::VgConstRefPtr< VgEngine::VgBinaryBuffer >const &pBuffer, bool pGenerateMipmaps=true)=0
 Creates a Texture from a VgBinaryBuffer.

Static Public Member Functions

static VgEngine::VgRefPtr
< VgBinaryBuffer
prepareTextureBuffer (VgEngine::UInt pWidth, VgEngine::UInt pHeight, VgEngine::VgPixelFormat pPixelFormat, VgEngine::Byte *&pOutData)
 Creates a buffer that can receive an image with the specific pixel format.

Protected Member Functions

 VgITextureManager ()
 Constructor.

Detailed Description

The VgITextureManager class is used to create VgITexture given a VgBinaryBuffer.

The VgITextureManager class is in charge of passing the VgBinaryBuffer data to the graphics engine and creates internal objects that allows usage of the returned texture.

The below code snippet demonstrates how a VgITexture can be created.

     ...
     VgApplication::VgIApplication* mVgApplication;
     VgEngine::VgRefPtr< VgEngine::VgITexture > mTexture;
     ...
     
     // Create VgITexture from an image file and assign it to a member variable
     VgEngine::VgRefPtr< VgEngine::VgBinaryBuffer > lBuffer = mVgApplication->editEngine()->editResourceManager()->readFromFileOrURL("/path/to/file.png");
     VgEngine::VgITextureManager* lTextureManager = lEngine->editTextureManager();
     VgEngine::VgRefPtr< VgEngine::VgITexture > lTexture = lTextureManager->createTexture(*lBuffer);
     
     mTexture = lTexture.get();
     ...
Date:
25/02/2010

Constructor & Destructor Documentation

VgEngine::VgITextureManager::VgITextureManager (  ) [inline, protected]

Constructor.

virtual VgEngine::VgITextureManager::~VgITextureManager (  ) [inline, virtual]

Destructor.


Member Function Documentation

virtual VgEngine::VgRefPtr< VgEngine::VgITexture > VgEngine::VgITextureManager::createTexture ( VgEngine::VgConstRefPtr< VgEngine::VgBinaryBuffer >const &  pBuffer,
bool  pGenerateMipmaps = true 
) [pure virtual]

Creates a Texture from a VgBinaryBuffer.

Remarks:
Once the VgBinaryBuffer is used to create a VgITexture, it should not be modified afterwards. The graphic's context should be active when this call is made.
Parameters:
pBufferThe buffer from where the texture will be loaded.
pGenerateMipmapsIndicates whether mipmaps should be auto-generated.
Remarks:
Under iOS, if the VgBinaryBuffer contains a png file. It must not be compressed (Uncheck "Compress PNG Files" under XCode), and the internal png reader does not handle Apple proprietary png extensions.
static VgEngine::VgRefPtr< VgBinaryBuffer > VgEngine::VgITextureManager::prepareTextureBuffer ( VgEngine::UInt  pWidth,
VgEngine::UInt  pHeight,
VgEngine::VgPixelFormat  pPixelFormat,
VgEngine::Byte *&  pOutData 
) [static]

Creates a buffer that can receive an image with the specific pixel format.

Parameters:
pWidthwidth of the image
pHeightheight of the image
pPixelFormatthe pixel format to use.
[out]pOutDatapointer that will be updated and that will later receive the image width*height*4*sizeof(char). This is done to minimize copies.
Remarks:
The image will be distorted if pWidth and pHeight are not equal.
Before creating a texture using the returned VgBinaryBuffer, pOutData should first be populate in the format of the specified pixel format.
The result of doing getData() on the resulting buffer will not be the same thing as pOutData. pOutData is where the image data will live, whereas getData() returns what will be delete[]d and includes additional information such as the PVR texture header.
Version:
2.0

The documentation for this interface was generated from the following file:
VisioDevKit 2.0, Visioglobe® 2013