2011-07-18 19:55:39 +04:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee>
|
|
|
|
Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
Copyright (C) 2011 Philipp Knechtges <philipp-dev@knechtges.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_GLTEXTURE_P_H
|
|
|
|
#define KWIN_GLTEXTURE_P_H
|
|
|
|
|
|
|
|
#include "kwinconfig.h" // KWIN_HAVE_OPENGL
|
2013-12-03 13:43:57 +04:00
|
|
|
#include <kwinglutils_export.h>
|
2011-07-18 19:55:39 +04:00
|
|
|
|
2013-02-26 12:00:51 +04:00
|
|
|
#include <QSize>
|
|
|
|
#include <QSharedData>
|
2013-02-26 11:02:27 +04:00
|
|
|
#include <QImage>
|
2011-07-18 19:55:39 +04:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2013-02-26 11:02:27 +04:00
|
|
|
// forward declarations
|
|
|
|
class GLVertexBuffer;
|
2011-07-18 19:55:39 +04:00
|
|
|
|
2013-12-03 13:43:57 +04:00
|
|
|
class KWINGLUTILS_EXPORT GLTexturePrivate
|
2011-07-18 19:55:39 +04:00
|
|
|
: public QSharedData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLTexturePrivate();
|
|
|
|
virtual ~GLTexturePrivate();
|
|
|
|
|
2012-01-07 15:12:29 +04:00
|
|
|
virtual void onDamage();
|
2011-07-18 19:55:39 +04:00
|
|
|
|
2012-09-27 23:22:05 +04:00
|
|
|
void updateMatrix();
|
|
|
|
|
2011-07-18 19:55:39 +04:00
|
|
|
GLuint m_texture;
|
|
|
|
GLenum m_target;
|
2014-12-13 16:28:33 +03:00
|
|
|
GLenum m_internalFormat;
|
2011-07-18 19:55:39 +04:00
|
|
|
GLenum m_filter;
|
2012-01-07 15:12:29 +04:00
|
|
|
GLenum m_wrapMode;
|
2011-07-18 19:55:39 +04:00
|
|
|
QSize m_size;
|
|
|
|
QSizeF m_scale; // to un-normalize GL_TEXTURE_2D
|
2012-09-27 23:22:05 +04:00
|
|
|
QMatrix4x4 m_matrix[2];
|
|
|
|
bool m_yInverted; // texture is y-inverted
|
2011-07-18 19:55:39 +04:00
|
|
|
bool m_canUseMipmaps;
|
2012-01-07 15:12:29 +04:00
|
|
|
bool m_markedDirty;
|
|
|
|
bool m_filterChanged;
|
|
|
|
bool m_wrapModeChanged;
|
2014-12-10 22:31:53 +03:00
|
|
|
bool m_immutable;
|
2014-12-10 22:26:23 +03:00
|
|
|
int m_mipLevels;
|
2011-07-18 19:55:39 +04:00
|
|
|
|
|
|
|
int m_unnormalizeActive; // 0 - no, otherwise refcount
|
|
|
|
int m_normalizeActive; // 0 - no, otherwise refcount
|
|
|
|
GLVertexBuffer* m_vbo;
|
|
|
|
QSize m_cachedSize;
|
|
|
|
|
|
|
|
static void initStatic();
|
|
|
|
|
2014-11-22 18:24:26 +03:00
|
|
|
static bool s_supportsFramebufferObjects;
|
2014-11-22 18:44:14 +03:00
|
|
|
static bool s_supportsARGB32;
|
2014-11-22 18:17:51 +03:00
|
|
|
static bool s_supportsUnpack;
|
2014-12-10 22:31:53 +03:00
|
|
|
static bool s_supportsTextureStorage;
|
2014-11-22 18:24:26 +03:00
|
|
|
static GLuint s_fbo;
|
2013-09-05 23:10:13 +04:00
|
|
|
static uint s_textureObjectCounter;
|
2011-07-18 19:55:39 +04:00
|
|
|
private:
|
2014-04-10 20:04:54 +04:00
|
|
|
friend void KWin::cleanupGL();
|
|
|
|
static void cleanup();
|
2011-07-18 19:55:39 +04:00
|
|
|
Q_DISABLE_COPY(GLTexturePrivate)
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2011-08-31 20:16:21 +04:00
|
|
|
#endif
|