1
0
Fork 0
Commit graph

7 commits

Author SHA1 Message Date
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
0365f6cda3 examples: use framebuffer matrix stack apis
Instead of using apis like cogl_push/pop_matrix, cogl_rotate,
cogl_translate and cogl_scale all the examples now use the
cogl_framebuffer_* equivalents. Our aim is to remove the need for the
default CoglContext and so we are switching towards apis that
are explicitly tied to a specific context.

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
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
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
8304ad8992 Add an example combining SDL and Cogl
This adds a simple example based on the hello example but that forces
the SDL winsys and listens for mouse motion events to move the
triangle.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:45:24 +00:00