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-2005 The OGRE Team
|
---|
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 | */
|
---|
25 | #ifndef __GLXUtils_H__
|
---|
26 | #define __GLXUtils_H__
|
---|
27 |
|
---|
28 | #include "OgrePrerequisites.h"
|
---|
29 | #include <X11/Xlib.h>
|
---|
30 | #include <GL/glx.h>
|
---|
31 |
|
---|
32 | namespace Ogre {
|
---|
33 | /**
|
---|
34 | * Class that acquires and stores properties of a frame buffer configuration
|
---|
35 | */
|
---|
36 | class FBConfigData
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | FBConfigData();
|
---|
40 | FBConfigData(Display *dpy, GLXFBConfig config);
|
---|
41 | String toString() const;
|
---|
42 |
|
---|
43 | int configID;
|
---|
44 | int visualID;
|
---|
45 | int bufferSize;
|
---|
46 | int level;
|
---|
47 | int doubleBuffer;
|
---|
48 | int stereo;
|
---|
49 | int auxBuffers;
|
---|
50 | int renderType;
|
---|
51 | int redSize;
|
---|
52 | int greenSize;
|
---|
53 | int blueSize;
|
---|
54 | int alphaSize;
|
---|
55 | int depthSize;
|
---|
56 | int stencilSize;
|
---|
57 | int accumRedSize;
|
---|
58 | int accumGreenSize;
|
---|
59 | int accumBlueSize;
|
---|
60 | int accumAlphaSize;
|
---|
61 | int drawableType;
|
---|
62 | int caveat;
|
---|
63 | int maxPBufferWidth;
|
---|
64 | int maxPBufferHeight;
|
---|
65 | int maxPBufferPixels;
|
---|
66 | };
|
---|
67 | class GLXUtils {
|
---|
68 | public:
|
---|
69 | /**
|
---|
70 | * Loads an icon from an Ogre resource into the X Server. This currently only
|
---|
71 | * works for 24 and 32 bit displays. The image must be findable by the Ogre
|
---|
72 | * resource system, and of format PF_A8R8G8B8.
|
---|
73 | *
|
---|
74 | * @param mDisplay,rootWindow X resources to use
|
---|
75 | * @param name Name of image to load
|
---|
76 | * @param pix Receiver for the output pixmap
|
---|
77 | * @param mask Receiver for the output mask (alpha bitmap)
|
---|
78 | * @returns true on success
|
---|
79 | */
|
---|
80 | static bool LoadIcon(Display *mDisplay, Window rootWindow, const std::string &name, Pixmap *pix, Pixmap *mask);
|
---|
81 | /*
|
---|
82 | * Examine all visuals to find the so-called best one.
|
---|
83 | * We prefer deepest RGBA buffer with depth, stencil and accum
|
---|
84 | * that has no caveats. This will only choose formats with a multisample
|
---|
85 | * that equals multisample
|
---|
86 | * @returns -1 in case of failure, otherwise a valid visual ID
|
---|
87 | * @author Brian Paul (from the glxinfo source)
|
---|
88 | */
|
---|
89 | static int findBestVisual(Display *dpy, int scrnum, int multisample = -1);
|
---|
90 | /**
|
---|
91 | * Find best FBConfig given a list required and a list of desired properties
|
---|
92 | */
|
---|
93 | static GLXFBConfig findBestMatch(Display *dpy, int scrnum, const int *attribs, const int *ideal);
|
---|
94 |
|
---|
95 | };
|
---|
96 |
|
---|
97 | };
|
---|
98 |
|
---|
99 | #endif
|
---|