43 #if !defined(QT_OPENGL_ES_1) 46 #define QGL_HAVE_CUSTOM_SHADERS 1 48 #include <QtGui/qpainter.h> 49 #include <QtGui/qgraphicsitem.h> 50 #include <QtGui/private/qgraphicseffect_p.h> 131 lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { \ 132 return texture2D(imageTexture, textureCoords); \ 135 #ifdef QGL_HAVE_CUSTOM_SHADERS 167 , customShaderStage(0)
173 #ifdef QGL_HAVE_CUSTOM_SHADERS 191 #ifdef QGL_HAVE_CUSTOM_SHADERS 193 delete d->customShaderStage;
208 return d->pixelShaderFragment;
232 if (
d->pixelShaderFragment != code) {
233 d->pixelShaderFragment = code;
234 #ifdef QGL_HAVE_CUSTOM_SHADERS 235 delete d->customShaderStage;
236 d->customShaderStage = 0;
248 #ifdef QGL_HAVE_CUSTOM_SHADERS 252 if (!
d->customShaderStage) {
254 (
this,
d->pixelShaderFragment);
256 bool usingShader =
d->customShaderStage->setOnPainter(painter);
274 d->customShaderStage->removeFromPainter(painter);
292 #ifdef QGL_HAVE_CUSTOM_SHADERS 294 if (
d->customShaderStage)
295 d->customShaderStage->setUniformsDirty();
The QPainter class performs low-level painting on widgets and other paint devices.
bool sourceIsPixmap() const
Returns true if the source effectively is a pixmap, e.g., a QGraphicsPixmapItem.
QPixmap sourcePixmap(Qt::CoordinateSystem system=Qt::LogicalCoordinates, QPoint *offset=0, PixmapPadMode mode=PadToEffectiveBoundingRect) const
Returns a pixmap with the source painted into it.
#define QT_END_NAMESPACE
This macro expands to.
QGraphicsShaderEffectPrivate()
The QByteArray class provides an array of bytes.
QGLCustomShaderEffectStage(QGraphicsShaderEffect *e, const QByteArray &source)
void drawSource(QPainter *painter)
Draws the source directly using the given painter.
virtual ~QGraphicsShaderEffect()
The QObject class is the base class of all Qt objects.
friend class QGLCustomShaderEffectStage
QGraphicsShaderEffect(QObject *parent=0)
void setSource(const QByteArray &)
void setUniforms(QGLShaderProgram *program)
QByteArray source() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
QGLCustomShaderEffectStage * customShaderStage
static const char qglslDefaultImageFragmentShader[]
void draw(QPainter *painter)
This pure virtual function draws the effect and is called whenever the source needs to be drawn...
#define Q_DECLARE_PUBLIC(Class)
const QTransform & worldTransform() const
Returns the world transformation matrix.
#define QGL_HAVE_CUSTOM_SHADERS
virtual void setUniforms(QGLShaderProgram *program)
QGraphicsShaderEffect * effect
The QPoint class defines a point in the plane using integer precision.
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
void setPixelShaderFragment(const QByteArray &code)
The QPixmap class is an off-screen image representation that can be used as a paint device...
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
QByteArray pixelShaderFragment() const
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QByteArray pixelShaderFragment
The QGraphicsEffect class is the base class for all graphics effects.