Skip to content

PythonQt.QtOpenGL.QGLContext · declarations 001

Back to PythonQt.QtOpenGL.QGLContext

BindOption instance-attribute

BindOption: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

BindOptions instance-attribute

BindOptions: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

CanFlipNativePixmapBindOption instance-attribute

CanFlipNativePixmapBindOption: Any

DefaultBindOption instance-attribute

DefaultBindOption: Any

InternalBindOption instance-attribute

InternalBindOption: Any

InvertedYBindOption instance-attribute

InvertedYBindOption: Any

LinearFilteringBindOption instance-attribute

LinearFilteringBindOption: Any

MemoryManagedBindOption instance-attribute

MemoryManagedBindOption: Any

MipmapBindOption instance-attribute

MipmapBindOption: Any

NoBindOption instance-attribute

NoBindOption: Any

PremultipliedAlphaBindOption instance-attribute

PremultipliedAlphaBindOption: Any

TemporarilyCachedBindOption instance-attribute

TemporarilyCachedBindOption: Any

areSharing

areSharing(context1: Any, context2: Any) -> bool

X.areSharing(context1, context2) -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *context2)

Returns true if context1 and context2 are sharing their GL resources such as textures, shader programs, etc; otherwise returns false.

This function was introduced in Qt 4.6.

Upstream PySide2 reference signatures (binding differences may apply):

areSharing(context1: PySide2.QtOpenGL.QGLContext, context2: PySide2.QtOpenGL.QGLContext) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#areSharing

bindTexture

bindTexture(image: Any, target: Any, format: Any, options: Any) -> int

X.bindTexture(image, target, format, options) -> int

Supplemental documentation: Qt 5 reference:

GLuint QGLContext::bindTexture(const QImage \&image, GLenum target, GLint format, QGLContext::BindOptions options)

Generates and binds a 2D GL texture to the current context, based on image. The generated texture id is returned and can be used in later glBindTexture() calls.

The target parameter specifies the texture target. The default target is GL_TEXTURE_2D.

The format parameter sets the internal format for the texture. The default format is GL_RGBA.

The binding options are a set of options used to decide how to bind the texture to the context.

The texture that is generated is cached, so multiple calls to bindTexture() with the same QImage will return the same texture id.

Note that we assume default values for the glPixelStore() and glPixelTransfer() parameters.

This function was introduced in Qt 4.6.

See also deleteTexture().

GLuint QGLContext::bindTexture(const QPixmap \&pixmap, GLenum target, GLint format, QGLContext::BindOptions options)

This is an overloaded function.

Generates and binds a 2D GL texture to the current context, based on pixmap.

This function was introduced in Qt 4.6.

GLuint QGLContext::bindTexture(const QImage \&image, GLenum target \= GL_TEXTURE_2D, GLint format \= GL_RGBA)

Generates and binds a 2D GL texture to the current context, based on image. The generated texture id is returned and can be used in later glBindTexture() calls.

This is an overloaded function.

GLuint QGLContext::bindTexture(const QPixmap \&pixmap, GLenum target \= GL_TEXTURE_2D, GLint format \= GL_RGBA)

This is an overloaded function.

Generates and binds a 2D GL texture based on pixmap.

GLuint QGLContext::bindTexture(const QString \&fileName)

This is an overloaded function.

Reads the compressed texture file fileName and generates a 2D GL texture from it.

This function can load DirectDrawSurface (DDS) textures in the DXT1, DXT3 and DXT5 DDS formats if the GL_ARB_texture_compression and GL_EXT_texture_compression_s3tc extensions are supported.

Since 4.6.1, textures in the ETC1 format can be loaded if the GL_OES_compressed_ETC1_RGB8_texture extension is supported and the ETC1 texture has been encapsulated in the PVR container format. Also, textures in the PVRTC2 and PVRTC4 formats can be loaded if the GL_IMG_texture_compression_pvrtc extension is supported.

See also deleteTexture().

Upstream PySide2 reference signatures (binding differences may apply):

bindTexture(self, fileName: str) -> int
bindTexture(self, image: PySide2.QtGui.QImage, target: int, format: int, options: PySide2.QtOpenGL.QGLContext.BindOptions) -> int
bindTexture(self, image: PySide2.QtGui.QImage, target: int=..., format: int=...) -> int
bindTexture(self, pixmap: PySide2.QtGui.QPixmap, target: int, format: int, options: PySide2.QtOpenGL.QGLContext.BindOptions) -> int
bindTexture(self, pixmap: PySide2.QtGui.QPixmap, target: int=..., format: int=...) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#bindTexture

chooseContext

chooseContext(shareContext: Any) -> bool

X.chooseContext(shareContext) -> bool

Supplemental documentation: Qt 5 reference:

[virtual protected] bool QGLContext::chooseContext(const QGLContext *shareContext \= 0)

This semi-internal function is called by create(). It creates a system-dependent OpenGL handle that matches the format() of shareContext as closely as possible, returning true if successful or false if a suitable handle could not be found.

On Windows, it calls the virtual function choosePixelFormat(), which finds a matching pixel format identifier. On X11, it calls the virtual function chooseVisual() which finds an appropriate X visual. On other platforms it may work differently.

Upstream PySide2 reference signatures (binding differences may apply):

chooseContext(self, shareContext: typing.Optional[PySide2.QtOpenGL.QGLContext]=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#chooseContext

colorIndex

colorIndex(c: Any) -> int

X.colorIndex(c) -> int

Upstream PySide2 reference signatures (binding differences may apply):

colorIndex(self, c: PySide2.QtGui.QColor) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#colorIndex

contextHandle

contextHandle() -> Any

X.contextHandle() -> PythonQt.QtGui.QOpenGLContext

Supplemental documentation: Qt 5 reference:

QOpenGLContext *QGLContext::contextHandle() const

Returns the OpenGL context handle.

Upstream PySide2 reference signatures (binding differences may apply):

contextHandle(self) -> PySide2.QtGui.QOpenGLContext

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#contextHandle

create

create(shareContext: Any) -> bool

X.create(shareContext) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QGLContext::create(const QGLContext *shareContext \= nullptr)

Creates the GL context. Returns true if it was successful in creating a valid GL rendering context on the paint device specified in the constructor; otherwise returns false (i.e. the context is invalid).

If the OpenGL implementation on your system does not support the requested version of OpenGL context, then QGLContext will try to create the closest matching version. The actual created context properties can be queried using the QGLFormat returned by the format() function. For example, if you request a context that supports OpenGL 4.3 Core profile but the driver and/or hardware only supports version 3.2 Core profile contexts then you will get a 3.2 Core profile context.

After successful creation, format() returns the set of features of the created GL rendering context.

If shareContext points to a valid QGLContext, this method will try to establish OpenGL display list and texture object sharing between this context and the shareContext. Note that this may fail if the two contexts have different formats. Use isSharing() to see if sharing is in effect.

Warning: Implementation note: initialization of C++ class members usually takes place in the class constructor. QGLContext is an exception because it must be simple to customize. The virtual functions chooseContext() (and chooseVisual() for X11) can be reimplemented in a subclass to select a particular context. The problem is that virtual functions are not properly called during construction (even though this is correct C++) because C++ constructs class hierarchies from the bottom up. For this reason we need a create() function.

See also chooseContext(), format(), and isValid().

Upstream PySide2 reference signatures (binding differences may apply):

create(self, shareContext: typing.Optional[PySide2.QtOpenGL.QGLContext]=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#create

currentContext

currentContext() -> Any

X.currentContext() -> PythonQt.QtOpenGL.QGLContext

Supplemental documentation: Qt 5 reference:

[static] const QGLContext *QGLContext::currentContext()

Returns the current context, i.e. the context to which any OpenGL commands will currently be directed. Returns 0 if no context is current.

See also makeCurrent().

Upstream PySide2 reference signatures (binding differences may apply):

currentContext() -> PySide2.QtOpenGL.QGLContext

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#currentContext

deleteTexture

deleteTexture(tx_id: int) -> None

X.deleteTexture(tx_id)

Supplemental documentation: Qt 5 reference:

void QGLContext::deleteTexture(GLuint id)

Removes the texture identified by id from the texture cache, and calls glDeleteTextures() to delete the texture from the context.

See also bindTexture().

Upstream PySide2 reference signatures (binding differences may apply):

deleteTexture(self, tx_id: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#deleteTexture

device

device() -> Any

X.device() -> PythonQt.QtGui.QPaintDevice

Supplemental documentation: Qt 5 reference:

QPaintDevice *QGLContext::device() const

Returns the paint device set for this context.

See also QGLContext::QGLContext().

Upstream PySide2 reference signatures (binding differences may apply):

device(self) -> PySide2.QtGui.QPaintDevice

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#device

deviceIsPixmap

deviceIsPixmap() -> bool

X.deviceIsPixmap() -> bool

Supplemental documentation: Qt 5 reference:

[protected] bool QGLContext::deviceIsPixmap() const

Returns true if the paint device of this context is a pixmap; otherwise returns false.

Since Qt 5 the paint device is never actually a pixmap. renderPixmap() is however still simulated using framebuffer objects and readbacks, and this function will return true in this case.

Upstream PySide2 reference signatures (binding differences may apply):

deviceIsPixmap(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#deviceIsPixmap

doneCurrent

doneCurrent() -> None

X.doneCurrent()

Supplemental documentation: Qt 5 reference:

[virtual] void QGLContext::doneCurrent()

Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary.

Upstream PySide2 reference signatures (binding differences may apply):

doneCurrent(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#doneCurrent

drawTexture

drawTexture(point: Any, textureId: int, textureTarget: int) -> None

X.drawTexture(point, textureId, textureTarget)

Supplemental documentation: Qt 5 reference:

void QGLContext::drawTexture(const QRectF \&target, GLuint textureId, GLenum textureTarget \= GL_TEXTURE_2D)

This function supports the following use cases:

  • On OpenGL and OpenGL ES 1.x it draws the given texture, textureId, to the given target rectangle, target, in OpenGL model space. The textureTarget should be a 2D texture target.
  • On OpenGL and OpenGL ES 2.x, if a painter is active, not inside a beginNativePainting / endNativePainting block, and uses the engine with type QPaintEngine::OpenGL2, the function will draw the given texture, textureId, to the given target rectangle, target, respecting the current painter state. This will let you draw a texture with the clip, transform, render hints, and composition mode set by the painter. Note that the texture target needs to be GL_TEXTURE_2D for this use case, and that this is the only supported use case under OpenGL ES 2.x.

This function was introduced in Qt 4.4.

void QGLContext::drawTexture(const QPointF \&point, GLuint textureId, GLenum textureTarget \= GL_TEXTURE_2D)

This function supports the following use cases:

  • By default it draws the given texture, textureId, at the given point in OpenGL model space. The textureTarget should be a 2D texture target.
  • If a painter is active, not inside a beginNativePainting / endNativePainting block, and uses the engine with type QPaintEngine::OpenGL2, the function will draw the given texture, textureId, at the given point, respecting the current painter state. This will let you draw a texture with the clip, transform, render hints, and composition mode set by the painter. Note that the texture target needs to be GL_TEXTURE_2D for this use case.

Note: This function is not supported under any version of OpenGL ES.

This function was introduced in Qt 4.4.

Upstream PySide2 reference signatures (binding differences may apply):

drawTexture(self, point: PySide2.QtCore.QPointF, textureId: int, textureTarget: int=...) -> None
drawTexture(self, target: PySide2.QtCore.QRectF, textureId: int, textureTarget: int=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#drawTexture

format

format() -> Any

X.format() -> PythonQt.QtOpenGL.QGLFormat

Supplemental documentation: Qt 5 reference:

QGLFormat QGLContext::format() const

Returns the frame buffer format that was obtained (this may be a subset of what was requested).

See also setFormat() and requestedFormat().

Upstream PySide2 reference signatures (binding differences may apply):

format(self) -> PySide2.QtOpenGL.QGLFormat

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#format

fromOpenGLContext

fromOpenGLContext(platformContext: Any) -> Any

X.fromOpenGLContext(platformContext) -> PythonQt.QtOpenGL.QGLContext

Supplemental documentation: Qt 5 reference:

[static] QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context)

Returns an OpenGL context for the window context specified by the context parameter.

Upstream PySide2 reference signatures (binding differences may apply):

fromOpenGLContext(platformContext: PySide2.QtGui.QOpenGLContext) -> PySide2.QtOpenGL.QGLContext

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#fromOpenGLContext

functions

functions() -> Any

X.functions() -> PythonQt.QtOpenGL.QGLFunctions

Supplemental documentation: Qt 5 reference:

QGLFunctions *QGLContext::functions() const

Returns a QGLFunctions object that is initialized for this context.

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#functions

initialized

initialized() -> bool

X.initialized() -> bool

Supplemental documentation: Qt 5 reference:

[protected] bool QGLContext::initialized() const

Returns true if this context has been initialized, i.e. if QGLWidget::initializeGL() has been performed on it; otherwise returns false.

See also setInitialized().

Upstream PySide2 reference signatures (binding differences may apply):

initialized(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#initialized

isSharing

isSharing() -> bool

X.isSharing() -> bool

Supplemental documentation: Qt 5 reference:

bool QGLContext::isSharing() const

Returns true if this context is sharing its GL context with another QGLContext, otherwise false is returned. Note that context sharing might not be supported between contexts with different formats.

Upstream PySide2 reference signatures (binding differences may apply):

isSharing(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#isSharing

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QGLContext::isValid() const

Returns true if a GL rendering context has been successfully created; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#isValid

makeCurrent

makeCurrent() -> None

X.makeCurrent()

Supplemental documentation: Qt 5 reference:

[virtual] void QGLContext::makeCurrent()

Makes this context the current OpenGL rendering context. All GL functions you call operate on this context until another context is made current.

In some very rare cases the underlying call may fail. If this occurs an error message is output to stderr.

If you call this from a thread other than the main UI thread, make sure you've first pushed the context to the relevant thread from the UI thread using moveToThread().

Upstream PySide2 reference signatures (binding differences may apply):

makeCurrent(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#makeCurrent

moveToThread

moveToThread(thread: Any) -> None

X.moveToThread(thread)

Supplemental documentation: Qt 5 reference:

void QGLContext::moveToThread(QThread *thread)

Moves the QGLContext to the given thread.

Enables calling swapBuffers() and makeCurrent() on the context in the given thread.

Upstream PySide2 reference signatures (binding differences may apply):

moveToThread(self, thread: PySide2.QtCore.QThread) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#moveToThread

overlayTransparentColor

overlayTransparentColor() -> Any

X.overlayTransparentColor() -> PythonQt.QtGui.QColor

Supplemental documentation: Qt 5 reference:

QColor QGLContext::overlayTransparentColor() const

If this context is a valid context in an overlay plane, returns the plane's transparent color. Otherwise returns an invalid color.

The returned color's pixel value is the index of the transparent color in the colormap of the overlay plane. (Naturally, the color's RGB values are meaningless.)

The returned QColor object will generally work as expected only when passed as the argument to QGLWidget::qglColor() or QGLWidget::qglClearColor(). Under certain circumstances it can also be used to draw transparent graphics with a QPainter.

Upstream PySide2 reference signatures (binding differences may apply):

overlayTransparentColor(self) -> PySide2.QtGui.QColor

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#overlayTransparentColor

requestedFormat

requestedFormat() -> Any

X.requestedFormat() -> PythonQt.QtOpenGL.QGLFormat

Supplemental documentation: Qt 5 reference:

QGLFormat QGLContext::requestedFormat() const

Returns the frame buffer format that was originally requested in the constructor or setFormat().

See also format().

Upstream PySide2 reference signatures (binding differences may apply):

requestedFormat(self) -> PySide2.QtOpenGL.QGLFormat

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#requestedFormat

reset

reset() -> None

X.reset()

Supplemental documentation: Qt 5 reference:

void QGLContext::reset()

Resets the context and makes it invalid.

See also create() and isValid().

Upstream PySide2 reference signatures (binding differences may apply):

reset(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#reset

setFormat

setFormat(format: Any) -> None

X.setFormat(format)

Supplemental documentation: Qt 5 reference:

void QGLContext::setFormat(const QGLFormat \&format)

Sets a format for this context. The context is reset.

Call create() to create a new GL context that tries to match the new format.

QGLContext *cx;
//  ...
QGLFormat f;
f.setStereo(true);
cx->setFormat(f);
if (!cx->create())
    exit(); // no OpenGL support, or cannot render on the specified paintdevice
if (!cx->format().stereo())
    exit(); // could not create stereo context

See also format(), reset(), and create().

Upstream PySide2 reference signatures (binding differences may apply):

setFormat(self, format: PySide2.QtOpenGL.QGLFormat) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#setFormat

setInitialized

setInitialized(on: bool) -> None

X.setInitialized(on)

Supplemental documentation: Qt 5 reference:

[protected] void QGLContext::setInitialized(bool on)

If on is true the context has been initialized, i.e. QGLContext::setInitialized() has been called on it. If on is false the context has not been initialized.

See also initialized().

Upstream PySide2 reference signatures (binding differences may apply):

setInitialized(self, on: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#setInitialized

setTextureCacheLimit

setTextureCacheLimit(size: int) -> None

X.setTextureCacheLimit(size)

Supplemental documentation: Qt 5 reference:

[static] void QGLContext::setTextureCacheLimit(int size)

This function sets the limit for the texture cache to size, expressed in kilobytes.

By default, the cache limit is approximately 64 MB.

See also textureCacheLimit().

Upstream PySide2 reference signatures (binding differences may apply):

setTextureCacheLimit(size: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#setTextureCacheLimit

setValid

setValid(valid: bool) -> None

X.setValid(valid)

Upstream PySide2 reference signatures (binding differences may apply):

setValid(self, valid: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#setValid

setWindowCreated

setWindowCreated(on: bool) -> None

X.setWindowCreated(on)

Supplemental documentation: Qt 5 reference:

[protected] void QGLContext::setWindowCreated(bool on)

If on is true the context has had a window created for it. If on is false no window has been created for the context.

See also windowCreated().

Upstream PySide2 reference signatures (binding differences may apply):

setWindowCreated(self, on: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglcontext.html#setWindowCreated