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  · 

QGLAbstractEffect Class

The QGLAbstractEffect class provides a standard interface for rendering surface material effects with GL. More...

 #include <QGLAbstractEffect>

Inherited by: QGLShaderProgramEffect.

This class was introduced in Qt 4.8.

Public Functions

QGLAbstractEffect()
virtual ~QGLAbstractEffect()
virtual void setActive(QGLPainter * painter, bool flag) = 0
virtual bool supportsPicking() const
virtual void update(QGLPainter * painter, QGLPainter::Updates updates) = 0

Detailed Description

The QGLAbstractEffect class provides a standard interface for rendering surface material effects with GL.

Vertex attributes

Vertex attributes for the effect are specified using QGLPainter::setVertexAttribute() and QGLPainter::setVertexBundle(), and may be independent of the effect itself. Those functions will bind standard attributes to specific indexes within the GL state. For example, the QGL::Position will be bound to index 0, QGL::TextureCoord0 will be bound to index 3, etc.

Effect subclasses that use vertex shaders should bind their attributes to these indexes using QGLShaderProgram::bindAttributeLocation() just before the program is linked. For example:

 QGLShaderProgram *program = new QGLShaderProgram();
 program->addShaderFromSourceCode(QGLShader::Vertex, vshaderSource);
 program->addShaderFromSourceCode(QGLShader::Fragment, fshaderSource);
 program->bindAttributeLocation("vertex", QGL::Position);
 program->bindAttributeLocation("normal", QGL::Normal);
 program->bindAttributeLocation("texcoord", QGL::TextureCoord0);
 program->link();

The QGLShaderProgramEffect class can assist with writing shader-based effects. It will automatically bind special variable names, such as qt_Vertex, qt_MultiTexCoord0, etc, to the standard indexes. This alleviates the need for the application to bind the names itself.

Member Function Documentation

QGLAbstractEffect::QGLAbstractEffect()

Constructs a new effect object.

QGLAbstractEffect::~QGLAbstractEffect() [virtual]

Destroys this effect object.

void QGLAbstractEffect::setActive(QGLPainter * painter, bool flag) [pure virtual]

Activates or deactivates this effect on painter, according to flag, on the current GL context by selecting shader programs, setting lighting and material parameters, etc.

See also update().

bool QGLAbstractEffect::supportsPicking() const [virtual]

Returns true if this effect supports object picking; false otherwise. The default implementation returns false, which causes QGLPainter to use the effect associated with QGL::FlatColor to perform object picking.

Effects that support object picking render fragments with QGLPainter::pickColor() when QGLPainter::isPicking() returns true. By default, only the effect associated with QGL::FlatColor does this, rendering the entire fragment with the flat pick color.

In some cases, rendering the entire fragment with the pick color may not be appropriate. An alpha-blended icon texture that is drawn to the screen as a quad may have an irregular shape smaller than the quad. For picking, the application may not want the entire quad to be "active" for object selection as it would appear to allow the user to click off the icon to select it.

This situation can be handled by implementing an icon rendering effect that draws the icon normally when QGLPainter::isPicking() is false, and draws a mask texture defining the outline of the icon with QGLPainter::pickColor() when QGLPainter::isPicking() is true.

See also QGLPainter::setPicking().

void QGLAbstractEffect::update(QGLPainter * painter, QGLPainter::Updates updates) [pure virtual]

Updates the current GL context with information from painter just prior to the drawing of triangles, quads, etc.

The updates parameter specifies the properties on painter that have changed since the last call to update() or setActive().

See also setActive().

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