| 37 | |
| 38 | namespace Ogre { |
| 39 | static inline void doImageIO(const String &name, const String &group, |
| 40 | const String &ext, |
| 41 | vector<Image>::type &images, |
| 42 | Texture *tex) |
| 43 | { |
| 44 | size_t imgIdx = images.size(); |
| 45 | images.push_back(Image()); |
| 46 | |
| 47 | DataStreamPtr dstream = |
| 48 | ResourceGroupManager::getSingleton().openResource( |
| 49 | name, group, true, tex); |
| 50 | |
| 51 | images[imgIdx].load(dstream, ext); |
| 52 | |
| 53 | if(!Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_NON_POWER_OF_2_TEXTURES) || |
| 54 | (Root::getSingleton().getRenderSystem()->getCapabilities()->getNonPOW2TexturesLimited() && tex->getNumMipmaps() > 0)) |
| 55 | { |
| 56 | size_t w = 0, h = 0; |
| 57 | |
| 58 | // Scale to nearest power of 2 |
| 59 | w = GLES2PixelUtil::optionalPO2(images[imgIdx].getWidth()); |
| 60 | h = GLES2PixelUtil::optionalPO2(images[imgIdx].getHeight()); |
| 61 | if((images[imgIdx].getWidth() != w) || (images[imgIdx].getHeight() != h)) |
| 62 | images[imgIdx].resize(w, h); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | GLES2Texture::GLES2Texture(ResourceManager* creator, const String& name, |
| 67 | ResourceHandle handle, const String& group, bool isManual, |
no test coverage detected