summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* examples/cogl-x11-tfp: Add a --gears option to run glxgearsOwen W. Taylor2014-07-171-26/+151
| | | | | | | | If --gears is passed on the command line, glxgears is run, and is used for the source window rather than drawing solid rectangles into a window we create outselves. Reviewed-by: Robert Bragg <robert.bragg@intel.com>
* Add a simple example of stereo drawingOwen W. Taylor2014-07-172-1/+155
| | | | | | | Add a new example that draws a triangle floating in the air in front of the screen. Reviewed-by: Robert Bragg <robert.bragg@intel.com>
* examples/cogl-x11-tfp: Fix compilationOwen W. Taylor2014-07-171-1/+3
| | | | | Fix a couple of minor compilation problems from a bad rebase - a missing label and a missing variable.
* examples/cogl-x11-tfp.c: Handle WM_DELETE_WINDOWOwen W. Taylor2014-07-171-0/+12
| | | | | | | | Clean up cleanly when closed rather than dying with an X Error - we do this by advertising support for the WM_DELETE_WINDOW protocol and handling the client message. Reviewed-by: Robert Bragg <robert.bragg@intel.com>
* examples/cogl-x11-tfp.c: Wait for the window to be mappedOwen W. Taylor2014-07-171-1/+10
| | | | | | | | | | Wait for the main window (and hence the window we create within the main window to redirect) to be mapped and become viewable before we try to call XCompositeNameWindowPixmap() - XComposeNameWindowPixmap() produces a BadMatch error on a non-viewable window. Reviewed-by: Robert Bragg <robert.bragg@intel.com>
* cogl-basic-video-player: Allow passing a GStreamer pipelineNeil Roberts2014-01-311-12/+122
| | | | | | | | | | | | | | If the URI argument given on the command line doesn't look like a URI then the basic video player will now try to parse it as a GStreamer pipeline description. The pipeline must contain a coglsink element which the player will look for. This can be used to test Cogl GST. For example, to test NV12 this can be used: ./cogl-basic-video-player 'videotestsrc ! video/x-raw,format=(string)NV12 ! coglsink' Reviewed-by: Robert Bragg <robert@linux.intel.com>
* remove internal_format and redundant error argumentsRobert Bragg2014-01-014-7/+2
| | | | | | | | | | | | | | | | Texture allocation is now consistently handled lazily such that the internal format can now be controlled using cogl_texture_set_components() and cogl_texture_set_premultiplied() before allocating the texture with cogl_texture_allocate(). This means that the internal_format arguments to texture constructors are now redundant and since most of the texture constructors now can't ever fail the error arguments are also redundant. This now means we no longer use CoglPixelFormat in the public api for describing the internal format of textures which had been bad solution originally due to how specific CoglPixelFormat is which is missleading when we don't support such explicit control over the internal format. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* introduce texture loaders to make allocations lazyRobert Bragg2014-01-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the internal idea of texture loaders that track the state for loading and allocating a texture. This defers a lot more work until the texture is allocated. There are several intentions to this change: - provides a means for extending how textures are allocated without requiring all the parameters to be supplied in a single _texture_new() function call. - allow us to remove the internal_format argument from all _texture_new() apis since using CoglPixelFormat is bad way of expressing the internal format constraints because it is too specific. For now the internal_format arguments haven't actually been removed but this patch does introduce replacement apis for controlling the internal format: cogl_texture_set_components() lets you specify what components your texture needs when it is allocated. cogl_texture_set_premultiplied() lets you specify whether a texture data should be interpreted as premultiplied or not. - Enable us to support asynchronous texture loading + allocation in the future. Of note, the _new_from_data() texture constructors all continue to allocate textures immediately so that existing code doesn't need to be adapted to manage the lifetime of the data being uploaded. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Make cogl-sdl.h a top-level headerRobert Bragg2013-11-282-0/+2
| | | | | | | | | This makes it so that cogl-sdl.h is a top-level header no longer automatically included by cogl.h. This avoids lots of warnings building the conformance tests and examples due to SDL.h warning when __STRICT_ANSI__ isn't defined. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* wayland: Add a convenience function to update a region from SHM bufferNeil Roberts2013-11-281-36/+8
| | | | | | | | | | | | | Adds cogl_wayland_texture_set_region_from_shm_buffer which is a convenience wrapper around cogl_texture_set_region but it uses the correct format to copy the data from a Wayland SHM buffer. This will typically be used by compositors to update the texture for a surface when an SHM buffer is attached. The ordering of the arguments is based on cogl_texture_set_region_from_bitmap. Based on a patch by Jasper St. Pierre. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Declare interface types as void and remove cast macrosRobert Bragg2013-11-2711-34/+33
| | | | | | | | | | | | | | | | | | This declares the interface types CoglFramebuffer, CoglBuffer, CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when including the public cogl.h header so that users don't have to use lots of C type casts between instance types and interface types. This also removes all of the COGL_XYZ() type cast macros since they do nothing more than compile time type casting but it's less readable if you haven't seen that coding pattern before. Unlike with gobject based apis that use per-type macros for casting and performing runtime type checking we instead prefer to do our runtime type checking internally within the front-end public apis when objects are passed into Cogl. This greatly reduces the verbosity for users of the api and may help reduce the chance of excessive runtime type checking that can sometimes be a problem.
* Add a cogl-point-sprites exampleNeil Roberts2013-08-212-1/+328
| | | | | This updates the old point sprites interactive test from Clutter to be a standalone Cogl example using the 2.0 API.
* offscreen: rename _new_to_texture to _new_with_textureRobert Bragg2013-08-162-2/+2
| | | | | | | | | | | This renames cogl_offscreen_new_to_texture to cogl_offscreen_new_with_texture. The intention is to then cherry-pick this back to the cogl-1.16 branch so we can maintain a parallel cogl_offscreen_new_to_texture() function which keeps the synchronous allocation semantics that some clutter applications are currently relying on. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add _primitive_draw to replace _framebuffer_draw_primitiveRobert Bragg2013-07-159-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When splitting out the CoglPath api we saw that we would be left with inconsistent drawing apis if the drawing apis in core Cogl were lumped into the cogl_framebuffer_ api considering other Cogl sub-libraries or that others will want to create higher level drawing apis outside of Cogl but can't use the same namespace. So that we can aim for a more consistent style this adds a cogl_primitive_draw() api, comparable to cogl_path_fill() or cogl_pango_show_layout() that's intended to replace cogl_framebuffer_draw_primitive() Note: the attribute and rectangle drawing apis are still in the cogl_framebuffer_ namespace and this might potentially change but in these cases there is no single object representing the thing being drawn so it seems a more reasonable they they live in the framebuffer namespace for now. Note: the cogl_framebuffer_draw_primitive() api isn't removed by this patch so it can more conveniently be cherry picked to the 1.16 branch so we can mark it deprecated for a short while. Even though it's marked as experimental api we know that there are people using the api so we'd like to give them a chance to switch to the new api. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* examples: avoid using the auto-texture apisRobert Bragg2013-07-113-15/+13
| | | | | | | | Instead of using cogl_texture_new_from_file/with_size in the example we now use the cogl_texture_2d_ equivalents. This is in preparation for removing the cogl-auto-texture apis. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogland: Use wl_resource_get_user_data instead of resource->dataNeil Roberts2013-07-041-11/+13
| | | | | | | wl_resource may become an opaque type in future so we should probably be using the accessors instead of directly prodding into the struct. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Use wl_client_add_object instead of wl_client_add_resourceNeil Roberts2013-07-011-56/+68
| | | | | | | | | | | wl_client_add_resource has been deprecated in the Wayland API in favour of wl_client_add_object which returns a pointer to a wl_resource which it allocates instead of the compositor having to embed it in a larger struct. As far as I understand the idea is to eventually make wl_resource completely opaque. This patch changes Cogland accordingly. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* wayland-server: Update because wl_shm_buffer is no longer a wl_bufferNeil Roberts2013-07-011-97/+162
| | | | | | | | | | | | | | | | | | | | | | | The Wayland server API has changed so that wl_shm_buffer is no longer a type of wl_buffer and it instead must be retrieved directly from the resource. cogl_wayland_texture_2d_new_from_buffer now takes a resource pointer instead of directly taking a wl_buffer and it will do different things depending on whether it can get a wl_shm_buffer out of the resource instead of trying to query the buffer type. Cogland has also been updated so that it tracks a resource for buffers of surfaces instead of directly tracking a wl_buffer. This are pointed to by a new CoglandBuffer struct which can be referenced by a CoglandBufferReference. The WL_BUFFER_RELEASE event will be posted when the last reference to the buffer is removed instead of directly whenever a new buffer is attached. This is similar to how Weston works. https://bugzilla.gnome.org/show_bug.cgi?id=702999 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Removes the CoglSwapChain apiRobert Bragg2013-06-143-29/+14
| | | | | | | | | | | | | | | | | | | | | | | 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. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add support for per-vertex point sizesNeil Roberts2013-06-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new function to enable per-vertex point size on a pipeline. This can be set with cogl_pipeline_set_per_vertex_point_size(). Once enabled the point size can be set either by drawing with an attribute named 'cogl_point_size_in' or by writing to the 'cogl_point_size_out' builtin from a snippet. There is a feature flag which must be checked for before using per-vertex point sizes. This will only be set on GL >= 2.0 or on GLES 2.0. GL will only let you set a per-vertex point size from GLSL by writing to gl_PointSize. This is only available in GL2 and not in the older GLSL extensions. The per-vertex point size has its own pipeline state flag so that it can be part of the state that affects vertex shader generation. Having to enable the per vertex point size with a separate function is a bit awkward. Ideally it would work like the color attribute where you can just set it for every vertex in your primitive with cogl_pipeline_set_color or set it per-vertex by just using the attribute. This is harder to get working with the point size because we need to generate a different vertex shader depending on what attributes are bound. I think if we wanted to make this work transparently we would still want to internally have a pipeline property describing whether the shader was generated with per-vertex support so that it would work with the shader cache correctly. Potentially we could make the per-vertex property internal and automatically make a weak pipeline whenever the attribute is bound. However we would then also need to automatically detect when an application is writing to cogl_point_size_out from a snippet. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* emscripten-hello: improve mainloop integrationRobert Bragg2013-05-294-10/+61
| | | | | | | | | | | | | | Instead of simply relying on the emscripten mainloop api to wake us up periodically so that we can poll for SDL events we now pause the emscripten mainloop whenever no redraw is queued and instead hook an input event listener into the real browser mainloop to resume the emscripten mainloop whenever input is received. This way the example can go to sleep while there's no input to handle. This provides a simple example of binding custom javascript into native code. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Adds initial Emscripten support to CoglRobert Bragg2013-05-293-0/+159
| | | | | | | | | | | | | | | | | | This enables basic Emscripten support in Cogl via the SDL winsys. Assuming you have setup an emscripten toolchain you can configure Cogl like this: emconfigure ./configure --enable-debug --enable-emscripten Building the examples will build .html files that can be loaded directly by a WebGL enabled browser. Note: at this point the emscripten support has just barely been smoke tested so it's expected that as we continue to build on this we will learn about more things we need to change in Cogl to full support this environment. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Update some of the examples to use the dirty callbackNeil Roberts2013-05-294-94/+94
| | | | | | | | This updates Cogland and the three hello examples to use the dirty callback. For Cogland, this removes the manual handling of X events and for the other examples it removes the need to redraw continously. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Listen for Expose events when Cogl is using XNeil Roberts2013-05-131-1/+77
| | | | | | | | | | | | | | | | | | | | | Since 906e1b5eb535a86 Cogland no longer redraws constantly but instead only draws once at startup and then again whenever a client attaches a new buffer. Sometimes however it seems that the first paint will get lost perhaps because it is sent before the window is fully mapped. As it was previously not handling expose events it would not paint again until the first client is connected so there would be a blank window which looks broken. This patch makes it handle Expose events when it detects that Cogl is using an X backend. On other backends it will resort to queuing a redraw every 16ms as it did before. Although this is probably a bit overkill for such a small example, it seems like a good idea to only redraw when we think it's necessary so that we can be sure that the mechanism works. Handling the expose events means we can have at least one platform where we can test this. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Embed the wl_surface struct directly into CoglandSurfaceNeil Roberts2013-05-131-8/+8
| | | | | | | | | | | | The wl_surface struct has been removed from libwayland-server so instead we can just embed its only memeber, the resource, directly into CoglandSurface. http://cgit.freedesktop.org/wayland/wayland/commit/?id=508dd69b5654 https://bugzilla.gnome.org/show_bug.cgi?id=700088 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Correctly handle commits without attaching a new bufferNeil Roberts2013-05-021-1/+5
| | | | | | | | | | | Previously if a client sent a commit message without attaching a new buffer then it would end up detaching the existing buffer because surface->pending.buffer would be NULL. This patch makes it explicitly track when an attach is sent for a commit and so that it can avoid making any changes otherwise. This fixes cases where GTK apps would send a damage event without a new buffer. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-gst: expose aspect ratio apisRobert Bragg2013-04-291-30/+109
| | | | | | | | | | | | | This adds several utility apis that aim to make it as easy as possible for an application to determine what size a video should be drawn at. The important detail here is that these apis take into account the pixel-aspect-ratio in addition to the video's own aspect ratio. This patch updates the cogl-basic-video-player example to use the cogl_gst_video_sink_fit_size() api to perform letterboxing. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Move event polling into CoglRendererRobert Bragg2013-04-293-6/+13
| | | | | | | | | | | | | | This updates the cogl_poll_ apis to allow dispatching events before we have a CoglContext and to also enables pollfd state to be changed in a more add-hoc way by different Cogl components by replacing the winsys->get_poll_info with _cogl_poll_renderer_add/remove_fd functions and a winsys->get_dispatch_timeout vfunc. One of the intentions here is that applications should be able to run their mainloop before creating a CoglContext to potentially get events relating to CoglOutputs. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add $(LIBM) to the LDADD for all of the examples and testsNeil Roberts2013-04-231-1/+2
| | | | | | | | | | | | | Some of the examples and tests are using functions from -lm. With some linkers, if we don't expicitly link against it an error will be reported. This patch adds the library to all of the examples even though not all of them use math functions because I don't think it will do any harm and it will save us having to remember to add it if an example later starts using some math functions. https://bugzilla.gnome.org/show_bug.cgi?id=697330 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix a warning about ‘sincos’ in examples/cogl-gles2-gearsNeil Roberts2013-04-231-0/+13
| | | | | | | | | | | | | | ‘sincos’ is a GNU extension. cogl-gles2-gears was using it without defining _GNU_SOURCE so it was generating some annoying warnings. This patch fixes it by making the example include config.h which will end up defining _GNU_SOURCE. In addition this patch adds a configure check for the function and provides a fallback if it's not available. https://bugzilla.gnome.org/show_bug.cgi?id=697330 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* examples: Fix the first colour in the triangle_verticesNeil Roberts2013-04-228-8/+8
| | | | | | | | | | | The first vertex in the triangle vertices used in the cogl-hello example (which were copied into a few other examples) for some reason has a semi-transparent alpha component. However the colour needs to be pre-multiplied and the red component was still 0xff so the colour is effectively invalid and the transparency isn't shown. This patch just sets the alpha component to 0xff to make it less confusing. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Try forcing an EGL contextNeil Roberts2013-04-151-8/+54
| | | | | | | | | | | Cogland works a lot better with an EGL context because then Mesa will automatically set up the wl_drm object and it can accept DRM buffers. However Cogland is still useful with GLX because it can gracefully fallback to accepting only SHM buffers. This patch therefore makes it first try creating and connecting a renderer with the EGL constraint, but if that doesn't work it will try again without it. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Handle damage events for non-shm buffers tooNeil Roberts2013-04-151-14/+14
| | | | | | | | | | | | | When a Wayland compositor gets a commit it only needs to redraw the region specified by the pending damage event. Previously Cogland was ignoring damage events for non-shm buffers and just always queuing a redraw after a commit event. This patch changes it to queue a redraw only in response to a damage event. In practice this doesn't really make much difference because Cogland doesn't do anything clever to handle updating a sub-region of the screen, but it more costly matches the model a compositor should use. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Don't leak the shell surface struct if requested twiceNeil Roberts2013-04-151-1/+2
| | | | | | | | If the shell surface is requested twice then Cogland will hit an error path but it would end up leaking the CoglandShellSurface struct it allocated. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Fix handling the destroy listener for the pending bufferNeil Roberts2013-04-151-2/+8
| | | | | | | | | The handler for the destroy signal on the pending buffer was not correctly being removed if the same buffer is committed twice to the surface. It was also not being cleared if the surface is destroyed before the pending buffer is committed. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* onscreen: Make the resize callback work the same as the frame callbackNeil Roberts2013-04-041-1/+1
| | | | | | | | | | | | | When adding the frame callback API in 70040166 we decided on a common idiom for adding callbacks which would return an opaque pointer representing the closure for the callback. This pointer can then be used to later remove the callback. The closure can also contain an optional callback to invoke when the user data parameter is destroyed. The resize callback didn't work this way and instead had an integer handle to identify the closure. This patch changes it to work the same way as the frame callback. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Flush the clients in prepare, not checkNeil Roberts2013-03-221-2/+4
| | | | | | | The clients should be flushed before going idle, not after so the call to wl_display_flush_clients was in the wrong place. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Don't redraw constantlyNeil Roberts2013-03-221-60/+75
| | | | | | | | | Instead of always drawing at 60FPS without ever going idle, Cogland now only redraws when a client commits a frame or a surface is destroyed. This is acheived using an idle handler on the glib main loop. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Rename the binary back to cogland, not cogland2Neil Roberts2013-03-221-3/+3
| | | | | | | This was renamed in f951d0995f8a8 but I'm not really sure why and it's a bit confusing so let's rename it back. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Increase the display size to 800x600Neil Roberts2013-03-211-7/+12
| | | | | | The previous display size of 640x480 was a bit small to test with. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Add an option to split the desktop into four outputsNeil Roberts2013-03-211-5/+61
| | | | | | | | | Previously Cogland would always split the desktop into four outputs. Although this is quite neat to demonstrate that it's possible, it's quite annoying in practice while testing. This patch turns it into a command line option which defaults to off. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogland: Update to the Wayland 1.0 APINeil Roberts2013-03-212-152/+411
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates Cogland example compositor to use the stable Wayland 1.0 API. • When the client attaches a new buffer to a surface it is now added to a struct contaning pending the state instead of immediately switching to the new buffer. This state is then flushed when the surface is committed. • The frame callbacks are now queued in a pending list and only added to the compositor's main list when the surface is committed. Both lists are now a wl_list instead of a GQueue because it makes it easier to remove the callback without knowing which list it is in. • When the buffer is destroyed for a surface the resource for the buffer is now sent a release event. • It now flushes the clients in the prepare for the for the Wayland event GSource. This is part of the multi-threaded API in this Wayland patch: http://cgit.freedesktop.org/wayland/wayland/commit/?id=53d24713a31d59 • Implements a dummy wl_region interface. The only interfaces that actually use regions (the opaque and input regions) are ignored but we need the interface to create a resource. • Most the of the SHM interface is now implemented directly in libwayland-server except that it still needs to copy the data to the subregion of the texture when the damage region is committed. • The callback list for when a resource is destroyed has been unified into a generic wl_signal implementation so the signature for the functions has been changed. http://cgit.freedesktop.org/wayland/wayland/commit/?h=6802eaa68af9022 • The wl_buffer struct no longer has a user_data parameter so we can't attach our own CoglandBuffer data to it. Instead the CoglandSurface now just keeps track of the wl_buffer directly. • The Cogland example is now unconditionally built instead of checking the Wayland version number in the configure script. It looks like this check was broken anyway because it was checking the version of the gbm package rather than a Wayland package. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Include CoglGstPlamena Manolova2013-03-192-0/+255
| | | | | | | | | | | | CoglGst is a GStreamer integration library that facilitates video playback using the Cogl API. It works by retrieving each video frame from the GStreamer pipeline and attaching it to a Cogl pipeline in the form of a Cogl texture along with possible color model conversion shaders. The pipeline is then retrieved by the user during each draw. An example use of the CoglGst API is included in the examples directory. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* avoid redundant idle if using FRAME_SYNC to throttleRobert Bragg2013-02-153-5/+5
| | | | | | | This updates the examples and test-journal which now use the _FRAME_SYNC events to throttle rendering so that they don't install a redundant idle handler to paint when they get a FRAME_SYNC event and instead they now directly paint when the event is received.
* cogl-gles2-gears: use new _add_frame_callback apiRobert Bragg2013-02-151-12/+10
| | | | | | This updates cogl-gles2-gears to use the new cogl_onscreen_add_frame_callback() api to use _SYNC events for throttling.
* cogl-gles2-context: use new _add_frame_callback apiRobert Bragg2013-02-151-12/+10
| | | | | | This updates cogl-gles2-context to use the new cogl_onscreen_add_frame_callback() api to use _SYNC events for throttling.
* Convert the two SDL examples to use the frame callbackNeil Roberts2013-01-312-34/+70
| | | | | | | | | | | | | | | | | | The two SDL examples now throttle their rendering to the COGL_FRAME_EVENT_SYNC event. Previously the examples would redraw whenever a mouse motion event is received but now they additionally wait for the sync event which means that if another mouse event comes immediately after rendering the last frame it theoretically could avoid blocking waiting for the last frame to complete. In practice however the SDL winsys doesn't support swap events so it will get the sync event immediately anyway, but it's nice to have the code as an example and a test. This patch also changes the mainloop a bit to do the equivalent steps without the outer main loop which I think makes it a bit easier to follow. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-crate: use new _add_frame_callback apiRobert Bragg2013-01-301-18/+9
| | | | | | | | This updates cogl-crate to use the new cogl_onscreen_add_frame_callback() api to use _SYNC events for throttling. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-hello: use new _add_frame_callback apiRobert Bragg2013-01-301-14/+11
| | | | | | | | This updates cogl-hello to use the new cogl_onscreen_add_frame_callback() api to use _SYNC events for throttling. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* renderer: expose CoglOutputsRobert Bragg2013-01-301-0/+59
| | | | | | | | | | This adds a cogl_renderer_foreach_output() function that can be used to iterate the display outputs for a particular renderer. This also updates cogl-info to use this new api so it can dump out all the output information. Reviewed-by: Owen W. Taylor <otaylor@fishsoup.net>