4#include <QtGui/qopengl.h>
5#include <QtGui/private/qopenglcontext_p.h>
6#include <QtCore/qatomic.h>
8#include <private/qopenglextensions_p.h>
10#ifndef GL_CONTEXT_LOST
11#define GL_CONTEXT_LOST 0x0507
183 if (d_ptr !=
other.d_ptr) {
184 other.d_ptr->ref.ref();
242 return d->usagePattern;
254 d->usagePattern =
d->actualUsagePattern =
value;
260 funcs->glDeleteBuffers(1, &
id);
280 if (
d->guard &&
d->guard->id())
307 return d->guard &&
d->guard->id();
338#if !QT_CONFIG(opengles2)
345 if (
error == GL_NO_ERROR)
351 return d->funcs->glGetError() == GL_NO_ERROR;
374 qWarning(
"QOpenGLBuffer::write(): buffer not created");
377 if (
d->guard &&
d->guard->id())
394 qWarning(
"QOpenGLBuffer::allocate(): buffer not created");
397 if (
d->guard &&
d->guard->id())
398 d->funcs->glBufferData(
d->type,
count,
data,
d->actualUsagePattern);
429 qWarning(
"QOpenGLBuffer::bind(): buffer not created");
436 qWarning(
"QOpenGLBuffer::bind: buffer is not valid in the current context");
460 qWarning(
"QOpenGLBuffer::release(): buffer not created");
463 if (
d->guard &&
d->guard->id())
464 d->funcs->glBindBuffer(
d->type, 0);
494 return d->guard ?
d->guard->id() : 0;
509 if (!
d->guard || !
d->guard->id())
539 qWarning(
"QOpenGLBuffer::map(): buffer not created");
541 if (!
d->guard || !
d->guard->id())
544 QOpenGLBuffer::RangeAccessFlags rangeAccess;
556 return d->funcs->glMapBufferRange(
d->type, 0,
size(), rangeAccess);
558 return d->funcs->glMapBuffer(
d->type,
access);
580 qWarning(
"QOpenGLBuffer::mapRange(): buffer not created");
582 if (!
d->guard || !
d->guard->id())
605 qWarning(
"QOpenGLBuffer::unmap(): buffer not created");
607 if (!
d->guard || !
d->guard->id())
609 return d->funcs->glUnmapBuffer(
d->type) == GL_TRUE;
QOpenGLBuffer::UsagePattern usagePattern
QOpenGLBuffer::UsagePattern actualUsagePattern
QOpenGLSharedResourceGuard * guard
QOpenGLBufferPrivate(QOpenGLBuffer::Type t)
QOpenGLExtensions * funcs
The QOpenGLBuffer class provides functions for creating and managing OpenGL buffer objects.
bool bind()
Binds the buffer associated with this object to the current OpenGL context.
void write(int offset, const void *data, int count)
Replaces the count bytes of this buffer starting at offset with the contents of data.
bool unmap()
Unmaps the buffer after it was mapped into the application's memory space with a previous call to map...
bool read(int offset, void *data, int count)
Reads the count bytes in this buffer starting at offset into data.
GLuint bufferId() const
Returns the OpenGL identifier associated with this buffer; zero if the buffer has not been created.
bool create()
Creates the buffer object in the OpenGL server.
void * mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access)
Maps the range specified by offset and count of the contents of this buffer into the application's me...
Access
This enum defines the access mode for QOpenGLBuffer::map().
QOpenGLBuffer()
Constructs a new buffer object of type QOpenGLBuffer::VertexBuffer.
~QOpenGLBuffer()
Destroys this buffer object, including the storage being used in the OpenGL server.
bool isCreated() const
Returns true if this buffer has been created; false otherwise.
void allocate(const void *data, int count)
Allocates count bytes of space to the buffer, initialized to the contents of data.
void destroy()
Destroys this buffer object, including the storage being used in the OpenGL server.
void setUsagePattern(QOpenGLBuffer::UsagePattern value)
Sets the usage pattern for this buffer object to value.
QOpenGLBuffer::Type type() const
Returns the type of buffer represented by this object.
int size() const
Returns the size of the data in this buffer, for reading operations.
UsagePattern
This enum defines the usage pattern of a QOpenGLBuffer object.
QOpenGLBuffer & operator=(const QOpenGLBuffer &other)
Assigns a shallow copy of other to this object.
Type
This enum defines the type of OpenGL buffer object to create with QOpenGLBuffer.
void release()
Releases the buffer associated with this object from the current OpenGL context.
QOpenGLBuffer::UsagePattern usagePattern() const
Returns the usage pattern for this buffer object.
void * map(QOpenGLBuffer::Access access)
Maps the contents of this buffer into the application's memory space and returns a pointer to it.
static QOpenGLContextGroup * currentContextGroup()
Returns the QOpenGLContextGroup corresponding to the current context.
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
The QOpenGLSharedResourceGuard class is a convenience sub-class of QOpenGLSharedResource to be used t...
static VulkanServerBufferGlFunctions * funcs
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
typedef GLint(GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)(GLuint program
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset