• PySide 模块
  • PySide.QtOpenGL
  • 内容表

    上一话题

    QGLFramebufferObjectFormat

    下一话题

    QGLContext

    QGLBuffer

    注意

    This class was introduced in Qt 4.7

    概要

    函数

    静态函数

    详细描述

    PySide.QtOpenGL.QGLBuffer class provides functions for creating and managing GL buffer objects.

    Buffer objects are created in the GL server so that the client application can avoid uploading vertices, indices, texture image data, etc every time they are needed.

    PySide.QtOpenGL.QGLBuffer objects can be copied around as a reference to the underlying GL buffer object:

    QGLBuffer buffer1(QGLBuffer::IndexBuffer);
    buffer1.create();
    QGLBuffer buffer2 = buffer1;
    									

    PySide.QtOpenGL.QGLBuffer performs a shallow copy when objects are copied in this manner, but does not implement copy-on-write semantics. The original object will be affected whenever the copy is modified.

    class PySide.QtOpenGL. QGLBuffer
    class PySide.QtOpenGL. QGLBuffer ( type )
    class PySide.QtOpenGL. QGLBuffer ( other )
    参数:

    Constructs a new buffer object of type QGLBuffer.VertexBuffer .

    Note: this constructor just creates the PySide.QtOpenGL.QGLBuffer instance. The actual buffer object in the GL server is not created until PySide.QtOpenGL.QGLBuffer.create() 被调用。

    Constructs a shallow copy of other .

    注意: PySide.QtOpenGL.QGLBuffer does not implement copy-on-write semantics, so other will be affected whenever the copy is modified.

    PySide.QtOpenGL.QGLBuffer. Access

    This enum defines the access mode for QGLBuffer.map() .

    常量 描述
    QGLBuffer.ReadOnly The buffer will be mapped for reading only.
    QGLBuffer.WriteOnly The buffer will be mapped for writing only.
    QGLBuffer.ReadWrite The buffer will be mapped for reading and writing.

    注意

    This enum was introduced or modified in Qt 4.7

    PySide.QtOpenGL.QGLBuffer. UsagePattern

    This enum defines the usage pattern of a PySide.QtOpenGL.QGLBuffer 对象。

    常量 描述
    QGLBuffer.StreamDraw The data will be set once and used a few times for drawing operations. Under OpenGL/ES 1.1 this is identical to StaticDraw .
    QGLBuffer.StreamRead The data will be set once and used a few times for reading data back from the GL server. Not supported under OpenGL/ES.
    QGLBuffer.StreamCopy The data will be set once and used a few times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.
    QGLBuffer.StaticDraw The data will be set once and used many times for drawing operations.
    QGLBuffer.StaticRead The data will be set once and used many times for reading data back from the GL server. Not supported under OpenGL/ES.
    QGLBuffer.StaticCopy The data will be set once and used many times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.
    QGLBuffer.DynamicDraw The data will be modified repeatedly and used many times for drawing operations.
    QGLBuffer.DynamicRead The data will be modified repeatedly and used many times for reading data back from the GL server. Not supported under OpenGL/ES.
    QGLBuffer.DynamicCopy The data will be modified repeatedly and used many times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.

    注意

    This enum was introduced or modified in Qt 4.7

    PySide.QtOpenGL.QGLBuffer. Type

    This enum defines the type of GL buffer object to create with PySide.QtOpenGL.QGLBuffer .

    常量 描述
    QGLBuffer.VertexBuffer Vertex buffer object for use when specifying vertex arrays.
    QGLBuffer.IndexBuffer Index buffer object for use with glDrawElements() .
    QGLBuffer.PixelPackBuffer Pixel pack buffer object for reading pixel data from the GL server (for example, with glReadPixels() ). Not supported under OpenGL/ES.
    QGLBuffer.PixelUnpackBuffer Pixel unpack buffer object for writing pixel data to the GL server (for example, with glTexImage2D() ). Not supported under OpenGL/ES.

    注意

    This enum was introduced or modified in Qt 4.7

    PySide.QtOpenGL.QGLBuffer. allocate ( data [ , count=-1 ] )
    参数:
    • data void
    • count PySide.QtCore.int

    Allocates count bytes of space to the buffer, initialized to the contents of data . Any previous contents will be removed.

    It is assumed that PySide.QtOpenGL.QGLBuffer.create() has been called on this buffer and that it has been bound to the current context.

    PySide.QtOpenGL.QGLBuffer. allocate ( count )
    参数: count PySide.QtCore.int

    这是重载函数。

    Allocates count bytes of space to the buffer. Any previous contents will be removed.

    It is assumed that PySide.QtOpenGL.QGLBuffer.create() has been called on this buffer and that it has been bound to the current context.

    PySide.QtOpenGL.QGLBuffer. bind ( )
    返回类型: PySide.QtCore.bool

    Binds the buffer associated with this object to the current GL context. Returns false if binding was not possible, usually because PySide.QtOpenGL.QGLBuffer.type() is not supported on this GL implementation.

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

    PySide.QtOpenGL.QGLBuffer. bufferId ( )
    返回类型: PySide.QtOpenGL.GLuint

    Returns the GL identifier associated with this buffer; zero if the buffer has not been created.

    PySide.QtOpenGL.QGLBuffer. create ( )
    返回类型: PySide.QtCore.bool

    Creates the buffer object in the GL server. Returns true if the object was created; false otherwise.

    This function must be called with a current PySide.QtOpenGL.QGLContext . The buffer will be bound to and can only be used in that context (or any other context that is shared with it).

    This function will return false if the GL implementation does not support buffers, or there is no current PySide.QtOpenGL.QGLContext .

    PySide.QtOpenGL.QGLBuffer. destroy ( )

    Destroys this buffer object, including the storage being used in the GL server. All references to the buffer will become invalid.

    PySide.QtOpenGL.QGLBuffer. isCreated ( )
    返回类型: PySide.QtCore.bool

    Returns true if this buffer has been created; false otherwise.

    PySide.QtOpenGL.QGLBuffer. map ( access )
    参数: access PySide.QtOpenGL.QGLBuffer.Access
    返回类型: void
    PySide.QtOpenGL.QGLBuffer. read ( offset , count )
    参数:
    • offset PySide.QtCore.int
    • count PySide.QtCore.int
    返回类型:

    (retval, data)

    读取 count bytes in this buffer starting at offset into data . Returns true on success; false if reading from the buffer is not supported. Buffer reading is not supported under OpenGL/ES.

    It is assumed that this buffer has been bound to the current context.

    static PySide.QtOpenGL.QGLBuffer. release ( type )
    参数: type PySide.QtOpenGL.QGLBuffer.Type
    PySide.QtOpenGL.QGLBuffer. release ( )

    Releases the buffer associated with this object from the current GL context.

    This function must be called with the same PySide.QtOpenGL.QGLContext current as when PySide.QtOpenGL.QGLBuffer.bind() was called on the buffer.

    PySide.QtOpenGL.QGLBuffer. setUsagePattern ( value )
    参数: value PySide.QtOpenGL.QGLBuffer.UsagePattern
    PySide.QtOpenGL.QGLBuffer. size ( )
    返回类型: PySide.QtCore.int

    Returns the size of the data in this buffer, for reading operations. Returns -1 if fetching the buffer size is not supported, or the buffer has not been created.

    It is assumed that this buffer has been bound to the current context.

    PySide.QtOpenGL.QGLBuffer. type ( )
    返回类型: PySide.QtOpenGL.QGLBuffer.Type

    Returns the type of buffer represented by this object.

    PySide.QtOpenGL.QGLBuffer. unmap ( )
    返回类型: PySide.QtCore.bool

    Unmaps the buffer after it was mapped into the application's memory space with a previous call to PySide.QtOpenGL.QGLBuffer.map() . Returns true if the unmap succeeded; false otherwise.

    It is assumed that this buffer has been bound to the current context, and that it was previously mapped with PySide.QtOpenGL.QGLBuffer.map() .

    This function is only supported under OpenGL/ES if the GL_OES_mapbuffer extension is present.

    PySide.QtOpenGL.QGLBuffer. usagePattern ( )
    返回类型: PySide.QtOpenGL.QGLBuffer.UsagePattern

    Returns the usage pattern for this buffer object. The default value is StaticDraw .

    PySide.QtOpenGL.QGLBuffer. write ( offset , data [ , count=-1 ] )
    参数:
    • offset PySide.QtCore.int
    • data void
    • count PySide.QtCore.int

    Replaces the count bytes of this buffer starting at offset with the contents of data . Any other bytes in the buffer will be left unmodified.

    It is assumed that PySide.QtOpenGL.QGLBuffer.create() has been called on this buffer and that it has been bound to the current context.