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  · 

QGLIndexBuffer Class

The QGLIndexBuffer class manages uploading of index arrays into a GL server. More...

 #include <QGLIndexBuffer>

This class was introduced in Qt 4.8.

Public Functions

QGLIndexBuffer()
QGLIndexBuffer(const QGLIndexBuffer & other)
~QGLIndexBuffer()
void append(const QGLIndexBuffer & buffer, uint offset)
void append(const QGLIndexBuffer & buffer, uint offset, QGL::DrawingMode combineMode)
bool bind()
QOpenGLBuffer buffer() const
GLenum elementType() const
int indexCount() const
QArray<uint> indexesUInt() const
QArray<ushort> indexesUShort() const
bool isEmpty() const
bool isUploaded() const
void release()
void replaceIndexes(int index, const QArray<ushort> & values)
void replaceIndexes(int index, const QArray<uint> & values)
void setIndexes(const QArray<ushort> & values)
void setIndexes(const QArray<uint> & values)
void setUsagePattern(QOpenGLBuffer::UsagePattern value)
bool upload()
QOpenGLBuffer::UsagePattern usagePattern() const
QGLIndexBuffer & operator=(const QGLIndexBuffer & other)

Detailed Description

The QGLIndexBuffer class manages uploading of index arrays into a GL server.

Member Function Documentation

QGLIndexBuffer::QGLIndexBuffer()

Creates a new index buffer.

QGLIndexBuffer::QGLIndexBuffer(const QGLIndexBuffer & other)

Creates a copy of other. Note that this just copies a reference to the index buffer. Any modifications to the copy will also affect the original object.

QGLIndexBuffer::~QGLIndexBuffer()

Destroys this index buffer if this object is the last reference to it.

void QGLIndexBuffer::append(const QGLIndexBuffer & buffer, uint offset)

Appends the contents of buffer to this index buffer and adds offset to all of the entries in buffer.

This function is typically used to combine multiple geometry meshes into a single mesh that can be bound as a single buffer.

The request is ignored if this index buffer or buffer have already been uploaded, or buffer is this index buffer.

See also isUploaded() and setIndexes().

void QGLIndexBuffer::append(const QGLIndexBuffer & buffer, uint offset, QGL::DrawingMode combineMode)

Appends the contents of buffer to this index buffer and adds offset to all of the entries in buffer.

The two buffers will be merged at the join point according to combineMode. For example, if combineMode is QGL::TriangleStrip, then the result will be a single triangle strip. Indexes are dropped from the front of buffer as necessary to correctly merge the buffers.

This function is typically used to combine multiple geometry meshes into a single mesh that can be bound as a single buffer.

The request is ignored if this index buffer or buffer have already been uploaded, or buffer is this index buffer.

See also isUploaded() and setIndexes().

bool QGLIndexBuffer::bind()

Binds this index buffer to the current GL context. Returns false if binding was not possible, usually because upload() has not been called.

The buffer must be bound to the same QOpenGLContext current when upload() was called, or to another QOpenGLContext that is sharing with it. Otherwise, false will be returned from this function.

See also release() and upload().

QOpenGLBuffer QGLIndexBuffer::buffer() const

Returns the QOpenGLBuffer in use by this index buffer object, so that its properties or contents can be modified directly.

See also isUploaded().

GLenum QGLIndexBuffer::elementType() const

Returns the element type for this index buffer, GL_UNSIGNED_SHORT or GL_UNSIGNED_INT.

int QGLIndexBuffer::indexCount() const

Returns the number of indexes in this index buffer.

QArray<uint> QGLIndexBuffer::indexesUInt() const

Returns the indexes in this buffer as an array of uint values.

Returns an empty array if type() is not GL_UNSIGNED_INT or the buffer has already been uploaded.

QArray<ushort> QGLIndexBuffer::indexesUShort() const

Returns the indexes in this buffer as an array of ushort values.

Returns an empty array if type() is not GL_UNSIGNED_SHORT or the buffer has already been uploaded.

bool QGLIndexBuffer::isEmpty() const

Returns true if indexCount() is zero; false otherwise.

bool QGLIndexBuffer::isUploaded() const

Returns true if the index data specified by previous a setIndexes() call has been uploaded into the GL server; false otherwise.

See also upload() and setIndexes().

void QGLIndexBuffer::release()

Releases this index buffer from the current GL context.

This function must be called with the same QOpenGLContext current as when bind() was called on the index buffer.

See also bind().

void QGLIndexBuffer::replaceIndexes(int index, const QArray<ushort> & values)

Replaces the elements of this index buffer, starting at index, with the contents of values. All other elements keep their current values.

If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer.

The index buffer must have been originally created with the ushort element type.

See also setIndexes().

void QGLIndexBuffer::replaceIndexes(int index, const QArray<uint> & values)

Replaces the elements of this index buffer, starting at index, with the contents of values. All other elements keep their current values.

If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer.

The index buffer must have been originally created with the int element type.

OpenGL/ES systems usually do not support 32-bit index values unless they have a special extension for that purpose. On systems without 32-bit index values, this function will need to convert all values to 16-bit which may incur a performance penalty and lose information.

See also setIndexes().

void QGLIndexBuffer::setIndexes(const QArray<ushort> & values)

Sets the index values in this index buffer, replacing the entire current contents.

If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer.

See also replaceIndexes().

void QGLIndexBuffer::setIndexes(const QArray<uint> & values)

Sets the index values in this index buffer, replacing the entire current contents.

If the index buffer has been uploaded to the GL server, then this function must be called with a current GL context that is compatible with the uploaded buffer.

OpenGL/ES systems usually do not support 32-bit index values unless they have a special extension for that purpose. On systems without 32-bit index values, this function will need to convert all values to 16-bit which may incur a performance penalty and lose information.

See also replaceIndexes().

void QGLIndexBuffer::setUsagePattern(QOpenGLBuffer::UsagePattern value)

Sets the usage pattern for this index buffer to value. This function must be called before upload() for the value to take effect.

See also usagePattern() and upload().

bool QGLIndexBuffer::upload()

Uploads the index data specified by a previous setIndexes() call into the GL server as an index buffer object.

Returns true if the data could be uploaded; false if index buffer objects are not supported or there is insufficient memory to complete the request. Returns true if the data was already uploaded.

Once the index data has been uploaded, the client-side copies of the data arrays will be released. If the index data could not be uploaded, then it is retained client-side. This way, regardless of whether the data could be uploaded or not, QGLPainter::draw() can be used to support drawing of primitives using this object.

See also isUploaded(), setIndexes(), and QGLPainter::draw().

QOpenGLBuffer::UsagePattern QGLIndexBuffer::usagePattern() const

Returns the usage pattern for this index buffer. The default value is QOpenGLBuffer::StaticDraw.

See also setUsagePattern().

QGLIndexBuffer & QGLIndexBuffer::operator=(const QGLIndexBuffer & other)

Assigns other to this object. Note that this just assigns a reference to the other index buffer. Any modifications to this object will also affect other.

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