aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-26 23:46:29 +0200
committerDavid Robillard <d@drobilla.net>2019-07-28 19:06:39 +0200
commit6a77f96642b201f614ce7eb67f3b6ec4e1e8c181 (patch)
tree051a02fcd8ffd6ec0a6c6fb8c1331a4a1592d99b /pugl/pugl.h
parent6a3159df3e41cfef6d94ff52f2cf9c5375254243 (diff)
downloadpugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.tar.gz
pugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.tar.bz2
pugl-6a77f96642b201f614ce7eb67f3b6ec4e1e8c181.zip
Make enterContext take a drawing parameter like leaveContext
These need to be symmetric because sometimes different things need to happen in either situation when entering the context as well.
Diffstat (limited to 'pugl/pugl.h')
-rw-r--r--pugl/pugl.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 3e0578e..f34b4de 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -572,21 +572,28 @@ puglGetContext(PuglView* view);
/**
Enter the drawing context.
- This must be called before any code that accesses the drawing context,
- including any GL functions. This is only necessary for code that does so
- outside the usual draw callback or handling of an expose event.
+ Note that pugl automatically enters and leaves the drawing context during
+ configure and expose events, so it is not normally necessary to call this.
+ However, it can be used to enter the drawing context elsewhere, for example
+ to call any GL functions during setup.
+
+ @param view The view being entered.
+ @param drawing If true, prepare for drawing.
*/
PUGL_API void
-puglEnterContext(PuglView* view);
+puglEnterContext(PuglView* view, bool drawing);
/**
Leave the drawing context.
- This must be called after puglEnterContext and applies the results of the
- drawing code (for example, by swapping buffers).
+ This must be called after puglEnterContext() with a matching `drawing`
+ parameter.
+
+ @param view The view being left.
+ @param drawing If true, finish drawing, for example by swapping buffers.
*/
PUGL_API void
-puglLeaveContext(PuglView* view, bool flush);
+puglLeaveContext(PuglView* view, bool drawing);
/**
@}