Gdk::GLContext Class Reference

A Gdk::GLContext is an OpenGL context abstraction. More...

`#include <gdkmm/glcontext.h>`

Inheritance diagram for Gdk::GLContext:
[legend]

## Public Member Functions

| GLContext (GLContext&& src) noexcept
GLContext& | operator= (GLContext&& src) noexcept
virtual | ~GLContext () noexcept
GdkGLContext* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkGLContext* | gobj () const
| Provides access to the underlying C GObject. More...
GdkGLContext* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::RefPtr< Display > | get_display ()
| Retrieves the Gdk::Display the context is created for. More...
Glib::RefPtr< const Display > | get_display () const
| Retrieves the Gdk::Display the context is created for. More...
Glib::RefPtr< Window > | get_window ()
| Retrieves the Gdk::Window used by the context. More...
Glib::RefPtr< const Window > | get_window () const
| Retrieves the Gdk::Window used by the context. More...
Glib::RefPtr< GLContext > | get_shared_context ()
| Retrieves the Gdk::GLContext that this context share data with. More...
Glib::RefPtr< const GLContext > | get_shared_context () const
| Retrieves the Gdk::GLContext that this context share data with. More...
void | get_version (int& major, int& minor) const
| Retrieves the OpenGL version of the context. More...
void | get_required_version (int& major, int& minor) const
| Retrieves the major and minor version requested by calling gdk_gl_context_set_required_version(). More...
void | set_required_version (int major, int minor)
| Sets the major and minor version of OpenGL to request. More...
bool | get_debug_enabled () const
| Retrieves the value set using gdk_gl_context_set_debug_enabled(). More...
void | set_debug_enabled (bool enabled=true)
| Sets whether the Gdk::GLContext should perform extra validations and run time checking. More...
bool | get_forward_compatible () const
| Retrieves the value set using gdk_gl_context_set_forward_compatible(). More...
void | set_forward_compatible (bool compatible=true)
| Sets whether the Gdk::GLContext should be forward compatible. More...
bool | realize ()
| Realizes the given Gdk::GLContext. More...
void | make_current ()
| Makes the context the current one. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const
| The Gdk::Display used to create the Gdk::GLContext. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< GLContext > > | property_shared_context () const
| The Gdk::GLContext that this context is sharing data with, or #`0` More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Window > > | property_window () const
| The Gdk::Window the gl context is bound to. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable ()
| trackable (const trackable &src)
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< GLContext > | get_current ()
| Retrieves the current Gdk::GLContext. More...
static void | clear_current ()
| Clears the current Gdk::GLContext. More...

## Protected Member Functions

| GLContext ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
virtual | ~Object () noexcept
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gdk::GLContext > | wrap (GdkGLContext* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members

Public Types inherited from Glib::Object
typedef void(* | DestroyNotify) (gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

A Gdk::GLContext is an OpenGL context abstraction.

It's a low-level object, used to implement high-level objects such as Gtk::GLArea on the GTK+ level.

Since gtkmm 3.18:

## Constructor & Destructor Documentation

Gdk::GLContext::GLContext | ( | GLContext&& | src | ) |

noexcept

virtual Gdk::GLContext::~GLContext | ( |  | ) |

virtual noexcept

Gdk::GLContext::GLContext | ( |  | ) |

protected

## Member Function Documentation

static void Gdk::GLContext::clear_current | ( |  | ) |

static

Clears the current Gdk::GLContext.

Any OpenGL call after this function returns will be ignored until gdk_gl_context_make_current() is called.

Since gtkmm 3.18:

static Glib::RefPtr<GLContext> Gdk::GLContext::get_current | ( |  | ) |

static

Retrieves the current Gdk::GLContext.

Since gtkmm 3.18:

Returns
  The current Gdk::GLContext, or `0`.

bool Gdk::GLContext::get_debug_enabled | ( |  | ) | const

Retrieves the value set using gdk_gl_context_set_debug_enabled().

Since gtkmm 3.18:

Returns
  `true` if debugging is enabled.

Glib::RefPtr<Display> Gdk::GLContext::get_display | ( |  | ) |

Retrieves the Gdk::Display the context is created for.

Since gtkmm 3.18:

Returns
  A Gdk::Display or `0`.

Glib::RefPtr<const Display> Gdk::GLContext::get_display | ( |  | ) | const

Retrieves the Gdk::Display the context is created for.

Since gtkmm 3.18:

Returns
  A Gdk::Display or `0`.

bool Gdk::GLContext::get_forward_compatible | ( |  | ) | const

Retrieves the value set using gdk_gl_context_set_forward_compatible().

Since gtkmm 3.18:

Returns
  `true` if the context should be forward compatible.

void Gdk::GLContext::get_required_version | ( | int & | major,
|  | int & | minor
| ) |  | const

Retrieves the major and minor version requested by calling gdk_gl_context_set_required_version().

Since gtkmm 3.18:

Parameters

  major | Return location for the major version to request.
  minor | Return location for the minor version to request.

Glib::RefPtr<GLContext> Gdk::GLContext::get_shared_context | ( |  | ) |

Retrieves the Gdk::GLContext that this context share data with.

Since gtkmm 3.18:

Returns
  A Gdk::GLContext or `0`.

Glib::RefPtr<const GLContext> Gdk::GLContext::get_shared_context | ( |  | ) | const

Retrieves the Gdk::GLContext that this context share data with.

Since gtkmm 3.18:

Returns
  A Gdk::GLContext or `0`.

static GType Gdk::GLContext::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

void Gdk::GLContext::get_version | ( | int & | major,
|  | int & | minor
| ) |  | const

Retrieves the OpenGL version of the context.

The context must be realized prior to calling this function.

Since gtkmm 3.18:

Parameters

  major | Return location for the major version.
  minor | Return location for the minor version.

Glib::RefPtr<Window> Gdk::GLContext::get_window | ( |  | ) |

Retrieves the Gdk::Window used by the context.

Since gtkmm 3.18:

Returns
  A Gdk::Window or `0`.

Glib::RefPtr<const Window> Gdk::GLContext::get_window | ( |  | ) | const

Retrieves the Gdk::Window used by the context.

Since gtkmm 3.18:

Returns
  A Gdk::Window or `0`.

GdkGLContext* Gdk::GLContext::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

const GdkGLContext* Gdk::GLContext::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

GdkGLContext* Gdk::GLContext::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

void Gdk::GLContext::make_current | ( |  | ) |

Makes the context the current one.

Since gtkmm 3.18:

GLContext& Gdk::GLContext::operator= | ( | GLContext&& | src | ) |

noexcept

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> > Gdk::GLContext::property_display | ( |  | ) | const

The Gdk::Display used to create the Gdk::GLContext.

Since gtkmm 3.18:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<GLContext> > Gdk::GLContext::property_shared_context | ( |  | ) | const

The Gdk::GLContext that this context is sharing data with, or #`0`

Since gtkmm 3.18:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Window> > Gdk::GLContext::property_window | ( |  | ) | const

The Gdk::Window the gl context is bound to.

Since gtkmm 3.18:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

bool Gdk::GLContext::realize | ( |  | ) |

Realizes the given Gdk::GLContext.

It is safe to call this function on a realized Gdk::GLContext.

Since gtkmm 3.18:

Returns
  `true` if the context is realized.

void Gdk::GLContext::set_debug_enabled | ( | bool | enabled = `true` | ) |

Sets whether the Gdk::GLContext should perform extra validations and run time checking.

This is useful during development, but has additional overhead.

The Gdk::GLContext must not be realized or made current prior to calling this function.

Since gtkmm 3.18:

Parameters

  enabled | Whether to enable debugging in the context.

void Gdk::GLContext::set_forward_compatible | ( | bool | compatible = `true` | ) |

Sets whether the Gdk::GLContext should be forward compatible.

Forward compatibile contexts must not support OpenGL functionality that has been marked as deprecated in the requested version; non-forward compatible contexts, on the other hand, must support both deprecated and non deprecated functionality.

The Gdk::GLContext must not be realized or made current prior to calling this function.

Since gtkmm 3.18:

Parameters

  compatible | Whether the context should be forward compatible.

void Gdk::GLContext::set_required_version | ( | int | major,
|  | int | minor
| ) |  |

Sets the major and minor version of OpenGL to request.

Setting major and minor to zero will use the default values.

The Gdk::GLContext must not be realized or made current prior to calling this function.

Since gtkmm 3.18:

Parameters

  major | The major version to request.
  minor | The minor version to request.

## Friends And Related Function Documentation

Glib::RefPtr< Gdk::GLContext > wrap | ( | GdkGLContext * | object,
|  | bool | take_copy = `false`
| ) |  |

related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.