Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/StelQGLTextureBackend_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 08:00:16 2014
Кодировка:

Поисковые слова: jet
Stellarium: core/renderer/StelQGLTextureBackend.hpp Source File
Stellarium 0.12.3
StelQGLTextureBackend.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2012 Ferdinand Majerech
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELQGLTEXTUREBACKEND_HPP_
21 #define _STELQGLTEXTUREBACKEND_HPP_
22 
23 #include "StelGLUtilityFunctions.hpp"
24 #include "StelRenderer.hpp"
25 #include "StelTextureBackend.hpp"
26 
27 
32 {
33 Q_OBJECT
34 public:
37 
39  void bind(const int textureUnit);
40 
47 
56  (class StelQGLRenderer* renderer, const QString& path,
57  const TextureParams& params, QImage& image);
58 
69  (class StelQGLRenderer* renderer, const QString& path, const TextureParams& params);
70 
81  (class StelQGLRenderer* renderer, const QString& path, const TextureParams& params);
82 
94  (StelQGLRenderer* renderer, class QGLFramebufferObject* fbo);
95 
109  (StelQGLRenderer* renderer, const QSize viewportSize, const QGLFormat& viewportFormat);
110 
122  (StelQGLRenderer* renderer, const void* data, const QSize size,
123  const TextureDataFormat format, const TextureParams& params);
124 private slots:
126  void onImageLoaded(QImage image);
127 
129  void onLoadingError(const QString& errorMessage) ;
130 
131 private:
133  TextureParams textureParams;
134 
136  class StelQGLRenderer* renderer;
137 
139  GLuint glTextureID;
140 
145  bool ownsTexture;
146 
149  bool deleteManually;
150 
152  class StelTextureLoader* loader;
153 
158  float pixelBytes;
159 
168  StelQGLTextureBackend(class StelQGLRenderer* renderer, const QString& path,
169  const TextureParams& params);
170 
172  void loadFromImage(QImage image);
173 
175  void loadFromPVR();
176 
178  QGLContext* prepareContextForLoading();
179 
181  void completeLoading();
182 
184  void setTextureWrapping();
185 
187  void invariant() const
188  {
189 #ifndef NDEBUG
190  const TextureStatus status = getStatus();
191  if((glTextureID != 0) != (status == TextureStatus_Loaded))
192  {
193  qDebug() << "Handle: " << glTextureID << " Status: " << textureStatusName(status);
194  Q_ASSERT_X(false, Q_FUNC_INFO, "Texture can be specified if and only if loaded.");
195  }
196 
197  Q_ASSERT_X(loader == NULL || status == TextureStatus_Loading,
198  Q_FUNC_INFO, "Texture loader can only exist during loading");
199 #endif
200  }
201 };
202 #endif // _STELQGLTEXTUREBACKEND_HPP_