]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGLXManager.h
85c3c94d3a011a424ee5819f64fcf88f87042103
[irrlicht.git] / source / Irrlicht / CGLXManager.h
1 // Copyright (C) 2013 Christian Stehno\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in Irrlicht.h\r
4 \r
5 #ifndef __C_GLX_MANAGER_H_INCLUDED__\r
6 #define __C_GLX_MANAGER_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h"\r
9 \r
10 #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_\r
11 \r
12 #include "SIrrCreationParameters.h"\r
13 #include "SExposedVideoData.h"\r
14 #include "IContextManager.h"\r
15 #include "SColor.h"\r
16 #include <X11/Xlib.h>\r
17 #include <X11/Xutil.h>\r
18 \r
19 // we can't include glx.h here, because gl.h has incompatible types with ogl es headers and it\r
20 // cause redefinition errors, thats why we use ugly trick with void* types and casts.\r
21 \r
22 namespace irr\r
23 {\r
24 namespace video\r
25 {\r
26     // GLX manager.\r
27     class CGLXManager : public IContextManager\r
28     {\r
29     public:\r
30         //! Constructor.\r
31         CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr);\r
32 \r
33         //! Destructor\r
34         ~CGLXManager();\r
35 \r
36         // Initialize\r
37         bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) override;\r
38 \r
39         // Terminate\r
40         void terminate() override;\r
41 \r
42         // Create surface.\r
43         bool generateSurface() override;\r
44 \r
45         // Destroy surface.\r
46         void destroySurface() override;\r
47 \r
48         // Create context.\r
49         bool generateContext() override;\r
50 \r
51         // Destroy context.\r
52         void destroyContext() override;\r
53 \r
54         //! Get current context\r
55         const SExposedVideoData& getContext() const override;\r
56 \r
57         //! Change render context, disable old and activate new defined by videoData\r
58         bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) override;\r
59 \r
60                 // Get procedure address.\r
61                 void* getProcAddress(const std::string &procName) override;\r
62 \r
63         // Swap buffers.\r
64         bool swapBuffers() override;\r
65 \r
66         XVisualInfo* getVisual() const {return VisualInfo;} // return XVisualInfo\r
67 \r
68     private:\r
69         SIrrlichtCreationParameters Params;\r
70         SExposedVideoData PrimaryContext;\r
71         SExposedVideoData CurrentContext;\r
72         XVisualInfo* VisualInfo;\r
73         void* glxFBConfig; // GLXFBConfig\r
74         XID GlxWin; // GLXWindow\r
75         };\r
76 }\r
77 }\r
78 \r
79 #endif\r
80 \r
81 #endif\r
82 \r