Qt 4.8
Public Functions | Protected Functions | Properties | List of all members
QGLCustomShaderStage Class Reference

#include <qglcustomshaderstage_p.h>

Inheritance diagram for QGLCustomShaderStage:
QGLCustomShaderEffectStage QGLPixmapBlurFilter QGLPixmapColorizeFilter QGLPixmapConvolutionFilter QGLPixmapDropShadowFilter

Public Functions

 QGLCustomShaderStage ()
 
void removeFromPainter (QPainter *)
 
void setInactive ()
 
bool setOnPainter (QPainter *)
 
virtual void setUniforms (QGLShaderProgram *)
 
void setUniformsDirty ()
 
QByteArray source () const
 
virtual ~QGLCustomShaderStage ()
 

Protected Functions

void setSource (const QByteArray &)
 

Properties

QGLCustomShaderStagePrivated_ptr
 

Detailed Description

Definition at line 65 of file qglcustomshaderstage_p.h.

Constructors and Destructors

◆ QGLCustomShaderStage()

QGLCustomShaderStage::QGLCustomShaderStage ( )

Definition at line 62 of file qglcustomshaderstage.cpp.

◆ ~QGLCustomShaderStage()

QGLCustomShaderStage::~QGLCustomShaderStage ( )
virtual

Definition at line 67 of file qglcustomshaderstage.cpp.

68 {
70  if (d->m_manager) {
71  d->m_manager->removeCustomStage();
72  d->m_manager->sharedShaders->cleanupCustomStage(this);
73  }
74 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Functions

◆ removeFromPainter()

void QGLCustomShaderStage::removeFromPainter ( QPainter p)

Definition at line 101 of file qglcustomshaderstage.cpp.

Referenced by QGLPixmapColorizeFilter::processGL(), QGLPixmapConvolutionFilter::processGL(), and QGLPixmapDropShadowFilter::processGL().

102 {
104  if (p->paintEngine()->type() != QPaintEngine::OpenGL2)
105  return;
106 
107  QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx*>(p->paintEngine());
109  Q_ASSERT(d->m_manager);
110 
111  // Just set the stage to null, don't call removeCustomStage().
112  // This should leave the program in a compiled/linked state
113  // if the next custom shader stage is this one again.
114  d->m_manager->setCustomStage(0);
115  d->m_manager = 0;
116 }
double d
Definition: qnumeric_p.h:62
static QGLEngineShaderManager * shaderManagerForEngine(QGL2PaintEngineEx *engine)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
Definition: qpainter.cpp:1991

◆ setInactive()

void QGLCustomShaderStage::setInactive ( )

Definition at line 126 of file qglcustomshaderstage.cpp.

Referenced by QGLEngineShaderManager::removeCustomStage().

127 {
129  d->m_manager = 0;
130 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setOnPainter()

bool QGLCustomShaderStage::setOnPainter ( QPainter p)

Definition at line 83 of file qglcustomshaderstage.cpp.

Referenced by QGLPixmapColorizeFilter::processGL(), QGLPixmapConvolutionFilter::processGL(), and QGLPixmapDropShadowFilter::processGL().

84 {
86  if (p->paintEngine()->type() != QPaintEngine::OpenGL2) {
87  qWarning("QGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2");
88  return false;
89  }
90  if (d->m_manager)
91  qWarning("Custom shader is already set on a painter");
92 
93  QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx*>(p->paintEngine());
95  Q_ASSERT(d->m_manager);
96 
97  d->m_manager->setCustomStage(this);
98  return true;
99 }
double d
Definition: qnumeric_p.h:62
static QGLEngineShaderManager * shaderManagerForEngine(QGL2PaintEngineEx *engine)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
Q_CORE_EXPORT void qWarning(const char *,...)
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
Definition: qpainter.cpp:1991

◆ setSource()

void QGLCustomShaderStage::setSource ( const QByteArray s)
protected

◆ setUniforms()

virtual void QGLCustomShaderStage::setUniforms ( QGLShaderProgram )
inlinevirtual

◆ setUniformsDirty()

void QGLCustomShaderStage::setUniformsDirty ( )

Definition at line 76 of file qglcustomshaderstage.cpp.

77 {
79  if (d->m_manager)
80  d->m_manager->setDirty(); // ### Probably a bit overkill!
81 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ source()

QByteArray QGLCustomShaderStage::source ( ) const

Definition at line 118 of file qglcustomshaderstage.cpp.

Referenced by QGLEngineSharedShaders::cleanupCustomStage(), and QGLEngineShaderManager::useCorrectShaderProg().

119 {
120  Q_D(const QGLCustomShaderStage);
121  return d->m_source;
122 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Properties

◆ d_ptr

QGLCustomShaderStagePrivate* QGLCustomShaderStage::d_ptr
private

Definition at line 84 of file qglcustomshaderstage_p.h.


The documentation for this class was generated from the following files: