summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-03-22 21:18:53 +0000
committerRobert Bragg <robert@linux.intel.com>2013-04-24 22:23:50 +0100
commitafbb13e1a404f922fd25ae6df53a4d0382ad0e01 (patch)
tree120d3d74a082b25f5b29cd904e06fce9180a516e /examples
parentb5e57c914b943ca32a8ae51078c75eddbbea2bff (diff)
downloadcogl-afbb13e1a404f922fd25ae6df53a4d0382ad0e01.tar.gz
Add compiler deprecation warnings
This adds compiler symbol deprecation declarations for old Cogl APIs so that users can easily see via compiler warning when they are using these symbols, and also see a hint for what the apis should be replaced with. So that users of Cogl can manage when to show these warnings this introduces a scheme borrowed from glib whereby you can declare what version of the Cogl api you are using: COGL_VERSION_MIN_REQUIRED can be defined to indicate the oldest Cogl api that the application wants to use. Cogl will only warn about deprecations for symbols that were deprecated earlier than this required version. If this is left undefined then by default Cogl will warn about all deprecations. COGL_VERSION_MAX_ALLOWED can be defined to indicate the newest api that the application uses. If the application uses symbols newer than this then Cogl will give a warning about that. This patch removes the need to maintain the COGL_DISABLE_DEPRECATED guards around deprecated symbols. This patch fixes a few uses of deprecated symbols in the examples/ Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/cogl-crate.c12
-rw-r--r--examples/cogland.c12
2 files changed, 9 insertions, 15 deletions
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index 0c6bc1f7..47de34d0 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -169,8 +169,9 @@ main (int argc, char **argv)
cogl_onscreen_show (onscreen);
- cogl_push_framebuffer (fb);
- cogl_set_viewport (0, 0, data.framebuffer_width, data.framebuffer_height);
+ cogl_framebuffer_set_viewport (fb, 0, 0,
+ data.framebuffer_width,
+ data.framebuffer_height);
fovy = 60; /* y-axis field of view */
aspect = (float)data.framebuffer_width/(float)data.framebuffer_height;
@@ -178,7 +179,7 @@ main (int argc, char **argv)
z_2d = 1000; /* position to 2d plane */
z_far = 2000; /* distance to far clipping plane */
- cogl_perspective (fovy, aspect, z_near, z_far);
+ cogl_framebuffer_perspective (fb, fovy, aspect, z_near, z_far);
/* Since the pango renderer emits geometry in pixel/device coordinates
* and the anti aliasing is implemented with the assumption that the
@@ -195,12 +196,11 @@ main (int argc, char **argv)
cogl_matrix_view_2d_in_perspective (&data.view, fovy, aspect, z_near, z_2d,
data.framebuffer_width,
data.framebuffer_height);
- cogl_set_modelview_matrix (&data.view);
- cogl_pop_framebuffer ();
+ cogl_framebuffer_set_modelview_matrix (fb, &data.view);
/* Initialize some convenient constants */
cogl_matrix_init_identity (&identity);
- cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
+ cogl_color_init_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
/* rectangle indices allow the GPU to interpret a list of quads (the
* faces of our cube) as a list of triangles.
diff --git a/examples/cogland.c b/examples/cogland.c
index 7a027197..b5778fce 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -806,15 +806,9 @@ cogland_compositor_create_output (CoglandCompositor *compositor,
g_error ("Failed to allocate framebuffer: %s\n", error->message);
cogl_onscreen_show (output->onscreen);
-#if 0
- cogl_framebuffer_set_viewport (fb, x, y, width, height);
-#else
- cogl_push_framebuffer (fb);
- cogl_set_viewport (-x, -y,
- compositor->virtual_width,
- compositor->virtual_height);
- cogl_pop_framebuffer ();
-#endif
+ cogl_framebuffer_set_viewport (fb, -x, -y,
+ compositor->virtual_width,
+ compositor->virtual_height);
mode = g_slice_new0 (CoglandMode);
mode->flags = 0;