1 /*
2   Copyright 2012-2020 David Robillard <d@drobilla.net>
3 
4   Permission to use, copy, modify, and/or distribute this software for any
5   purpose with or without fee is hereby granted, provided that the above
6   copyright notice and this permission notice appear in all copies.
7 
8   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16 
17 #ifndef PUGL_GL_HPP
18 #define PUGL_GL_HPP
19 
20 #include "pugl/gl.h"
21 #include "pugl/pugl.h"
22 #include "pugl/pugl.hpp"
23 
24 namespace pugl {
25 
26 /**
27    @defgroup glxx OpenGL
28    OpenGL graphics support.
29    @ingroup pugl_cxx
30    @{
31 */
32 
33 /// @copydoc PuglGlFunc
34 using GlFunc = PuglGlFunc;
35 
36 /// @copydoc puglGetProcAddress
37 inline GlFunc
getProcAddress(const char * name)38 getProcAddress(const char* name) noexcept
39 {
40   return puglGetProcAddress(name);
41 }
42 
43 /// @copydoc puglEnterContext
44 inline Status
enterContext(View & view)45 enterContext(View& view) noexcept
46 {
47   return static_cast<Status>(puglEnterContext(view.cobj()));
48 }
49 
50 /// @copydoc puglLeaveContext
51 inline Status
leaveContext(View & view)52 leaveContext(View& view) noexcept
53 {
54   return static_cast<Status>(puglLeaveContext(view.cobj()));
55 }
56 
57 /// @copydoc puglGlBackend
58 inline const PuglBackend*
glBackend()59 glBackend() noexcept
60 {
61   return puglGlBackend();
62 }
63 
64 /**
65    @}
66 */
67 
68 } // namespace pugl
69 
70 #endif // PUGL_GL_HPP
71