1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __GLXUtils_H__ |
---|
30 | #define __GLXUtils_H__ |
---|
31 | |
---|
32 | #include "OgrePrerequisites.h" |
---|
33 | #include <X11/Xlib.h> |
---|
34 | #include <GL/glx.h> |
---|
35 | |
---|
36 | namespace Ogre { |
---|
37 | /** |
---|
38 | * Class that acquires and stores properties of a frame buffer configuration |
---|
39 | */ |
---|
40 | class _OgrePrivate FBConfigData |
---|
41 | { |
---|
42 | public: |
---|
43 | FBConfigData(); |
---|
44 | FBConfigData(Display *dpy, GLXFBConfig config); |
---|
45 | String toString() const; |
---|
46 | |
---|
47 | int configID; |
---|
48 | int visualID; |
---|
49 | int bufferSize; |
---|
50 | int level; |
---|
51 | int doubleBuffer; |
---|
52 | int stereo; |
---|
53 | int auxBuffers; |
---|
54 | int renderType; |
---|
55 | int redSize; |
---|
56 | int greenSize; |
---|
57 | int blueSize; |
---|
58 | int alphaSize; |
---|
59 | int depthSize; |
---|
60 | int stencilSize; |
---|
61 | int accumRedSize; |
---|
62 | int accumGreenSize; |
---|
63 | int accumBlueSize; |
---|
64 | int accumAlphaSize; |
---|
65 | int drawableType; |
---|
66 | int caveat; |
---|
67 | int maxPBufferWidth; |
---|
68 | int maxPBufferHeight; |
---|
69 | int maxPBufferPixels; |
---|
70 | }; |
---|
71 | |
---|
72 | class _OgrePrivate GLXUtils |
---|
73 | { |
---|
74 | public: |
---|
75 | /** |
---|
76 | * Loads an icon from an Ogre resource into the X Server. This currently only |
---|
77 | * works for 24 and 32 bit displays. The image must be findable by the Ogre |
---|
78 | * resource system, and of format PF_A8R8G8B8. |
---|
79 | * |
---|
80 | * @param mDisplay,rootWindow X resources to use |
---|
81 | * @param name Name of image to load |
---|
82 | * @param pix Receiver for the output pixmap |
---|
83 | * @param mask Receiver for the output mask (alpha bitmap) |
---|
84 | * @returns true on success |
---|
85 | */ |
---|
86 | static bool LoadIcon(Display *mDisplay, Window rootWindow, const std::string &name, Pixmap *pix, Pixmap *mask); |
---|
87 | /* |
---|
88 | * Examine all visuals to find the so-called best one. |
---|
89 | * We prefer deepest RGBA buffer with depth, stencil and accum |
---|
90 | * that has no caveats. This will only choose formats with a multisample |
---|
91 | * that equals multisample |
---|
92 | * @returns -1 in case of failure, otherwise a valid visual ID |
---|
93 | * @author Brian Paul (from the glxinfo source) |
---|
94 | */ |
---|
95 | static int findBestVisual(Display *dpy, int scrnum, int multisample = -1); |
---|
96 | /** |
---|
97 | * Find best FBConfig given a list required and a list of desired properties |
---|
98 | */ |
---|
99 | static GLXFBConfig findBestMatch(Display *dpy, int scrnum, const int *attribs, const int *ideal); |
---|
100 | |
---|
101 | }; |
---|
102 | |
---|
103 | }; |
---|
104 | |
---|
105 | #endif |
---|