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

Method _loadTexture

Engine/source/gfx/gl/gfxGLTextureManager.cpp:259–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, GBitmap *pDL)
260{
261 PROFILE_SCOPE(GFXGLTextureManager_loadTexture);
262 GFXGLTextureObject *texture = static_cast<GFXGLTextureObject*>(aTexture);
263
264 AssertFatal(texture->getBinding() == GL_TEXTURE_1D || texture->getBinding() == GL_TEXTURE_2D,
265 "GFXGLTextureManager::_loadTexture(GBitmap) - This method can only be used with 1D/2D textures");
266
267 if(texture->getBinding() == GL_TEXTURE_3D)
268 return false;
269
270 // No 24bit formats.
271 if(pDL->getFormat() == GFXFormatR8G8B8)
272 pDL->setFormat(GFXFormatR8G8B8A8);
273 else if (pDL->getFormat() == GFXFormatR8G8B8_SRGB)
274 pDL->setFormat(GFXFormatR8G8B8A8_SRGB);
275 // Bind to edit
276 PRESERVE_TEXTURE(texture->getBinding());
277 glBindTexture(texture->getBinding(), texture->getHandle());
278
279 _textureUpload(pDL->getWidth(),pDL->getHeight(),pDL->getBytesPerPixel(),texture,pDL->getFormat(), pDL->getBits(), 0);
280
281 if(!ImageUtil::isCompressedFormat(pDL->getFormat()))
282 glGenerateMipmap(texture->getBinding());
283
284 return true;
285}
286
287bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, DDSFile *dds)
288{

Callers 1

reloadFromCacheMethod · 0.45

Calls 15

_textureUploadFunction · 0.85
isCompressedFormatFunction · 0.85
isPow2Function · 0.85
decompressFunction · 0.85
queryProfileMethod · 0.80
getCardProfilerMethod · 0.80
getBindingMethod · 0.45
getFormatMethod · 0.45
setFormatMethod · 0.45
getHandleMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected