]> git.cworth.org Git - apitrace/blob - glws.hpp
Fix a few more arrays args in D3D9.
[apitrace] / glws.hpp
1 /**************************************************************************
2  *
3  * Copyright 2011 Jose Fonseca
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  *
24  **************************************************************************/
25
26 /*
27  * Abstraction for GL window system specific APIs (GLX, WGL).
28  */
29
30 #ifndef _GLWS_HPP_
31 #define _GLWS_HPP_
32
33
34 namespace glws {
35
36
37 class Visual
38 {
39 public:
40     unsigned long redMask;
41     unsigned long greenMask;
42     unsigned long blueMask;
43     unsigned long alphaMask;
44     bool doubleBuffer;
45
46     virtual ~Visual() {}
47 };
48
49
50 class Drawable
51 {
52 public:
53     const Visual *visual;
54     unsigned width;
55     unsigned height;
56
57     Drawable(const Visual *vis) :
58         visual(vis)
59     {}
60
61     virtual ~Drawable() {}
62     
63     virtual void
64     resize(unsigned w, unsigned h) {
65         width = w;
66         height = h;
67     }
68
69     virtual void swapBuffers(void) = 0;
70 };
71
72
73 class Context
74 {
75 public:
76     const Visual *visual;
77     
78     Context(const Visual *vis) :
79         visual(vis)
80     {}
81
82     virtual ~Context() {}
83 };
84
85
86 class WindowSystem
87 {
88 public:
89     virtual ~WindowSystem() {}
90
91     virtual Visual *
92     createVisual(bool doubleBuffer = false) = 0;
93     
94     virtual Drawable *
95     createDrawable(const Visual *visual) = 0;
96
97     virtual Context *
98     createContext(const Visual *visual) = 0;
99     
100     virtual bool
101     makeCurrent(Drawable *drawable, Context *context) = 0;
102
103     virtual bool
104     processEvents(void) = 0;
105 };
106
107
108 WindowSystem *createNativeWindowSystem(void);
109
110
111 } /* namespace glws */
112
113
114 #endif /* _GLWS_HPP_ */