1 /* Cairo - a vector graphics library with display and print output
3 * Copyright © 2009 Eric Anholt
4 * Copyright © 2009 Chris Wilson
6 * This library is free software; you can redistribute it and/or
7 * modify it either under the terms of the GNU Lesser General Public
8 * License version 2.1 as published by the Free Software Foundation
9 * (the "LGPL") or, at your option, under the terms of the Mozilla
10 * Public License Version 1.1 (the "MPL"). If you do not alter this
11 * notice, a recipient may use your version of this file under either
12 * the MPL or the LGPL.
14 * You should have received a copy of the LGPL along with this library
15 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17 * You should have received a copy of the MPL along with this library
18 * in the file COPYING-MPL-1.1
20 * The contents of this file are subject to the Mozilla Public License
21 * Version 1.1 (the "License"); you may not use this file except in
22 * compliance with the License. You may obtain a copy of the License at
23 * http://www.mozilla.org/MPL/
25 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27 * the specific language governing rights and limitations.
29 * The Original Code is the cairo graphics library.
31 * The Initial Developer of the Original Code is Eric Anholt.
37 * The cairo-gl backend provides an implementation of possibly
38 * hardware-accelerated cairo rendering by targeting the OpenGL API.
39 * The goal of the cairo-gl backend is to provide better performance
40 * with equal functionality to cairo-image where possible. It does
41 * not directly provide for applying additional OpenGL effects to
44 * Cairo-gl allows interoperability with other GL rendering through GL
45 * context sharing. Cairo-gl surfaces are created in reference to a
46 * #cairo_device_t, which represents an GL context created by the user.
47 * When that GL context is created with its sharePtr set to another
48 * context (or vice versa), its objects (textures backing cairo-gl
49 * surfaces) can be accessed in the other OpenGL context. This allows
50 * cairo-gl to maintain its drawing state in one context while the
51 * user's 3D rendering occurs in the user's other context.
53 * However, as only one context can be current to a thread at a time,
54 * cairo-gl may make its context current to the thread on any cairo
55 * call which interacts with a cairo-gl surface or the cairo-gl
56 * device. As a result, the user must make their own context current
57 * between any cairo calls and their own OpenGL rendering.
65 #if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE
69 cairo_public cairo_surface_t *
70 cairo_gl_surface_create (cairo_device_t *device,
71 cairo_content_t content,
72 int width, int height);
74 cairo_public cairo_surface_t *
75 cairo_gl_surface_create_for_texture (cairo_device_t *abstract_device,
76 cairo_content_t content,
78 int width, int height);
80 cairo_gl_surface_set_size (cairo_surface_t *surface, int width, int height);
83 cairo_gl_surface_get_width (cairo_surface_t *abstract_surface);
86 cairo_gl_surface_get_height (cairo_surface_t *abstract_surface);
89 cairo_gl_surface_swapbuffers (cairo_surface_t *surface);
91 #if CAIRO_HAS_GLX_FUNCTIONS
94 cairo_public cairo_device_t *
95 cairo_glx_device_create (Display *dpy, GLXContext gl_ctx);
97 cairo_public Display *
98 cairo_glx_device_get_display (cairo_device_t *device);
100 cairo_public GLXContext
101 cairo_glx_device_get_context (cairo_device_t *device);
103 cairo_public cairo_surface_t *
104 cairo_gl_surface_create_for_window (cairo_device_t *device,
106 int width, int height);
109 #if CAIRO_HAS_WGL_FUNCTIONS
112 cairo_public cairo_device_t *
113 cairo_wgl_device_create (HGLRC rc);
116 cairo_wgl_device_get_context (cairo_device_t *device);
118 cairo_public cairo_surface_t *
119 cairo_gl_surface_create_for_dc (cairo_device_t *device,
125 #if CAIRO_HAS_EGL_FUNCTIONS
128 cairo_public cairo_device_t *
129 cairo_egl_device_create (EGLDisplay dpy, EGLContext egl);
131 cairo_public cairo_surface_t *
132 cairo_gl_surface_create_for_egl (cairo_device_t *device,
141 #else /* CAIRO_HAS_GL_SURFACE */
142 # error Cairo was not compiled with support for the GL backend
143 #endif /* CAIRO_HAS_GL_SURFACE */
145 #endif /* CAIRO_GL_H */