Commit Graph

12 Commits

Author SHA1 Message Date
Robert Bragg
479c5fd2c9 onscreen: move swap_buffer apis to onscreen namespace
This moves all the cogl_framebuffer_ apis relating to swap buffer
requests into the cogl_onscreen_ namespace since on CoglOnscreen
framebuffers have back buffers that can be swapped.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-21 13:26:14 +00:00
Robert Bragg
785e6375eb Adds a context arg to cogl_pipeline_new()
As we move towards Cogl 2.0 we are aiming to remove the need for a
default global CoglContext and so everything should be explicitly
related to a context somehow. CoglPipelines are top level objects and
so this patch adds a context argument to cogl_pipeline_new().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-21 12:38:24 +00:00
Robert Bragg
3ea6acc072 buffer: explicitly relate buffers to a context
All CoglBuffer constructors now take an explicit CoglContext
constructor. This is part of the on going effort to adapt to Cogl API so
it no longer depends on a global, default context.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 14:28:02 +00:00
Robert Bragg
92c3063014 framebuffer: Add cogl_framebuffer draw methods
This adds cogl_framebuffer_ apis for drawing attributes and primitives
that replace corresponding apis that depend on the default CoglContext.
This is part of the on going effort to adapt the Cogl api so it no
longer depends on a global context variable.

All the new drawing functions also take an explicit pipeline argument
since we are also aiming to avoid being a stateful api like Cairo and
OpenGL. Being stateless makes it easier for orthogonal components to
share access to the GPU. Being stateless should also minimize any
impedance miss-match for those wanting to build higher level stateless
apis on top of Cogl.

Note: none of the legacy, global state options such as
cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
cogl_program_use() are supported by these new drawing apis and if set
will simply be silently ignored.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:09:15 +00:00
Robert Bragg
7287dd1faf examples: use cogl_framebuffer_clear4f not cogl_clear
cogl_clear depends on the default CoglContext which we are trying to
steer the API away from requiring. cogl_framebuffer_clear4f is
explicitly passed a framebuffer pointer which is implicitly related to a
specific context.

This updates all the examples to use cogl_framebuffer_clear4f instead of
cogl_clear and removes any redundant CoglColor that was previously
passed to cogl_clear.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:09:15 +00:00
Robert Bragg
50d1285ba1 Updates in line with latest wayland protocol
The shm buffer format enum values were renamed and the explicitly
premultiplied format was dropped since it's now assumed if the buffer
has an alpha component then it's premultiplied.
2012-01-16 18:27:19 +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
Neil Roberts
9000f8330d cogland: Fix crash when frame callback is destroyed before emitted
If a frame callback is destroyed before it is invoked then the struct
would be freed but it would not be removed from the array of callbacks
so when cogland later tried to emit the callback it would crash. This
patch instead stores the callbacks in a GQueue with embedded list
nodes so that they can be removed from the list in the resource
destructor. That way it doesn't matter how the resource is destroyed,
it will still get removed from the list.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:41:16 +00:00
Neil Roberts
d6b03ab45d cogland: Update to the new shell interface
Wayland has changed so that the shell interface now only has one
function which returns a shell surface for the surface. This patch
makes it create a dummy service in the same way that the wayland demo
compositor does. The implementation of the shell_surface_interface for
that dummy service is all no-ops.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:41:15 +00:00
Neil Roberts
184023bd2b cogland: Remove tabs
Tabs make me sad.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:41:15 +00:00
Robert Bragg
917a7ebe80 cogland: This updates the example wayland compositor
This updates the cogland Wayland compositor example with is an extremely
minimal Wayland compositor. It demonstrates a multi(4)-head compositor
whereby client buffers are simply stretched to cover all outputs. No
input or shell features are implemented since it's really only for
demonstrating the use of Cogl.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-12-07 15:53:05 +00:00
Robert Bragg
43c4b21a1d Adds an example cogl wayland compositor
This adds an example cogl compositor to test the
_cogl_wayland_texture_2d_new_from_buffer API. The compositor emulates 4
output displays but doesn't support input since Cogl doesn't deal with
input. It's quite a minimal example of what it takes to write a wayland
compositor so could be interesting to anyone learning about wayland.
2011-06-01 20:44:42 +01:00