mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
Fixing the non loading of some texture because the QImage bit size is not exactly what's expected
This commit is contained in:
parent
838cb41646
commit
b2f16be92a
3 changed files with 23 additions and 4 deletions
|
@ -45,7 +45,6 @@ ImageOverlay::~ImageOverlay() {
|
||||||
// TODO: handle setting image multiple times, how do we manage releasing the bound texture?
|
// TODO: handle setting image multiple times, how do we manage releasing the bound texture?
|
||||||
void ImageOverlay::setImageURL(const QUrl& url) {
|
void ImageOverlay::setImageURL(const QUrl& url) {
|
||||||
_imageURL = url;
|
_imageURL = url;
|
||||||
|
|
||||||
if (url.isEmpty()) {
|
if (url.isEmpty()) {
|
||||||
_isLoaded = true;
|
_isLoaded = true;
|
||||||
_renderImage = false;
|
_renderImage = false;
|
||||||
|
@ -57,6 +56,8 @@ void ImageOverlay::setImageURL(const QUrl& url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageOverlay::render(RenderArgs* args) {
|
void ImageOverlay::render(RenderArgs* args) {
|
||||||
|
QString problem("http://s3.amazonaws.com/hifi-public/images/tools/grid-toolbar.svg");
|
||||||
|
bool theONE = (_imageURL == problem);
|
||||||
if (!_isLoaded && _renderImage) {
|
if (!_isLoaded && _renderImage) {
|
||||||
_isLoaded = true;
|
_isLoaded = true;
|
||||||
_texture = DependencyManager::get<TextureCache>()->getTexture(_imageURL);
|
_texture = DependencyManager::get<TextureCache>()->getTexture(_imageURL);
|
||||||
|
@ -69,8 +70,17 @@ void ImageOverlay::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, _texture->getID());
|
if (theONE) {
|
||||||
|
std::string name = _imageURL.toString().toStdString();
|
||||||
|
}
|
||||||
|
GLuint texID = _texture->getID();
|
||||||
|
if (texID == 27) {
|
||||||
|
std::string name = _imageURL.toString().toStdString();
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texID);
|
||||||
|
} else
|
||||||
|
glBindTexture(GL_TEXTURE_2D, _texture->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
const float MAX_COLOR = 255.0f;
|
const float MAX_COLOR = 255.0f;
|
||||||
|
|
|
@ -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
|
// 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);
|
_storage->assignMipData(level, format, size, bytes);
|
||||||
_stamp++;
|
_stamp++;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -387,7 +387,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr
|
||||||
if (!url.isValid()) {
|
if (!url.isValid()) {
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default to white/blue/black
|
// default to white/blue/black
|
||||||
/* glBindTexture(GL_TEXTURE_2D, getID());
|
/* glBindTexture(GL_TEXTURE_2D, getID());
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
Loading…
Reference in a new issue