MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _loadTexture

Method _loadTexture

Engine/source/gfx/gl/gfxGLTextureManager.cpp:265–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, GBitmap *pDL)
266{
267 PROFILE_SCOPE(GFXGLTextureManager_loadTexture);
268 GFXGLTextureObject *texture = static_cast<GFXGLTextureObject*>(aTexture);
269
270 AssertFatal(texture->getBinding() == GL_TEXTURE_1D || texture->getBinding() == GL_TEXTURE_2D,
271 "GFXGLTextureManager::_loadTexture(GBitmap) - This method can only be used with 1D/2D textures");
272
273 if(texture->getBinding() == GL_TEXTURE_3D)
274 return false;
275
276 // No 24bit formats.
277 if(pDL->getFormat() == GFXFormatR8G8B8)
278 pDL->setFormat(GFXFormatR8G8B8A8);
279 // Bind to edit
280 PRESERVE_TEXTURE(texture->getBinding());
281 glBindTexture(texture->getBinding(), texture->getHandle());
282
283 texture->mFormat = pDL->getFormat();
284 if(pDL->getFormat() == GFXFormatR8G8B8A8 || pDL->getFormat() == GFXFormatR8G8B8X8)
285 _fastTextureLoad(texture, pDL);
286 else
287 _slowTextureLoad(texture, pDL);
288
289 if(texture->getMipLevels() != 1)
290 glGenerateMipmap(texture->getBinding());
291
292 return true;
293}
294
295bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, DDSFile *dds)
296{

Callers 1

reloadFromCacheMethod · 0.45

Calls 15

_fastTextureLoadFunction · 0.85
_slowTextureLoadFunction · 0.85
isCompressedFormatFunction · 0.85
isPow2Function · 0.85
DecompressImageFunction · 0.85
getBindingMethod · 0.45
getFormatMethod · 0.45
setFormatMethod · 0.45
getHandleMethod · 0.45
getMipLevelsMethod · 0.45
sizeMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected