[cogl/wip/outputs: 2/11] Removes the CoglSwapChain api
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/outputs: 2/11] Removes the CoglSwapChain api
- Date: Mon, 12 Aug 2013 16:46:43 +0000 (UTC)
commit fe921310932028dac1d79e5e9536a02418f79744
Author: Robert Bragg <robert linux intel com>
Date: Fri Mar 1 15:40:03 2013 +0000
Removes the CoglSwapChain api
The CoglSwapChain api made initializing a context more awkward than it
ought to be in the relatively common case where you want onscreen
framebuffers to have an alpha channel.
The api let you specify an explicit swap-chain length and also request
that the swap chain buffers should have an alpha component and then the
a CoglSwapChain could be used to construct a CoglOnscreenTemplate
This removes the CoglSwapChain object and apis and adds a
cogl_onscreen_template_set_has_alpha() api instead. Since we can't
normally control exactly how long the swap chain is even if we have api
to request a length this patch doesn't replace that capability.
One thing to note here is that this removes the ability to request a
single buffered CoglOnscreen framebuffer but since we have never had a
use case for that and have not generally considered the implications of
supporting single buffered rendering in Cogl's design it is probably for
the best not to imply that it's supported.
cogl/Makefile.am | 4 --
cogl/cogl-display.c | 2 +-
cogl/cogl-framebuffer-private.h | 2 +-
cogl/cogl-gles2-context.c | 1 -
cogl/cogl-onscreen-template-private.h | 2 +-
cogl/cogl-onscreen-template.c | 15 ++++---
cogl/cogl-onscreen-template.h | 26 ++++++++++--
cogl/cogl-onscreen.c | 1 -
cogl/cogl-swap-chain-private.h | 38 ------------------
cogl/cogl-swap-chain.c | 68 --------------------------------
cogl/cogl-swap-chain.h | 51 ------------------------
cogl/cogl.h | 1 -
cogl/cogl.symbols | 5 +--
cogl/winsys/cogl-winsys-egl-gdl.c | 13 +------
cogl/winsys/cogl-winsys-egl.c | 3 +-
cogl/winsys/cogl-winsys-glx.c | 8 +--
cogl/winsys/cogl-winsys-sdl.c | 7 +--
cogl/winsys/cogl-winsys-sdl2.c | 7 +--
cogl/winsys/cogl-winsys-wgl.c | 3 +-
doc/reference/cogl2/cogl2-sections.txt | 16 +------
examples/cogl-msaa.c | 2 +-
examples/cogl-x11-foreign.c | 21 +++-------
examples/cogl-x11-tfp.c | 20 +++-------
23 files changed, 61 insertions(+), 255 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 5c30102..4538301 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -96,7 +96,6 @@ cogl_public_h = \
$(srcdir)/cogl-renderer.h \
$(srcdir)/cogl-snippet.h \
$(srcdir)/cogl-sub-texture.h \
- $(srcdir)/cogl-swap-chain.h \
$(srcdir)/cogl-texture-2d-gl.h \
$(srcdir)/cogl-texture-2d-sliced.h \
$(srcdir)/cogl-texture-2d.h \
@@ -210,9 +209,6 @@ cogl_sources_c = \
$(srcdir)/cogl-renderer-private.h \
$(srcdir)/cogl-renderer.h \
$(srcdir)/cogl-renderer.c \
- $(srcdir)/cogl-swap-chain-private.h \
- $(srcdir)/cogl-swap-chain.h \
- $(srcdir)/cogl-swap-chain.c \
$(srcdir)/cogl-onscreen-template-private.h \
$(srcdir)/cogl-onscreen-template.h \
$(srcdir)/cogl-onscreen-template.c \
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
index cedd68b..921a59e 100644
--- a/cogl/cogl-display.c
+++ b/cogl/cogl-display.c
@@ -131,7 +131,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display,
/* NB: we want to maintain the invariable that there is always an
* onscreen template associated with a CoglDisplay... */
if (!onscreen_template)
- display->onscreen_template = cogl_onscreen_template_new (NULL);
+ display->onscreen_template = cogl_onscreen_template_new ();
}
CoglBool
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index 2dfcb6e..ffe5e86 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -49,7 +49,7 @@ typedef enum _CoglFramebufferType {
typedef struct
{
- CoglSwapChain *swap_chain;
+ CoglBool has_alpha;
CoglBool need_stencil;
int samples_per_pixel;
CoglBool swap_throttled;
diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
index 4063fdc..d270f7c 100644
--- a/cogl/cogl-gles2-context.c
+++ b/cogl/cogl-gles2-context.c
@@ -42,7 +42,6 @@
#include "cogl-framebuffer-gl-private.h"
#include "cogl-onscreen-template-private.h"
#include "cogl-renderer-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-texture-2d-gl.h"
#include "cogl-texture-2d-private.h"
#include "cogl-pipeline-opengl-private.h"
diff --git a/cogl/cogl-onscreen-template-private.h b/cogl/cogl-onscreen-template-private.h
index b080b57..3dc937f 100644
--- a/cogl/cogl-onscreen-template-private.h
+++ b/cogl/cogl-onscreen-template-private.h
@@ -25,8 +25,8 @@
#define __COGL_ONSCREEN_TEMPLATE_PRIVATE_H
#include "cogl-object-private.h"
-#include "cogl-swap-chain.h"
#include "cogl-framebuffer-private.h"
+#include "cogl-boxed-value.h"
struct _CoglOnscreenTemplate
{
diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c
index 5fa5b99..6141444 100644
--- a/cogl/cogl-onscreen-template.c
+++ b/cogl/cogl-onscreen-template.c
@@ -46,17 +46,11 @@ _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
}
CoglOnscreenTemplate *
-cogl_onscreen_template_new (CoglSwapChain *swap_chain)
+cogl_onscreen_template_new (void)
{
CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate);
char *user_config;
- onscreen_template->config.swap_chain = swap_chain;
- if (swap_chain)
- cogl_object_ref (swap_chain);
- else
- onscreen_template->config.swap_chain = cogl_swap_chain_new ();
-
onscreen_template->config.swap_throttled = TRUE;
onscreen_template->config.need_stencil = TRUE;
onscreen_template->config.samples_per_pixel = 0;
@@ -88,3 +82,10 @@ cogl_onscreen_template_set_swap_throttled (
{
onscreen_template->config.swap_throttled = throttled;
}
+
+void
+cogl_onscreen_template_set_has_alpha (CoglOnscreenTemplate *onscreen_template,
+ CoglBool has_alpha)
+{
+ onscreen_template->config.has_alpha = has_alpha;
+}
diff --git a/cogl/cogl-onscreen-template.h b/cogl/cogl-onscreen-template.h
index 58d88d4..d69798a 100644
--- a/cogl/cogl-onscreen-template.h
+++ b/cogl/cogl-onscreen-template.h
@@ -31,8 +31,6 @@
#ifndef __COGL_ONSCREEN_TEMPLATE_H__
#define __COGL_ONSCREEN_TEMPLATE_H__
-#include <cogl/cogl-swap-chain.h>
-
COGL_BEGIN_DECLS
typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
@@ -40,11 +38,11 @@ typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT)
CoglOnscreenTemplate *
-cogl_onscreen_template_new (CoglSwapChain *swap_chain);
+cogl_onscreen_template_new (void);
/**
* cogl_onscreen_template_set_samples_per_pixel:
- * @onscreen: A #CoglOnscreenTemplate template framebuffer
+ * @onscreen_template: A #CoglOnscreenTemplate template framebuffer
* @n: The minimum number of samples per pixel
*
* Requires that any future CoglOnscreen framebuffers derived from
@@ -88,6 +86,26 @@ cogl_onscreen_template_set_swap_throttled (
CoglBool throttled);
/**
+ * cogl_onscreen_template_set_has_alpha:
+ * @onscreen_template: A #CoglOnscreenTemplate template framebuffer
+ * @has_alpha: Whether an alpha channel is required
+ *
+ * Requests that any future #CoglOnscreen framebuffers derived from
+ * this template should have an alpha channel if @has_alpha is %TRUE.
+ * If @has_alpha is FALSE then future framebuffers derived from this
+ * template aren't required to have an alpha channel, although Cogl
+ * may choose to ignore this and allocate a redundant alpha channel.
+ *
+ * By default a template does not request an alpha component.
+ *
+ * Since: 1.16
+ * Stability: unstable
+ */
+void
+cogl_onscreen_template_set_has_alpha (CoglOnscreenTemplate *onscreen_template,
+ CoglBool has_alpha);
+
+/**
* cogl_is_onscreen_template:
* @object: A #CoglObject pointer
*
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index c115a6e..c7492c8 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -52,7 +52,6 @@ _cogl_onscreen_init_from_template (CoglOnscreen *onscreen,
_cogl_list_init (&onscreen->dirty_closures);
framebuffer->config = onscreen_template->config;
- cogl_object_ref (framebuffer->config.swap_chain);
}
CoglOnscreen *
diff --git a/cogl/cogl.h b/cogl/cogl.h
index e515af4..304beed 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -45,7 +45,6 @@
#include <cogl/cogl-enum-types.h>
#endif
-#include <cogl/cogl-swap-chain.h>
#include <cogl/cogl-renderer.h>
#include <cogl/cogl-output.h>
#include <cogl/cogl-display.h>
diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
index 21a0c81..714ef15 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -357,6 +357,7 @@ cogl_onscreen_show
cogl_onscreen_swap_buffers
cogl_onscreen_swap_region
cogl_onscreen_template_new
+cogl_onscreen_template_set_has_alpha
cogl_onscreen_template_set_samples_per_pixel
cogl_onscreen_template_set_swap_throttled
@@ -540,10 +541,6 @@ cogl_snippet_set_replace
cogl_sub_texture_get_parent
cogl_sub_texture_new
-cogl_swap_chain_new
-cogl_swap_chain_set_has_alpha
-cogl_swap_chain_set_length
-
cogl_texture_error_domain
cogl_texture_flags_get_type
cogl_texture_get_data
diff --git a/cogl/winsys/cogl-winsys-egl-gdl.c b/cogl/winsys/cogl-winsys-egl-gdl.c
index f8b4a13..9bbce35 100644
--- a/cogl/winsys/cogl-winsys-egl-gdl.c
+++ b/cogl/winsys/cogl-winsys-egl-gdl.c
@@ -35,7 +35,6 @@
#include "cogl-framebuffer-private.h"
#include "cogl-onscreen-private.h"
#include "cogl-onscreen-template-private.h"
-#include "cogl-swap-chain-private.h"
static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable;
@@ -223,18 +222,8 @@ gdl_plane_init (CoglDisplay *display, CoglError **error)
if (rc == GDL_SUCCESS)
rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect);
- /* Default to triple buffering if the swap_chain doesn't have an explicit
- * length */
if (rc == GDL_SUCCESS)
- {
- if (display->onscreen_template->config.swap_chain &&
- display->onscreen_template->config.swap_chain->length != -1)
- rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES,
- display->onscreen_template->
- config.swap_chain->length);
- else
- rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 3);
- }
+ rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 3);
if (rc == GDL_SUCCESS)
rc = gdl_plane_config_end (GDL_FALSE);
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 4ccebcd..e5aa7e8 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -36,7 +36,6 @@
#include "cogl-context-private.h"
#include "cogl-framebuffer.h"
#include "cogl-onscreen-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-renderer-private.h"
#include "cogl-onscreen-template-private.h"
#include "cogl-gles2-context-private.h"
@@ -246,7 +245,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = 1;
attributes[i++] = EGL_ALPHA_SIZE;
- attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE;
+ attributes[i++] = config->has_alpha ? 1 : EGL_DONT_CARE;
attributes[i++] = EGL_DEPTH_SIZE;
attributes[i++] = 1;
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 3f9e017..9f90a8f 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -34,7 +34,6 @@
#include "cogl-feature-private.h"
#include "cogl-context-private.h"
#include "cogl-framebuffer.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-renderer-private.h"
#include "cogl-glx-renderer-private.h"
#include "cogl-onscreen-template-private.h"
@@ -46,7 +45,6 @@
#include "cogl-frame-info-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-onscreen-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-xlib-renderer.h"
#include "cogl-util.h"
#include "cogl-winsys-glx-private.h"
@@ -874,7 +872,7 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = GLX_BLUE_SIZE;
attributes[i++] = 1;
attributes[i++] = GLX_ALPHA_SIZE;
- attributes[i++] = config->swap_chain->has_alpha ? 1 : GLX_DONT_CARE;
+ attributes[i++] = config->has_alpha ? 1 : GLX_DONT_CARE;
attributes[i++] = GLX_DEPTH_SIZE;
attributes[i++] = 1;
attributes[i++] = GLX_STENCIL_SIZE;
@@ -927,7 +925,7 @@ find_fbconfig (CoglDisplay *display,
goto done;
}
- if (config->swap_chain->has_alpha)
+ if (config->has_alpha)
{
int i;
@@ -1005,7 +1003,7 @@ create_context (CoglDisplay *display, CoglError **error)
_cogl_xlib_renderer_get_data (display->renderer);
CoglGLXRenderer *glx_renderer = display->renderer->winsys;
CoglBool support_transparent_windows =
- display->onscreen_template->config.swap_chain->has_alpha;
+ display->onscreen_template->config.has_alpha;
GLXFBConfig config;
CoglError *fbconfig_error = NULL;
XSetWindowAttributes attrs;
diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c
index 75b7edd..9d6d8ae 100644
--- a/cogl/winsys/cogl-winsys-sdl.c
+++ b/cogl/winsys/cogl-winsys-sdl.c
@@ -32,7 +32,6 @@
#include "cogl-renderer-private.h"
#include "cogl-display-private.h"
#include "cogl-framebuffer-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-onscreen-template-private.h"
#include "cogl-context-private.h"
#include "cogl-onscreen-private.h"
@@ -146,12 +145,10 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)
SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE,
config->need_stencil ? 1 : 0);
- if (config->swap_chain->length >= 0)
- SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,
- config->swap_chain->length > 1 ? 1 : 0);
+ SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE,
- config->swap_chain->has_alpha ? 1 : 0);
+ config->has_alpha ? 1 : 0);
}
static CoglBool
diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c
index 58666cb..00445b8 100644
--- a/cogl/winsys/cogl-winsys-sdl2.c
+++ b/cogl/winsys/cogl-winsys-sdl2.c
@@ -32,7 +32,6 @@
#include "cogl-renderer-private.h"
#include "cogl-display-private.h"
#include "cogl-framebuffer-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-onscreen-template-private.h"
#include "cogl-context-private.h"
#include "cogl-onscreen-private.h"
@@ -138,12 +137,10 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)
SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE,
config->need_stencil ? 1 : 0);
- if (config->swap_chain->length >= 0)
- SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,
- config->swap_chain->length > 1 ? 1 : 0);
+ SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE,
- config->swap_chain->has_alpha ? 1 : 0);
+ config->has_alpha ? 1 : 0);
}
static CoglBool
diff --git a/cogl/winsys/cogl-winsys-wgl.c b/cogl/winsys/cogl-winsys-wgl.c
index 6a32e63..d83ff91 100644
--- a/cogl/winsys/cogl-winsys-wgl.c
+++ b/cogl/winsys/cogl-winsys-wgl.c
@@ -37,7 +37,6 @@
#include "cogl-context-private.h"
#include "cogl-framebuffer.h"
#include "cogl-onscreen-private.h"
-#include "cogl-swap-chain-private.h"
#include "cogl-renderer-private.h"
#include "cogl-display-private.h"
#include "cogl-onscreen-template-private.h"
@@ -423,7 +422,7 @@ choose_pixel_format (CoglFramebufferConfig *config,
already found */
(best_pf == 0 || pixel_format_is_better (&best_pfd, pfd)))
{
- if (config->swap_chain->has_alpha && pfd->cAlphaBits == 0)
+ if (config->has_alpha && pfd->cAlphaBits == 0)
continue;
if (config->need_stencil && pfd->cStencilBits == 0)
continue;
diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
index 2c7b225..5a1356f 100644
--- a/doc/reference/cogl2/cogl2-sections.txt
+++ b/doc/reference/cogl2/cogl2-sections.txt
@@ -97,19 +97,6 @@ cogl_wayland_renderer_get_shell
</SECTION>
<SECTION>
-<FILE>cogl-swap-chain</FILE>
-<TITLE>CoglSwapChain: Describe a set of back buffers for flipping between</TITLE>
-<SUBSECTION>
-CoglSwapChain
-cogl_is_swap_chain
-
-<SUBSECTION>
-cogl_swap_chain_new
-cogl_swap_chain_set_has_alpha
-cogl_swap_chain_set_length
-</SECTION>
-
-<SECTION>
<FILE>cogl-onscreen-template</FILE>
<TITLE>CoglOnscreenTemplate: Describe a template for onscreen framebuffers</TITLE>
<SUBSECTION>
@@ -118,6 +105,9 @@ cogl_is_onscreen_template
<SUBSECTION>
cogl_onscreen_template_new
+cogl_onscreen_template_set_has_alpha
+cogl_onscreen_template_set_swap_throttled
+cogl_onscreen_template_set_samples_per_pixel
</SECTION>
<SECTION>
diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c
index 9fa7a3a..c0d9065 100644
--- a/examples/cogl-msaa.c
+++ b/examples/cogl-msaa.c
@@ -22,7 +22,7 @@ main (int argc, char **argv)
CoglFramebuffer *offscreen_fb;
CoglPipeline *pipeline;
- onscreen_template = cogl_onscreen_template_new (NULL);
+ onscreen_template = cogl_onscreen_template_new ();
cogl_onscreen_template_set_samples_per_pixel (onscreen_template, 4);
display = cogl_display_new (NULL, onscreen_template);
diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c
index 1622266..cdc2c88 100644
--- a/examples/cogl-x11-foreign.c
+++ b/examples/cogl-x11-foreign.c
@@ -46,7 +46,6 @@ main (int argc, char **argv)
{
Display *xdpy;
CoglRenderer *renderer;
- CoglSwapChain *chain;
CoglOnscreenTemplate *onscreen_template;
CoglDisplay *display;
CoglContext *ctx;
@@ -77,10 +76,8 @@ main (int argc, char **argv)
return 1;
}
- /* Conceptually choose a GPU... */
+ /* Choose a means to render... */
renderer = cogl_renderer_new ();
- /* FIXME: This should conceptually be part of the configuration of
- * a renderer. */
cogl_xlib_renderer_set_foreign_display (renderer, xdpy);
if (!cogl_renderer_connect (renderer, &error))
{
@@ -88,17 +85,13 @@ main (int argc, char **argv)
error->message);
}
- chain = cogl_swap_chain_new ();
- cogl_swap_chain_set_has_alpha (chain, TRUE);
+ /* Create a template for onscreen framebuffers that requests an
+ * alpha component */
+ onscreen_template = cogl_onscreen_template_new ();
+ cogl_onscreen_template_set_has_alpha (onscreen_template, TRUE);
- /* Conceptually declare upfront the kinds of windows we anticipate
- * creating so that when we configure the display pipeline we can avoid
- * having an impedance miss-match between the format of windows and the
- * format the display pipeline expects. */
- onscreen_template = cogl_onscreen_template_new (chain);
- cogl_object_unref (chain);
-
- /* Conceptually setup a display pipeline */
+ /* Give Cogl our template for onscreen framebuffers which can
+ * influence how the context will be setup */
display = cogl_display_new (renderer, onscreen_template);
cogl_object_unref (renderer);
if (!cogl_display_setup (display, &error))
diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c
index e7d7b0e..7788da4 100644
--- a/examples/cogl-x11-tfp.c
+++ b/examples/cogl-x11-tfp.c
@@ -43,7 +43,6 @@ main (int argc, char **argv)
Display *xdpy;
int composite_error = 0, composite_event = 0;
CoglRenderer *renderer;
- CoglSwapChain *chain;
CoglOnscreenTemplate *onscreen_template;
CoglDisplay *display;
CoglContext *ctx;
@@ -87,10 +86,8 @@ main (int argc, char **argv)
}
}
- /* Conceptually choose a GPU... */
+ /* Choose a means to render... */
renderer = cogl_renderer_new ();
- /* FIXME: This should conceptually be part of the configuration of
- * a renderer. */
cogl_xlib_renderer_set_foreign_display (renderer, xdpy);
if (!cogl_renderer_connect (renderer, &error))
{
@@ -98,17 +95,12 @@ main (int argc, char **argv)
error->message);
}
- chain = cogl_swap_chain_new ();
- cogl_swap_chain_set_has_alpha (chain, TRUE);
+ /* Request that onscreen framebuffers should have an alpha component */
+ onscreen_template = cogl_onscreen_template_new ();
+ cogl_onscreen_template_set_has_alpha (onscreen_template, TRUE);
- /* Conceptually declare upfront the kinds of windows we anticipate
- * creating so that when we configure the display pipeline we can avoid
- * having an impedance miss-match between the format of windows and the
- * format the display pipeline expects. */
- onscreen_template = cogl_onscreen_template_new (chain);
- cogl_object_unref (chain);
-
- /* Conceptually setup a display pipeline */
+ /* Give Cogl our template for onscreen windows which can influence
+ * how the context will be setup */
display = cogl_display_new (renderer, onscreen_template);
cogl_object_unref (renderer);
if (!cogl_display_setup (display, &error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]