mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-01 03:23:52 +00:00
OpenGL: Mipmaps for GFXGLCubemap.
This commit is contained in:
parent
ca04726ad6
commit
9150c7f5ab
3 changed files with 45 additions and 19 deletions
|
|
@ -243,12 +243,19 @@ void GFXGLTextureObject::bind(U32 textureUnit)
|
|||
mSampler = ssd;
|
||||
}
|
||||
|
||||
U8* GFXGLTextureObject::getTextureData()
|
||||
U8* GFXGLTextureObject::getTextureData( U32 mip )
|
||||
{
|
||||
U8* data = new U8[mTextureSize.x * mTextureSize.y * mBytesPerTexel];
|
||||
AssertFatal( mMipLevels, "");
|
||||
mip = (mip < mMipLevels) ? mip : 0;
|
||||
|
||||
const U32 dataSize = isCompressedFormat(mFormat)
|
||||
? getCompressedSurfaceSize( mFormat, mTextureSize.x, mTextureSize.y, mip )
|
||||
: (mTextureSize.x >> mip) * (mTextureSize.y >> mip) * mBytesPerTexel;
|
||||
|
||||
U8* data = new U8[dataSize];
|
||||
PRESERVE_TEXTURE(mBinding);
|
||||
glBindTexture(mBinding, mHandle);
|
||||
glGetTexImage(mBinding, 0, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], data);
|
||||
glGetTexImage(mBinding, mip, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], data);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue