~unity-team/unity/trunk

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/ScreenEffectFramebufferObject.h

  • Committer: Daniel van Vugt
  • Date: 2012-09-13 10:56:42 UTC
  • mfrom: (2684 unity)
  • mto: This revision was merged to the branch mainline in revision 2698.
  • Revision ID: daniel.van.vugt@canonical.com-20120913105642-9on2ald55h54j1zn
Merge latest lp:unity and fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
 
/* Compiz unity plugin
3
 
 * unity.h
4
 
 *
5
 
 * Copyright (c) 2010-11 Canonical Ltd.
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU General Public License
9
 
 * as published by the Free Software Foundation; either version 3
10
 
 * of the License, or (at your option) any later version.
11
 
 *
12
 
 * This program is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 *
17
 
 * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com>
18
 
 */
19
 
 
20
 
#ifndef UNITY_SCREENEFFECT_FRAMEBUFFER_H
21
 
#define UNITY_SCREENEFFECT_FRAMEBUFFER_H
22
 
 
23
 
#ifndef USE_MODERN_COMPIZ_GL
24
 
#include <Nux/Nux.h>
25
 
 
26
 
namespace unity
27
 
{
28
 
class ScreenEffectFramebufferObject
29
 
{
30
 
public:
31
 
 
32
 
  typedef boost::shared_ptr <ScreenEffectFramebufferObject> Ptr;
33
 
  typedef void (*FuncPtr) (void);
34
 
  typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
35
 
 
36
 
  ScreenEffectFramebufferObject (GLXGetProcAddressProc, const nux::Geometry &geom);
37
 
  ~ScreenEffectFramebufferObject ();
38
 
 
39
 
public:
40
 
 
41
 
  void bind (const nux::Geometry &geom);
42
 
  void unbind ();
43
 
 
44
 
  bool status ();
45
 
  void paint (const nux::Geometry &geom);
46
 
  bool bound () { return mBoundCnt > 0; }
47
 
 
48
 
  GLuint texture () { return mFBTexture; }
49
 
  
50
 
  void onScreenSizeChanged (const nux::Geometry &screenSize);
51
 
 
52
 
private:
53
 
 
54
 
  FuncPtr getProcAddr (const std::string &);
55
 
 
56
 
  typedef void (*GLActiveTextureProc) (GLenum texture);
57
 
  typedef void (*GLGenFramebuffersProc) (GLsizei n,
58
 
                                         GLuint  *framebuffers);
59
 
  typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
60
 
                                            GLuint  *framebuffers);
61
 
  typedef void (*GLBindFramebufferProc) (GLenum target,
62
 
                                         GLuint framebuffer);
63
 
  typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
64
 
  typedef void (*GLFramebufferTexture2DProc) (GLenum target,
65
 
                                              GLenum attachment,
66
 
                                              GLenum textarget,
67
 
                                              GLuint texture,
68
 
                                              GLint  level);
69
 
  
70
 
  GLXGetProcAddressProc getProcAddressGLX;
71
 
  GLActiveTextureProc activeTexture;
72
 
  GLGenFramebuffersProc genFramebuffers;
73
 
  GLDeleteFramebuffersProc deleteFramebuffers;
74
 
  GLBindFramebufferProc bindFramebuffer;
75
 
  GLCheckFramebufferStatusProc checkFramebufferStatus;
76
 
  GLFramebufferTexture2DProc framebufferTexture2D;
77
 
  /* compiz fbo handle that goes through to nux */
78
 
  GLuint   mFboHandle; // actual handle to the framebuffer_ext
79
 
  bool    mFboStatus; // did the framebuffer texture bind succeed
80
 
  GLuint   mFBTexture;
81
 
  nux::Geometry mGeometry;
82
 
  unsigned int mBoundCnt;
83
 
  
84
 
  nux::Geometry mScreenSize;
85
 
};
86
 
} // namespace unity
87
 
 
88
 
#endif // USE_MODERN_COMPIZ_GL
89
 
#endif