StelTexture.cpp   StelTexture.cpp 
skipping to change at line 22 skipping to change at line 22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "StelTexture.hpp" #include "StelTexture.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "glues.h"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include <QImageReader> #include <QImageReader>
#include <QSize> #include <QSize>
#include <QDebug> #include <QDebug>
#include <QUrl> #include <QUrl>
#include <QImage> #include <QImage>
#include <QNetworkReply> #include <QNetworkReply>
#include <QtEndian> #include <QtEndian>
#include <QFuture> #include <QFuture>
#include <QtConcurrent> #include <QtConcurrent>
#include <cstdlib> #include <cstdlib>
StelTexture::StelTexture(StelTextureMgr *mgr) : textureMgr(mgr), networkRep StelTexture::StelTexture(StelTextureMgr *mgr) : textureMgr(mgr), networkRep
ly(NULL), loader(NULL), errorOccured(false), alphaChannel(false), id(0), av ly(NULL), loader(NULL), errorOccured(false), alphaChannel(false), id(0), av
gLuminance(-1.f), glSize(0) gLuminance(-1.f),
width(-1), height(-1), glSize(0)
{ {
width = -1;
height = -1;
} }
StelTexture::~StelTexture() StelTexture::~StelTexture()
{ {
if (id != 0 && QOpenGLContext::currentContext()) if (id != 0)
{ {
//make sure the correct GL context is bound!
StelApp::getInstance().ensureGLContextCurrent();
if (glIsTexture(id)==GL_FALSE) if (glIsTexture(id)==GL_FALSE)
{ {
qDebug() << "WARNING: in StelTexture::~StelTexture() GLenum err = glGetError();
tried to delete invalid texture with ID=" << id << "Current GL ERROR statu qWarning() << "WARNING: in StelTexture::~StelTexture
s is" << glGetError() << "(" << getGLErrorText(glGetError()) << ")"; () tried to delete invalid texture with ID=" << id << "Current GL ERROR sta
tus is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")";
} }
else else
{ {
glDeleteTextures(1, &id); glDeleteTextures(1, &id);
textureMgr->glMemoryUsage -= glSize; textureMgr->glMemoryUsage -= glSize;
glSize = 0; glSize = 0;
} }
#ifndef NDEBUG #ifndef NDEBUG
qDebug()<<"Deleted StelTexture"<<id<<", total memory usage " <<textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB"; qDebug()<<"Deleted StelTexture"<<id<<", total memory usage " <<textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB";
#endif #endif
skipping to change at line 281 skipping to change at line 283
{ {
if (data.data.isEmpty()) if (data.data.isEmpty())
{ {
reportError("Unknown error"); reportError("Unknown error");
return false; return false;
} }
width = data.width; width = data.width;
height = data.height; height = data.height;
//make sure the correct GL context is bound!
StelApp::getInstance().ensureGLContextCurrent();
initializeOpenGLFunctions();
//check minimum texture size //check minimum texture size
GLint maxSize; GLint maxSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE,&maxSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE,&maxSize);
if(maxSize < width || maxSize < height) if(maxSize < width || maxSize < height)
{ {
reportError(QString("Texture size (%1/%2) is larger than GL_ MAX_TEXTURE_SIZE (%3)!").arg(width).arg(height).arg(maxSize)); reportError(QString("Texture size (%1/%2) is larger than GL_ MAX_TEXTURE_SIZE (%3)!").arg(width).arg(height).arg(maxSize));
return false; return false;
} }
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
 End of changes. 7 change blocks. 
10 lines changed or deleted 16 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/