VisioMove SDK (iOS)  2.1.22
VgEngine::VgITextureManager Interface Referenceabstract

Public Member Functions

virtual ~VgITextureManager ()
 
virtual VgEngine::VgRefPtr< VgEngine::VgITexturecreateTexture (VgEngine::VgConstRefPtr< VgEngine::VgBinaryBuffer >const &pBuffer, bool pGenerateMipmaps=true)=0
 
virtual VgEngine::VgRefPtr< VgEngine::VgITexturecreateTexture (VgEngine::UInt pWidth, VgEngine::UInt pHeight, VgEngine::VgPixelFormat pPixelFormat, const char *pData, UInt pLength, bool pGenerateMipmaps=true)=0
 
virtual VgEngine::VgRefPtr< VgEngine::VgITexturecreateTextureWithUniformColor (const VgEngine::VgColor &pColor, VgEngine::UInt pWidth=1, VgEngine::UInt pHeight=1)=0
 
virtual VgEngine::VgRefPtr< VgEngine::VgITexturegetTexture (const std::string &pTextureName)=0
 

Protected Member Functions

 VgITextureManager ()
 

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;
...
// 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();
...

Constructor & Destructor Documentation

VgEngine::VgITextureManager::VgITextureManager ( )
inlineprotected

Constructor.

virtual VgEngine::VgITextureManager::~VgITextureManager ( )
inlinevirtual

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.
pGenerateMipmapsDefault true, indicates whether mipmaps should be auto-generated; if set to true it will generate mipmaps for zoomed levels if supported by the hardware. This is used to avoid flickering at the expense of some fuzziness.
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.
Textures should be square.
Version
2.0.8955
2.1.2 Added support for non power of 2 square textures

Referenced by ~VgITextureManager().

virtual VgEngine::VgRefPtr< VgEngine::VgITexture > VgEngine::VgITextureManager::createTexture ( VgEngine::UInt  pWidth,
VgEngine::UInt  pHeight,
VgEngine::VgPixelFormat  pPixelFormat,
const char *  pData,
UInt  pLength,
bool  pGenerateMipmaps = true 
)
pure virtual

Creates a Texture from a VgEngine::VgByte pointer and Image dimensions. For example, to create a simple checker marker:

char lCheckerBufferRGB[] = {255,0,0, 0,255,0, 0,255,0, 255,0,0 };
lEngine->editTextureManager()->createTexture(2, 2, VgEngine::eRGB, lCheckerBufferRGB, 12);
// Test createTexture with dimensions, using RGB
lCheckerMarkerRGB->mIcon = lCheckerTextureRGB;
Parameters
pWidthwidth of the image
pHeightheight of the image
pPixelFormatthe pixel format to use.
pDatashould a pointer with pWidth * pHeight * (3 or 4 depending on pPixelFormat (eRGB or eRGBA)) bytes. This data will be copied.
pLengthlength of valid data of pData, should be pWidth * pHeight * (3 or 4 depending on pPixelFormat (eRGB or eRGBA)) @
pGenerateMipmapsdefault true, indicates whether mipmaps should be auto-generated; if set to true it will generate mipmaps for zoomed levels if supported by the hardware. This is used to avoid flickering at the expense of some fuzziness
Remarks
Textures should be square.
The pData is drawn bottom up, meaning that the first bytes correspond to the bottom left pixel of the image, i.e. bottom up.
Version
2.1.0
2.1.2 Added support for non power of 2 square textures
virtual VgEngine::VgRefPtr< VgEngine::VgITexture > VgEngine::VgITextureManager::createTextureWithUniformColor ( const VgEngine::VgColor pColor,
VgEngine::UInt  pWidth = 1,
VgEngine::UInt  pHeight = 1 
)
pure virtual

Creates a WxH pixel uniform color VgITexture useful for backgrounds and debugging.

Parameters
pColorcolor of texture.
pWidthwidth of texture, 1 by default.
pHeightcolor of texture, 1 by default.
Version
2.1.0
2.1.2 added possibility to make it a rectangular texture

Referenced by ~VgITextureManager().

virtual VgEngine::VgRefPtr< VgEngine::VgITexture > VgEngine::VgITextureManager::getTexture ( const std::string &  pTextureName)
pure virtual

Returns a named texture from the registered textures. This method is mainly used to get back textures from the ones declared in vg_config.xml in the <resources> section.

Parameters
pTextureNameThe name of the texture. In vg_config this is the 'id' attribute of the 'texture' tag.
Returns
A referenced pointer on the texture if any, null if none. Check the isValid method before use.
Version
2.0.9263

Referenced by ~VgITextureManager().


The documentation for this interface was generated from the following file:
VisioMove 2.1.22, Visioglobe® 2016