~bilalakhtar/unity/software-center-integration-for-o

« back to all changes in this revision

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

  • Committer: Bilal Akhtar
  • Date: 2012-01-15 14:03:49 UTC
  • mfrom: (1346.2.488 unity)
  • Revision ID: bilalakhtar@ubuntu.com-20120115140349-mht4dke0occbsyra
MergeĀ fromĀ trunk

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
#include <Nux/Nux.h>
 
24
 
 
25
namespace unity
 
26
{
 
27
class ScreenEffectFramebufferObject
 
28
{
 
29
public:
 
30
 
 
31
  typedef boost::shared_ptr <ScreenEffectFramebufferObject> Ptr;
 
32
  typedef void (*FuncPtr) (void);
 
33
  typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
 
34
 
 
35
  ScreenEffectFramebufferObject (GLXGetProcAddressProc, const nux::Geometry &geom);
 
36
  ~ScreenEffectFramebufferObject ();
 
37
 
 
38
public:
 
39
 
 
40
  void bind (const nux::Geometry &geom);
 
41
  void unbind ();
 
42
 
 
43
  bool status ();
 
44
  void paint (const nux::Geometry &geom);
 
45
  bool bound () { return mBoundCnt > 0; }
 
46
 
 
47
  GLuint texture () { return mFBTexture; }
 
48
  
 
49
  void onScreenSizeChanged (const nux::Geometry &screenSize);
 
50
 
 
51
private:
 
52
 
 
53
  FuncPtr getProcAddr (const std::string &);
 
54
 
 
55
  typedef void (*GLActiveTextureProc) (GLenum texture);
 
56
  typedef void (*GLGenFramebuffersProc) (GLsizei n,
 
57
                                         GLuint  *framebuffers);
 
58
  typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
 
59
                                            GLuint  *framebuffers);
 
60
  typedef void (*GLBindFramebufferProc) (GLenum target,
 
61
                                         GLuint framebuffer);
 
62
  typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
 
63
  typedef void (*GLFramebufferTexture2DProc) (GLenum target,
 
64
                                              GLenum attachment,
 
65
                                              GLenum textarget,
 
66
                                              GLuint texture,
 
67
                                              GLint  level);
 
68
  
 
69
  GLXGetProcAddressProc getProcAddressGLX;
 
70
  GLActiveTextureProc activeTexture;
 
71
  GLGenFramebuffersProc genFramebuffers;
 
72
  GLDeleteFramebuffersProc deleteFramebuffers;
 
73
  GLBindFramebufferProc bindFramebuffer;
 
74
  GLCheckFramebufferStatusProc checkFramebufferStatus;
 
75
  GLFramebufferTexture2DProc framebufferTexture2D;
 
76
  /* compiz fbo handle that goes through to nux */
 
77
  GLuint   mFboHandle; // actual handle to the framebuffer_ext
 
78
  bool    mFboStatus; // did the framebuffer texture bind succeed
 
79
  GLuint   mFBTexture;
 
80
  nux::Geometry mGeometry;
 
81
  unsigned int mBoundCnt;
 
82
  
 
83
  nux::Geometry mScreenSize;
 
84
};
 
85
} // namespace unity
 
86
 
 
87
#endif