mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:34:07 +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?
|
||||
void ImageOverlay::setImageURL(const QUrl& url) {
|
||||
_imageURL = url;
|
||||
|
||||
if (url.isEmpty()) {
|
||||
_isLoaded = true;
|
||||
_renderImage = false;
|
||||
|
@ -57,6 +56,8 @@ void ImageOverlay::setImageURL(const QUrl& url) {
|
|||
}
|
||||
|
||||
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) {
|
||||
_isLoaded = true;
|
||||
_texture = DependencyManager::get<TextureCache>()->getTexture(_imageURL);
|
||||
|
@ -69,8 +70,17 @@ void ImageOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
if (_renderImage) {
|
||||
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue