CopperSpice API  1.7.2
QGLShader Class Reference

The QGLShader class allows OpenGL shaders to be compiled. More...

Inheritance diagram for QGLShader:
QObject

Public Typedefs

using ShaderType = QFlags< ShaderTypeBit >
 

Public Types

enum  ShaderTypeBit
 

Public Methods

 QGLShader (QGLShader::ShaderType type, const QGLContext *context, QObject *parent=nullptr)
 
 QGLShader (QGLShader::ShaderType type, QObject *parent=nullptr)
 
virtual ~QGLShader ()
 
bool compileSourceCode (const char *source)
 
bool compileSourceCode (const QByteArray &source)
 
bool compileSourceCode (const QString &source)
 
bool compileSourceFile (const QString &fileName)
 
bool isCompiled () const
 
QString log () const
 
GLuint shaderId () const
 
QGLShader::ShaderType shaderType () const
 
QByteArray sourceCode () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Static Public Methods

static bool hasOpenGLShaders (ShaderType type, const QGLContext *context=nullptr)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Friends

class QGLShaderProgram
 

Additional Inherited Members

- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The QGLShader class allows OpenGL shaders to be compiled.

This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).

QGLShader and QGLShaderProgram shelter the programmer from the details of compiling and linking vertex and fragment shaders.

See also
QGLShaderProgram

Member Typedef Documentation

Typedef for QFlags<ShaderTypeBit>. Refer to QGLShader::ShaderTypeBit for documentation.

Member Enumeration Documentation

This enum specifies the type of QGLShader that is being created.

ConstantValueDescription
QGLShader::Vertex0x0001Vertex shader written in the OpenGL Shading Language (GLSL).
QGLShader::Fragment0x0002Fragment shader written in the OpenGL Shading Language (GLSL).
QGLShader::Geometry0x0004 Geometry shaders written in the OpenGL Shading Language (GLSL), based on the GL_EXT_geometry_shader4 extension.

Constructor & Destructor Documentation

QGLShader::QGLShader ( QGLShader::ShaderType  type,
QObject parent = nullptr 
)
explicit

Constructs a new QGLShader object of the specified type and attaches it to parent. If shader programs are not supported, QGLShaderProgram::hasOpenGLShaderPrograms() will return false.

This constructor is normally followed by a call to compileSourceCode() or compileSourceFile().

The shader will be associated with the current QGLContext.

See also
compileSourceCode(), compileSourceFile()
QGLShader::QGLShader ( QGLShader::ShaderType  type,
const QGLContext context,
QObject parent = nullptr 
)

Constructs a new QGLShader object of the specified type and attaches it to parent. If shader programs are not supported, then QGLShaderProgram::hasOpenGLShaderPrograms() will return false.

This constructor is normally followed by a call to compileSourceCode() or compileSourceFile().

The shader will be associated with context.

See also
compileSourceCode(), compileSourceFile()
QGLShader::~QGLShader ( )
virtual

Deletes this shader. If the shader has been attached to a QGLShaderProgram object, then the actual shader will stay around until the QGLShaderProgram is destroyed.

Method Documentation

bool QGLShader::compileSourceCode ( const char *  source)

Sets the source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise.

See also
compileSourceFile()
bool QGLShader::compileSourceCode ( const QByteArray source)

This is an overloaded function.

Sets the source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise.

See also
compileSourceFile()
bool QGLShader::compileSourceCode ( const QString source)

This is an overloaded function.

Sets the source code for this shader and compiles it. Returns true if the source was successfully compiled, false otherwise.

See also
compileSourceFile()
bool QGLShader::compileSourceFile ( const QString fileName)

Sets the source code for this shader to the contents of fileName and compiles it. Returns true if the file could be opened and the source compiled, false otherwise.

See also
compileSourceCode()
bool QGLShader::hasOpenGLShaders ( ShaderType  type,
const QGLContext context = nullptr 
)
static

Returns true if shader programs of type type are supported on this system; false otherwise.

The context is used to resolve the GLSL extensions. If context is null, then QGLContext::currentContext() is used.

bool QGLShader::isCompiled ( ) const

Returns true if this shader has been compiled; false otherwise.

See also
compileSourceCode(), compileSourceFile()
QString QGLShader::log ( ) const

Returns the errors and warnings that occurred during the last compile.

See also
compileSourceCode(), compileSourceFile()
GLuint QGLShader::shaderId ( ) const

Returns the OpenGL identifier associated with this shader.

See also
QGLShaderProgram::programId()
QGLShader::ShaderType QGLShader::shaderType ( ) const

Returns the type of this shader.

QByteArray QGLShader::sourceCode ( ) const

Returns the source code for this shader.

See also
compileSourceCode()