~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/cairo-dock-opengl.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* This file is a part of the Cairo-Dock project
3
 
*
4
 
* Copyright : (C) see the 'copyright' file.
5
 
* E-mail    : see the 'copyright' file.
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
 
* You should have received a copy of the GNU General Public License
17
 
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
*/
19
 
 
20
 
 
21
 
#ifndef __CAIRO_DOCK_OPENGL__
22
 
#define  __CAIRO_DOCK_OPENGL__
23
 
 
24
 
#include <glib.h>
25
 
 
26
 
#include <gdk/x11/gdkglx.h>
27
 
 
28
 
#include "cairo-dock-struct.h"
29
 
#include "cairo-dock-container.h"
30
 
 
31
 
G_BEGIN_DECLS
32
 
 
33
 
/**
34
 
*@file cairo-dock-opengl.h This class manages the OpenGL backend and context.
35
 
*/
36
 
 
37
 
/// This strucure summarizes the available OpenGL configuration on the system.
38
 
struct _CairoDockGLConfig {
39
 
        GdkGLConfig *pGlConfig;
40
 
        gboolean bHasBeenForced;
41
 
        gboolean bIndirectRendering;
42
 
        gboolean bAlphaAvailable;
43
 
        gboolean bStencilBufferAvailable;
44
 
        gboolean bPBufferAvailable;
45
 
        gboolean bNonPowerOfTwoAvailable;
46
 
        gboolean bTextureFromPixmapAvailable;
47
 
        gint iGlxMajor, iGlxMinor;
48
 
        GLXPbuffer iconPbuffer;
49
 
        GLXContext iconContext;
50
 
        gint iIconPbufferWidth, iIconPbufferHeight;
51
 
        void (*bindTexImage) (Display *display, GLXDrawable drawable, int buffer, int *attribList);
52
 
        void (*releaseTexImage) (Display *display, GLXDrawable drawable, int buffer);
53
 
        } ;
54
 
 
55
 
 
56
 
  ///////////////////
57
 
 // CONFIGURATION //
58
 
///////////////////
59
 
/** Initialize the OpenGL backend, by trying to get a suitable GLX configuration.
60
 
*@param bToggleIndirectRendering whether to toggle on/off the indirect rendering mode that have been detected by the function (for cards like Radeon 35xx).
61
 
*@param bForceOpenGL whether to force the use of OpenGL, or let the function decide.
62
 
*@return TRUE if OpenGL is usable.
63
 
*/
64
 
gboolean cairo_dock_initialize_opengl_backend (gboolean bToggleIndirectRendering, gboolean bForceOpenGL);
65
 
 
66
 
#define cairo_dock_opengl_is_safe(...) (g_openglConfig.pGlConfig != NULL && ! g_openglConfig.bIndirectRendering && g_openglConfig.bAlphaAvailable && g_openglConfig.bStencilBufferAvailable && g_openglConfig.bPBufferAvailable && g_openglConfig.bNonPowerOfTwoAvailable)
67
 
 
68
 
#define cairo_dock_deactivate_opengl(...) do {\
69
 
        g_bUseOpenGL = FALSE;\
70
 
        g_openglConfig.pGlConfig = NULL; } while (0)
71
 
 
72
 
  ///////////////////////
73
 
 // RENDER TO TEXTURE //
74
 
///////////////////////
75
 
/** Create a pbuffer that will fit the icons of the docks. Do nothing it a pbuffer with the correct size already exists.
76
 
*/
77
 
void cairo_dock_create_icon_pbuffer (void);
78
 
/** Destroy the icons pbuffer.
79
 
*/
80
 
void cairo_dock_destroy_icon_pbuffer (void);
81
 
 
82
 
/** Initiate an OpenGL drawing session on an icon's texture.
83
 
*@param pIcon the icon on which to draw.
84
 
*@param pContainer its container.
85
 
*@return TRUE if you can proceed to the drawing, FALSE if an error occured.
86
 
*/
87
 
gboolean cairo_dock_begin_draw_icon (Icon *pIcon, CairoContainer *pContainer);
88
 
/** Finish an OpenGL drawing session on an icon.
89
 
*@param pIcon the icon on which to draw.
90
 
*@param pContainer its container.
91
 
*@return TRUE if you can proceed to the drawing, FALSE if an error occured.
92
 
*/
93
 
void cairo_dock_end_draw_icon (Icon *pIcon, CairoContainer *pContainer);
94
 
 
95
 
 
96
 
  /////////////
97
 
 // CONTEXT //
98
 
/////////////
99
 
/** Set a perspective view to the current GL context. Perspective view accentuates the depth effect of the scene, but can distort it on the edges, and is difficult to manipulate because the size of objects depends on their position.
100
 
*@param iWidth width of the container
101
 
*@param iHeight height of the container
102
 
*/
103
 
void cairo_dock_set_perspective_view (int iWidth, int iHeight);
104
 
/** Set an orthogonal view to the current GL context. Orthogonal view is convenient to draw classic 2D, because the objects are not zoomed according to their position. The drawback is a poor depth effect.
105
 
*@param iWidth width of the container
106
 
*@param iHeight height of the container
107
 
*/
108
 
void cairo_dock_set_ortho_view (int iWidth, int iHeight);
109
 
 
110
 
/** Apply the desktop background onto a container, to emulate fake transparency.
111
 
*@param pContainer the container
112
 
*/
113
 
void cairo_dock_apply_desktop_background_opengl (CairoContainer *pContainer);
114
 
 
115
 
/** Set a shared default-initialized GL context on a window.
116
 
*@param pWindow the window, not yet realized.
117
 
*/
118
 
void cairo_dock_set_gl_capabilities (GtkWidget *pWindow);
119
 
 
120
 
 
121
 
#endif