72 if (!qt_gl_texture_pool)
87 glGenTextures(1, &tex);
88 glBindTexture(target, tex);
90 glTexImage2D(target, level, internalformat, width, height, 0, format, type, 0);
97 qWarning(
"QGLTexturePool: cannot create temporary texture because of invalid params");
100 }
while (
reclaimSpace(internalformat, width, height, format, type, texture));
101 qWarning(
"QGLTexturePool: cannot reclaim sufficient space for a %dx%d texture",
109 GLint internalformat,
116 glBindTexture(target, tex);
118 glTexImage2D(target, level, internalformat, width, height, 0, format, type, data);
124 qWarning(
"QGLTexturePool: cannot create permanent texture because of invalid params");
127 }
while (
reclaimSpace(internalformat, width, height, format, type, 0));
128 qWarning(
"QGLTexturePool: cannot reclaim sufficient space for a %dx%d texture",
136 texture->inTexturePool =
true;
142 texture->inTexturePool =
false;
158 bool succeeded =
false;
159 bool wasInLRU =
false;
161 wasInLRU = texture->inLRU;
166 if (lrutexture && lrutexture != texture) {
174 if (texture && !wasInLRU)
186 texture->inTexturePool =
false;
187 texture->inLRU =
false;
188 texture->nextLRU = 0;
189 texture->prevLRU = 0;
203 if (texture->inLRU) {
204 if (!texture->prevLRU)
208 texture->inLRU =
true;
209 texture->nextLRU =
d->lruFirst;
210 texture->prevLRU = 0;
212 d->lruFirst->prevLRU = texture;
214 d->lruLast = texture;
215 d->lruFirst = texture;
223 if (texture->nextLRU)
224 texture->nextLRU->prevLRU = texture->prevLRU;
226 d->lruLast = texture->prevLRU;
227 if (texture->prevLRU)
228 texture->prevLRU->nextLRU = texture->nextLRU;
230 d->lruFirst = texture->nextLRU;
231 texture->inLRU =
false;
bool createPermanentTexture(GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data)
#define QT_END_NAMESPACE
This macro expands to.
void moveToHeadOfLRU(QGLTexture *texture)
static QGLTextureCache * instance()
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
void useTexture(QGLTexture *texture)
void removeFromLRU(QGLTexture *texture)
void detachTexture(QGLTexture *texture)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qWarning(const char *,...)
virtual ~QGLTexturePool()
static const char * data(const QByteArray &arr)
static QGLTexturePool * instance()
static QGLTexturePool * qt_gl_texture_pool
QPixmapData * boundPixmap
bool reclaimSpace(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, QGLTexture *data)
QGLTexture * textureLRU()
GLuint createTexture(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, QGLTexture *texture)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...