Qt 4.8
Public Functions | Properties | List of all members
QGLShareContextScope Class Reference

#include <qgl_p.h>

Public Functions

 operator QGLContext * ()
 
QGLContextoperator-> ()
 
 QGLShareContextScope (const QGLContext *ctx)
 
 ~QGLShareContextScope ()
 

Properties

QGLContextm_ctx
 
QGLContextm_oldContext
 

Detailed Description

Definition at line 483 of file qgl_p.h.

Constructors and Destructors

◆ QGLShareContextScope()

QGLShareContextScope::QGLShareContextScope ( const QGLContext ctx)
inline

Definition at line 486 of file qgl_p.h.

487  : m_oldContext(0)
488  {
489  QGLContext *currentContext = const_cast<QGLContext *>(QGLContext::currentContext());
490  if (currentContext != ctx && !QGLContext::areSharing(ctx, currentContext)) {
491  m_oldContext = currentContext;
492  m_ctx = const_cast<QGLContext *>(ctx);
493  m_ctx->makeCurrent();
494  } else {
495  m_ctx = currentContext;
496  }
497  }
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
static bool 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.
Definition: qgl.cpp:3319
QGLContext * m_ctx
Definition: qgl_p.h:517
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
QGLContext * m_oldContext
Definition: qgl_p.h:516
#define ctx
Definition: qgl.cpp:6094
virtual void makeCurrent()
Makes this context the current OpenGL rendering context.
Definition: qgl_egl.cpp:213

◆ ~QGLShareContextScope()

QGLShareContextScope::~QGLShareContextScope ( )
inline

Definition at line 509 of file qgl_p.h.

510  {
511  if (m_oldContext)
513  }
QGLContext * m_oldContext
Definition: qgl_p.h:516
virtual void makeCurrent()
Makes this context the current OpenGL rendering context.
Definition: qgl_egl.cpp:213

Functions

◆ operator QGLContext *()

QGLShareContextScope::operator QGLContext * ( )
inline

Definition at line 499 of file qgl_p.h.

500  {
501  return m_ctx;
502  }
QGLContext * m_ctx
Definition: qgl_p.h:517

◆ operator->()

QGLContext* QGLShareContextScope::operator-> ( )
inline

Definition at line 504 of file qgl_p.h.

505  {
506  return m_ctx;
507  }
QGLContext * m_ctx
Definition: qgl_p.h:517

Properties

◆ m_ctx

QGLContext* QGLShareContextScope::m_ctx
private

Definition at line 517 of file qgl_p.h.

◆ m_oldContext

QGLContext* QGLShareContextScope::m_oldContext
private

Definition at line 516 of file qgl_p.h.


The documentation for this class was generated from the following file: