dsfml.window.context

If you need to make OpenGL calls without having an active window (like in a thread), you can use an instance of this class to get a valid context.

Having a valid context is necessary for every OpenGL call.

Note that a context is only active in its current thread, if you create a new thread it will have no valid context by default.

To use a $(U Context) instance, just construct it and let it live as long as you need a valid context. No explicit activation is needed, all it has to do is to exist. Its destructor will take care of deactivating and freeing all the attached resources.

Members

Aliases

GlFunctionPointer
alias GlFunctionPointer = void*
Undocumented in source.

Classes

Context
class Context

Class holding a valid drawing context.

Structs

sfContext
struct sfContext
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Examples

void threadFunction()
{
   Context context = new Context();
   // from now on, you have a valid context

   // you can make OpenGL calls
   glClear(GL_DEPTH_BUFFER_BIT);
}
// the context is automatically deactivated and destroyed by the
// Context destructor when the class is collected by the GC

Meta