1
0
Fork 0
Commit graph

7 commits

Author SHA1 Message Date
Robert Bragg
cdbc1dc9b1 examples: Remove explicit framebuffer allocations
It used to be that cogl_framebuffer_allocate() had to be done explicitly
but we have since made Cogl lazily allocate framebuffers when they are
first used if they haven't already been explicitly allocated. Developers
only need to explicitly allocate framebuffers if they are planning to
gracefully handle any errors. In cases where the program will simply
abort due to an allocation error they can simply rely on implicit
allocation which will cause an abort on error.

This updates the examples to not explicitly allocate the framebuffers
since they all just abort on error anyway.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:09:15 +00:00
Neil Roberts
e28db24f7d cogl-crate: Optionally use the swap buffers notify mechanism
If the swap buffers notify mechanism is advertised then the crate
example will now register a callback for it and call g_poll with the
proper timeout from cogl_context_begin_idle instead of trying to
repaint continuously.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-09 18:59:59 +00:00
Neil Roberts
6731569c18 Update all of the examples to use cogl_poll_get_info
The aim is that it should be a requirement that all Cogl applications
hook their mainloops into Cogl so we should lead by examples. Most of
the examples now just call cogl_poll_get_info and then g_poll with a
zero timeout so that they can continue to constantly redraw.

The SDL example is a bit special because SDL makes it very difficult
to wait on either a timeout or any file descriptors. The SDL winsys is
documented not to require blocking on any file descriptors so we can
ignore that. It implements the timeout by adding an SDL timer which
pushes an event to the queue to wake up SDL_GetEvent.

The Cogland example was already using the glib main loop so that one
has been updated to add the CoglGLibSource to it.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:41:00 +00:00
Rob Bradford
3bf8d45529 examples: Query the size of the framebuffer
The size of the framebuffer may not be the size of the framebuffer that we
requested - we should use the actual size of the framebuffer in the
calculations to position the crate in the center.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-14 18:59:52 +00:00
Jasper St. Pierre
5f7cdfed69 crate: Use indices
https://bugzilla.gnome.org/show_bug.cgi?id=661019

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-01 12:50:43 +00:00
Neil Roberts
dedee399d6 Rotate according to time not number of frames in the crate example
Previously the crate example incremented the angle of rotation of the
cube every frame so depending on the framerate the cube might rotate
too fast to see. This just changes it to calculate the rotation based
on the elapsed time using a GTimer. The rate that frames are drawn is
unaffected.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-10-17 13:57:29 +01:00
Robert Bragg
7669fdc827 examples: Allow installing of examples
This namespaces all of the examples and marks them for installation
if --enable-examples-install has been passed to ./configure. This
simplifies packaging the examples which can be quite convenient
for smoke testing Cogl on various platform.

https://bugzilla.gnome.org/show_bug.cgi?id=656755

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-10-14 11:55:28 +01:00
Renamed from examples/crate.c (Browse further)