| 257 | } |
| 258 | |
| 259 | bool 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 | |
| 287 | bool GFXGLTextureManager::_loadTexture(GFXTextureObject *aTexture, DDSFile *dds) |
| 288 | { |
no test coverage detected