Merge pull request #4192 from samcake/temp0

Fix the missing textures not loaded in gpu::Texture because their size doesn't match their description
This commit is contained in:
Andrew Meadows 2015-01-29 17:13:46 -08:00
commit 3699a79e96
3 changed files with 11 additions and 3 deletions

View file

@ -45,7 +45,6 @@ ImageOverlay::~ImageOverlay() {
// TODO: handle setting image multiple times, how do we manage releasing the bound texture?
void ImageOverlay::setImageURL(const QUrl& url) {
_imageURL = url;
if (url.isEmpty()) {
_isLoaded = true;
_renderImage = false;

View file

@ -254,7 +254,16 @@ bool Texture::assignStoredMip(uint16 level, const Element& format, Size size, co
}
// THen check that the mem buffer passed make sense with its format
if (size == evalStoredMipSize(level, format)) {
Size expectedSize = evalStoredMipSize(level, format);
if (size == expectedSize) {
_storage->assignMipData(level, format, size, bytes);
_stamp++;
return true;
} else if (size > expectedSize) {
// NOTE: We are facing this case sometime because apparently QImage (from where we get the bits) is generating images
// and alligning the line of pixels to 32 bits.
// We should probably consider something a bit more smart to get the correct result but for now (UI elements)
// it seems to work...
_storage->assignMipData(level, format, size, bytes);
_stamp++;
return true;

View file

@ -387,7 +387,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr
if (!url.isValid()) {
_loaded = true;
}
// default to white/blue/black
/* glBindTexture(GL_TEXTURE_2D, getID());
switch (type) {