Crazy Eddies GUI System  0.7.0
CEGUIOpenGLWGLPBTextureTarget.h
1 /***********************************************************************
2  filename: CEGUIOpenGLWGLPBTextureTarget.h
3  created: Sun Feb 1 2009
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIOpenGLWGLPBTextureTarget_h_
29 #define _CEGUIOpenGLWGLPBTextureTarget_h_
30 
31 //#include <windows.h>
32 #include <GL/glew.h>
33 #include <GL/wglew.h>
34 
35 #include "CEGUIOpenGLRenderTarget.h"
36 #include "../../CEGUITextureTarget.h"
37 #include "../../CEGUIRect.h"
38 
39 #if defined(_MSC_VER)
40 # pragma warning(push)
41 # pragma warning(disable : 4250)
42 #endif
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
47 class OpenGLTexture;
48 
54 class OPENGL_GUIRENDERER_API OpenGLWGLPBTextureTarget : public OpenGLRenderTarget,
55  public TextureTarget
56 {
57 public:
59  virtual ~OpenGLWGLPBTextureTarget();
60 
61  // overrides from OpenGLRenderTarget
62  void activate();
63  void deactivate();
64  // implementation of RenderTarget interface
65  bool isImageryCache() const;
66  // implementation of TextureTarget interface
67  void clear();
68  Texture& getTexture() const;
69  void declareRenderSize(const Size& sz);
70  bool isRenderingInverted() const;
71 
72 protected:
74  static const float DEFAULT_SIZE;
75 
77  void initialisePBuffer();
78 
80  void releasePBuffer();
81 
83  void enablePBuffer() const;
84 
86  void disablePBuffer() const;
87 
89  void initialiseTexture();
90 
92  int d_pixfmt;
94  HPBUFFERARB d_pbuffer;
96  HGLRC d_context;
98  HDC d_hdc;
100  mutable HGLRC d_prevContext;
102  mutable HDC d_prevDC;
104  GLuint d_texture;
107 };
108 
109 } // End of CEGUI namespace section
110 
111 #if defined(_MSC_VER)
112 # pragma warning(pop)
113 #endif
114 
115 #endif // end of guard _CEGUIOpenGLWGLPBTextureTarget_h_