DISTRHO Plugin Framework
Public Member Functions | List of all members
Window::ScopedGraphicsContext Class Reference

#include <Window.hpp>

Public Member Functions

 ScopedGraphicsContext (Window &window)
 

Detailed Description

Window graphics context as a scoped struct. This class gives graphics context drawing time to a window's widgets. Typically used for allowing OpenGL drawing operations during a window + widget constructor.

Unless you are subclassing the Window or StandaloneWindow classes, you do not need to care. In such cases you will need to use this struct as a way to get a valid OpenGL context. For example in a standalone application:

int main()
{
Window win(app);
{
const ScopedGraphicsContext sgc(win);
widget = new MyCustomTopLevelWidget(win);
}
app.exec();
return 0;
}

This struct is necessary because we cannot automatically make the window leave the OpenGL context in custom code. We must always cleanly enter and leave the OpenGL context. In order to avoid messing up the global host context, this class is used around widget creation.


The documentation for this class was generated from the following file:
Window
Definition: Window.hpp:50
ScopedPointer
Definition: ScopedPointer.hpp:64
Application
Definition: Application.hpp:36
Application::exec
void exec(uint idleTimeInMs=30)