StelTextureMgr.cpp   StelTextureMgr.cpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "StelApp.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include <QHttp> #include <QHttp>
#include <QFileInfo> #include <QFileInfo>
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
#include <QNetworkRequest>
#include <QThread> #include <QThread>
#include <QSettings> #include <QSettings>
#include <QGLFormat> #include <QGLFormat>
#include <cstdlib> #include <cstdlib>
StelTextureMgr::StelTextureMgr() StelTextureMgr::StelTextureMgr()
{ {
// This thread is doing nothing but will contains all the loader obj
ects.
loaderThread = new QThread(this);
loaderThread->start(QThread::LowestPriority);
} }
StelTextureMgr::~StelTextureMgr() StelTextureMgr::~StelTextureMgr()
{ {
// Hopefully this doesn't take much time.
loaderThread->quit();
loaderThread->wait();
} }
void StelTextureMgr::init() void StelTextureMgr::init()
{ {
StelPainter::makeMainGLContextCurrent();
isNoPowerOfTwoAllowed = QGLFormat::openGLVersionFlags().testFlag(QGL
Format::OpenGL_Version_2_0) || QGLFormat::openGLVersionFlags().testFlag(QGL
Format::OpenGL_ES_Version_2_0);
} }
StelTextureSP StelTextureMgr::createTexture(const QString& afilename, const StelTexture::StelTextureParams& params) StelTextureSP StelTextureMgr::createTexture(const QString& afilename, const StelTexture::StelTextureParams& params)
{ {
if (afilename.isEmpty()) if (afilename.isEmpty())
return StelTextureSP(); return StelTextureSP();
StelTextureSP tex = StelTextureSP(new StelTexture()); StelTextureSP tex = StelTextureSP(new StelTexture());
try try
{ {
skipping to change at line 146 skipping to change at line 152
tex->fullPath = url; tex->fullPath = url;
if (fileExtension.isEmpty()) if (fileExtension.isEmpty())
{ {
const int idx = url.lastIndexOf('.'); const int idx = url.lastIndexOf('.');
if (idx!=-1) if (idx!=-1)
tex->fileExtension = url.right(url.size()-id x-1); tex->fileExtension = url.right(url.size()-id x-1);
} }
} }
if (!fileExtension.isEmpty()) if (!fileExtension.isEmpty())
tex->fileExtension = fileExtension; tex->fileExtension = fileExtension;
if (!lazyLoading) if (!lazyLoading)
{ {
StelPainter::makeMainGLContextCurrent(); StelPainter::makeMainGLContextCurrent();
tex->bind(); tex->bind();
} }
return tex; return tex;
} }
 End of changes. 6 change blocks. 
4 lines changed or deleted 10 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/