Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QGLShader Class

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

 #include <QGLShader>

Inherits: QObject.

This class was introduced in Qt 4.6.

Public Types

flags ShaderType
enum ShaderTypeBit { Vertex, Fragment, Geometry }

Public Functions

QGLShader(QGLShader::ShaderType type, QObject * parent = 0)
QGLShader(QGLShader::ShaderType type, const QGLContext * context, QObject * parent = 0)
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
  • 31 public functions inherited from QObject

Static Public Members

bool hasOpenGLShaders(ShaderType type, const QGLContext * context = 0)
  • 11 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 2 signal inherited from QObject
  • 9 protected functions inherited from QObject

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 Type Documentation

enum QGLShader::ShaderTypeBit
flags QGLShader::ShaderType

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::Geometry0x0004Geometry shaders written in the OpenGL Shading Language (GLSL), based on the GL_EXT_geometry_shader4 extension.

The ShaderType type is a typedef for QFlags<ShaderTypeBit>. It stores an OR combination of ShaderTypeBit values.

Member Function Documentation

QGLShader::QGLShader(QGLShader::ShaderType type, QObject * parent = 0)

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() and compileSourceFile().

QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext * context, QObject * parent = 0)

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() and 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.

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 = 0) [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.

This function was introduced in Qt 4.7.

bool QGLShader::isCompiled() const

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

See also compileSourceCode() and compileSourceFile().

QString QGLShader::log() const

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

See also compileSourceCode() and 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().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web