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

Method getTextureData

Engine/source/gfx/gl/gfxGLTextureObject.cpp:234–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234U8* GFXGLTextureObject::getTextureData( U32 mip )
235{
236 AssertFatal( mMipLevels, "");
237 mip = (mip < mMipLevels) ? mip : 0;
238
239 const U32 dataSize = ImageUtil::isCompressedFormat(mFormat)
240 ? getCompressedSurfaceSize( mFormat, mTextureSize.x, mTextureSize.y, mip )
241 : (mTextureSize.x >> mip) * (mTextureSize.y >> mip) * mBytesPerTexel;
242
243 U8* data = new U8[dataSize];
244 PRESERVE_TEXTURE(mBinding);
245 glBindTexture(mBinding, mHandle);
246
247 if( ImageUtil::isCompressedFormat(mFormat) )
248 glGetCompressedTexImage( mBinding, mip, data );
249 else
250 glGetTexImage(mBinding, mip, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], data);
251 return data;
252}
253
254void GFXGLTextureObject::copyIntoCache()
255{

Callers

nothing calls this directly

Calls 2

isCompressedFormatFunction · 0.85
getCompressedSurfaceSizeFunction · 0.85

Tested by

no test coverage detected