1
0
Fork 0
Commit graph

81 commits

Author SHA1 Message Date
Neil Roberts
4efd82a3b6 Convert the two SDL examples to use the frame callback
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>

(cherry picked from commit 97cdd832dded2ebfaa42ee4bc43319cb8648d01b)
2013-01-31 16:56:08 +00:00
Robert Bragg
d12f39d0e6 cogl-crate: use new _add_frame_callback api
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>

(cherry picked from commit 47ea52774025b620258e00a32cb873674d0fc721)
2013-01-30 20:09:49 +00:00
Robert Bragg
51c1b3fbff cogl-hello: use new _add_frame_callback api
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>

(cherry picked from commit 06d3cb0d99944e0150e30d553d248feb5f049000)
2013-01-30 20:09:49 +00:00
Robert Bragg
013548c109 renderer: expose CoglOutputs
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>

(cherry picked from commit a2abf4c4c1fd5aeafd761f965d07a0fe9a362afc)
2013-01-30 19:57:22 +00:00
Robert Bragg
50005a9364 build: update to build with automake 1.13
This make autogen.sh look for automake-1.13 and also updates all
Makefile.am files to no longer use the INCLUDES variable which automake
1.13 warns is deprecated by AM_CPPFLAGS.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5de5569e960102afe979a5f2f0403e1defebca62)
2013-01-22 18:00:05 +00:00
Neil Roberts
9f107ab3fb Support window resizing in the SDL 2 winsys
The SDL2 winsys will now set the SDL_WINDOW_RESIZABLE flag on the
window before creating it if the resizable property is set on the
onscreen. Note that there doesn't appear to be a way in SDL to change
the flag later so unlike the other winsyses it will only take affect
if it is set before allocating the framebuffer.

The winsys now registers a callback for SDL events so that it can
report window size changes back to the application.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 0dea9aeb897faf029828379b120970477df3c7d5)
2013-01-22 17:48:04 +00:00
Robert Bragg
ab72a2275f build: don't include deps/glib headers if glib enabled
If we're using the system glib library then we need to make sure not to
include headers under deps/glib otherwise we end up with with
incompatible typedefs that break the build.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5d5fc97b59951ec56a4193b7ee7909ebd3cfbb94)
2013-01-22 17:47:58 +00:00
Robert Bragg
04ec48ca53 build the sdl examples when glib is disabled
This SDL example were unnecessarily including <glib.h> but they don't
actually depend on glib so now they are built even if Cogl is being
built with --disable-glib.

(cherry picked from commit 1d3bce7f68b0a6885c10a29cd9836a3541a1b653)
2013-01-22 17:47:58 +00:00
Damien Lespiau
d2c41502a4 build: Allow to build cogl without an external glib dependency
This commit pushes --disable-glib to the extreme of embedding the par of
glib cogl depends on in tree to be able to generate a DSO that does not
depend on an external glib.

To do so, it:
  - keeps a lot of glib's configure.ac in as-glibconfig.m4
  - pulls the code cogl depends on and the necessary dependencies

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-01-22 17:47:58 +00:00
Robert Bragg
df21e20f65 Adds CoglError api
Although we use GLib internally in Cogl we would rather not leak GLib
api through Cogl's own api, except through explicitly namespaced
cogl_glib_ / cogl_gtype_ feature apis.

One of the benefits we see to not leaking GLib through Cogl's public API
is that documentation for Cogl won't need to first introduce the Glib
API to newcomers, thus hopefully lowering the barrier to learning Cogl.

This patch provides a Cogl specific typedef for reporting runtime errors
which by no coincidence matches the typedef for GError exactly.  If Cogl
is built with --enable-glib (default) then developers can even safely
assume that a CoglError is a GError under the hood.

This patch also enforces a consistent policy for when NULL is passed as
an error argument and an error is thrown. In this case we log the error
and abort the application, instead of silently ignoring it. In common
cases where nothing has been implemented to handle a particular error
and/or where applications are just printing the error and aborting
themselves then this saves some typing. This also seems more consistent
with language based exceptions which usually cause a program to abort if
they are not explicitly caught (which passing a non-NULL error signifies
in this case)

Since this policy for NULL error pointers is stricter than the standard
GError convention, there is a clear note in the documentation to warn
developers that are used to using the GError api.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit b068d5ea09ab32c37e8c965fc8582c85d1b2db46)

Note: Since we can't change the Cogl 1.x api the patch was changed to
not rename _error_quark() functions to be _error_domain() functions and
although it's a bit ugly, instead of providing our own CoglError type
that's compatible with GError we simply #define CoglError to GError
unless Cogl is built with glib disabled.

Note: this patch does technically introduce an API break since it drops
the cogl_error_get_type() symbol generated by glib-mkenum (Since the
CoglError enum was replaced by a CoglSystemError enum) but for now we
are assuming that this will not affect anyone currently using the Cogl
API. If this does turn out to be a problem in practice then we would be
able to fix this my manually copying an implementation of
cogl_error_get_type() generated by glib-mkenum into a compatibility
source file and we could also define the original COGL_ERROR_ enums for
compatibility too.

Note: another minor concern with cherry-picking this patch to the 1.14
branch is that an api scanner would be lead to believe that some APIs
have changed, and for example the gobject-introspection parser which
understands the semantics of GError will not understand the semantics of
CoglError. We expect most people that have tried to use
gobject-introspection with Cogl already understand though that it is not
well suited to generating bindings of the Cogl api anyway and we aren't
aware or anyone depending on such bindings for apis involving GErrors.
(GnomeShell only makes very-very minimal use of Cogl via the gjs
bindings for the cogl_rectangle and cogl_color apis.)

The main reason we have cherry-picked this patch to the 1.14 branch
even given the above concerns is that without it it would become very
awkward for us to cherry-pick other beneficial patches from master.
2013-01-22 17:47:39 +00:00
Damien Lespiau
87bc616d34 framebuffer: Support texture based depth buffers
This commit introduces some new framebuffer api to be able to
enable texture based depth buffers for a framebuffer (currently
only supported for offscreen framebuffers) and once allocated
to be able to retrieve the depth buffer as a texture for further
usage, say, to implement shadow mapping.

The API works as follow:
  * Before the framebuffer is allocated, you can request that a depth
    texture is created with
    cogl_framebuffer_set_depth_texture_enabled()
  * cogl_framebuffer_get_depth_texture() can then be used to grab a
    CoglTexture once the framebuffer has been allocated.
2013-01-18 10:53:29 +00:00
Robert Bragg
ab00855967 build: only build cogland with wayland-server 0.85
This ensures we only try to build cogland if we have wayland-server
0.85.x since the api is incompatible with later versions.
2013-01-04 17:23:45 +00:00
Robert Bragg
de3e4b1560 build: remove duplicate cogl_info_SOURCES/LDADD lines
examples/Makefile.am had duplicate lines for defining the _SOURCES
and _LDADD files. This removes the lines within the USE_GLIB guards.
2012-09-03 15:55:14 +01:00
Robert Bragg
df51574116 onscreen: Adds support for resizable windows
This adds api to be able to request that the window system allows a
given onscreen framebuffer to be resizable, and api to add and remove
resize handlers to be called whenever the framebuffer does actually
change size.

The new functions are:
  cogl_onscreen_{get,set}_resizable()
  cogl_onscreen_{add,remove}_resize_handler()

The examples cogl-hello and cogl-x11-foreign have been updated to use
the new api. To smoke test how Cogl updates the viewport automatically
in response to window resizes the cogl-hello test doesn't explicitly
respond to resize events by setting the viewport and cogl-x11-foreign
responds by setting a viewport that is offset by a quarter of the
window's width/height and half the width and height of the window.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a1a8cc00bfa2cecaf1007aec5f3dd95dc07b1786)
2012-08-06 18:51:32 +01:00
Neil Roberts
17c818a9a7 Add an SDL2 winsys
This adds an alternate version of the SDL winsys using the SDL 2 API.
The two versions are mutually exclusive and share the same
CoglWinsysID. Version 2 of SDL fits a little bit better with Cogl
because it supports multiple windows and the video subsystem can be
initialised entirely independently of the rest of the subsystems.

The SDL2 winsys creates an invisible dummy window in order to bind the
GL context after creating the Cogl display. This is similar to how the
X11 winsys's work.

SDL2 seems to support compiling with support for both GL and GLES.
However there doesn't seem to be a way to select between the two
backends outside of SDL. In fact if you do compile them both in it
seems to break down because it will always try to use the window
system functions from the GLES backend because those are filled in
second in the vtable. However when creating the window it will always
prefer to use the GL function to choose a visual. This function gets
confused because the GL backend has not been initialised at that
point. The Cogl backend therefore just leaves it up to SDL to pick a
sensible backend. It will then verify that it picked a GL library
which matches the Cogl driver by checking the string from
glGetString(GL_VERSION).

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 6cb5ab41355e7bfe28f367cf4afa39a7afcfeec2)
2012-08-06 14:27:44 +01:00
Neil Roberts
59ffa9abdd Don't build cogl-gles2-gears if configured with --disable-cogl-gles2
The cogl-gles2-gears example will fail to build unless
--enable-cogl-gles2 is enabled in the configure script because it
depends on libcogl-gles2. This patch makes it only conditionally build
the example depending on the BUILD_COGL_GLES2 automake conditional.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 7f57e9c444b6353ac17e920ea4fc63ebe3cc29d3)
2012-08-06 14:27:43 +01:00
Robert Bragg
498937083e Adds gles2-context renderer constraint
This adds a new renderer constraint enum:
  COGL_RENDERER_CONSTRAINT_SUPPORTS_GLES2_CONTEXT
that can be used by applications to ensure the renderer they connect to
has support for creating a GLES2 context via cogl_gles2_context_new().

The cogl-gles2-context and cogl-gles2-gears examples and the conformance
tests have been updated to use this constraint.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ed61463d7194354b26624e8014859f0fbfc06a12)
2012-08-06 14:27:43 +01:00
Robert Bragg
0047a1f604 Adds a cogl-gles2-gears example
This adds an example of using libcogl-gles2 as a way to port existing
GLES 2.0 based code. This is a port of es2gears in the Mesa demos repo.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit fcb947178858e9d675c5f76e50510282c6b0bf8d)
2012-08-06 14:27:42 +01:00
Robert Bragg
010d16f647 Adds initial GLES2 integration support
This makes it possible to integrate existing GLES2 code with
applications using Cogl as the rendering api.

Currently all GLES2 usage is handled with separate GLES2 contexts to
ensure that GLES2 api usage doesn't interfere with Cogl's own use of
OpenGL[ES]. The api has been designed though so we can provide tighter
integration later.

The api would allow us to support GLES2 virtualized on top of an
OpenGL/GLX driver as well as GLES2 virtualized on the core rendering api
of Cogl itself. Virtualizing the GLES2 support on Cogl will allow us to
take advantage of Cogl debugging facilities as well as let us optimize
the cost of allocating multiple GLES2 contexts and switching between
them which can both be very expensive with many drivers.

As as a side effect of this patch Cogl can also now be used as a
portable window system binding API for GLES2 as an alternative to EGL.

Parts of this patch are based on work done by Tomeu Vizoso
<tomeu.vizoso@collabora.com> who did the first iteration of adding GLES2
API support to Cogl so that WebGL support could be added to
webkit-clutter.

This patch adds a very minimal cogl-gles2-context example that shows how
to create a gles2 context, clear the screen to a random color and also
draw a triangle with the cogl api.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4bb6eff3dbd50d8fef7d6bdbed55c5aaa70036a8)
2012-08-06 14:27:42 +01:00
Robert Bragg
54735dec84 Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.

Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.

Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.

So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.

Instead of gsize we now use size_t

For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-08-06 14:27:39 +01:00
Robert Bragg
09642a83b5 Removes all remaining use of CoglHandle
Removing CoglHandle has been an on going goal for quite a long time now
and finally this patch removes the last remaining uses of the CoglHandle
type and the cogl_handle_ apis.

Since the big remaining users of CoglHandle were the cogl_program_ and
cogl_shader_ apis which have replaced with the CoglSnippets api this
patch removes both of these apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6ed3aaf4be21d605a1ed3176b3ea825933f85cf0)

  Since the original patch was done after removing deprecated API
  this back ported patch doesn't affect deprecated API and so
  actually this cherry-pick doesn't remove all remaining use of
  CoglHandle as it did for the master branch of Cogl.
2012-08-06 14:27:39 +01:00
Robert Bragg
9a1f1df83f Rework sdl integration api
This re-works the SDL integration api to simplify the integration for
application developers and also allow Cogl to know when the application
is about to go idle waiting for events so it can perform idle
book-keeping work.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-12 12:31:46 +01:00
Robert Bragg
995f4cd019 msaa: print GError message on onscreen alloc failure
If we fail to allocate the onscreen framebuffer when first requesting 4x
msaa then we now print the GError message.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-11 12:26:51 +01:00
Robert Bragg
836d54445d Use cogl_framebuffer_draw_rectangle api
Instead of using cogl_rectangle() this example now uses
cogl_framebuffer_draw_rectangle(). This fixes a crash due to the example
not pushing a current framebuffer before calling cogl_rectangle().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-11 12:26:48 +01:00
Robert Bragg
0205a96efb cogl-crate: remove redundant g_type_init
Cogl internally will call g_type_init if necessary so the cogl-crate
example doesn't need to do this explicitly.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-11 12:26:47 +01:00
Robert Bragg
b61b328f51 cogl-crate: print GError message if texture load fails
If we fail to load the crate texture then we now print error->message to
hopefully give more insight into the failure to the user.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-11 12:26:46 +01:00
Robert Bragg
890a75ab06 Create standalone public wayland client/server headers
Because the wayland-client-protocol.h header defines symbols that
collide with the wayland-server-protocol.h header we allow applications
to explicitly ensure that they are only including one at a time by
exposing corresponding <cogl/cogl-wayland-client.h> and
<cogl/cogl-wayland-server.h> headers. This also adds a missing guard to
cogl-texture-2d.h that it isn't included directly.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-03-20 14:26:44 +00:00
Neil Roberts
185630085c Add -Wmissing-declarations to maintainer flags and fix problems
This option to GCC makes it give a warning whenever a global function
is defined without a declaration. This should catch cases were we've
defined a function but forgot to put it in a header. In that case it
is either only used within one file so we should make it static or we
should declare it in a header.

The following changes where made to fix problems:

• Some functions were made static

• cogl-path.h (the one containing the 1.0 API) was split into two
  files, one defining the functions and one defining the enums so that
  cogl-path.c can include the enum and function declarations from the
  2.0 API as well as the function declarations from the 1.0 API.

• cogl2-clip-state has been removed. This only had one experimental
  function called cogl_clip_push_from_path but as this is unstable we
  might as well remove it favour of the equivalent cogl_framebuffer_*
  API.

• The GLX, SDL and WGL winsys's now have a private header to define
  their get_vtable function instead of directly declaring in the C
  file where it is called.

• All places that were calling COGL_OBJECT_DEFINE need to have the
  cogl_is_whatever function declared so these have been added either
  as a public function or in a private header.

• Some files that were not including the header containing their
  function declarations have been fixed to do so.

• Any unused error quark functions have been removed. If we later want
  them we should add them back one by one and add a declaration for
  them in a header.

• _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and
  made a public function with a declaration in cogl-framebuffer.h

• Similarly for CoglOnscreen.

• cogl_vdraw_indexed_attributes is called
  cogl_framebuffer_vdraw_indexed_attributes in the header. The
  definition has been changed to match the header.

• cogl_index_buffer_allocate has been removed. This had no declaration
  and I'm not sure what it's supposed to do.

• CoglJournal has been changed to use the internal CoglObject macro so
  that it won't define an exported cogl_is_journal symbol.

• The _cogl_blah_pointer_from_handle functions have been removed.
  CoglHandle isn't used much anymore anyway and in the few places
  where it is used I think it's safe to just use the implicit cast
  from void* to the right type.

• The test-utils.h header for the conformance tests explicitly
  disables the -Wmissing-declaration option using a pragma because all
  of the tests declare their main function without a header. Any
  mistakes relating to missing declarations aren't really important
  for the tests.

• cogl_quaternion_init_from_quaternion and init_from_matrix have been
  given declarations in cogl-quaternion.h

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-06 18:45:44 +00:00
Robert Bragg
ae091f2cbb cogl-hello: use glib mainloop for portability
To be a portable example this updates cogl-hello to use the glib
mainloop instead of using g_poll. On OSX we plan to provide custom
mainloop integration for glib which can't be abstracted by just using
g_poll.
2012-03-05 22:57:52 +00:00
Robert Bragg
4e3f9d0fc2 tex-pixmap-x11: remove CoglHandle use + pass context
This also replaces use of CoglHandle with a CoglTexturePixmapX11 type
instead.

This patch also ensures the CoglTexturePixmapX11 constructor take an
explicit CoglContext pointer and can return a GError consistent with
other CoglTexture constructors.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-21 13:26:14 +00:00
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
983c9f0dc4 cogl-crate: remove spurious cogl_set_depth_test_enabled call
Use of cogl_set_depth_test_enabled() has been deprecated for some time
and cogl-create already uses the new api for enabling depth testing so
it was just an oversight that we forgot to remove the old call to
cogl_set_depth_test_enabled().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:20:27 +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
Robert Bragg
7d38d9bdf2 cogl-info: print out the chosen renderer name
This updates cogl-info to use cogl_renderer_get_winsys_id() so it can
print out the name of the chosen renderer winsys.
2012-01-16 18:27:19 +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
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
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
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
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
Zan Dobersek
d8c47e25f2 Remove inclusion of Xlib headers in Cogl headers
Xlib headers define many trivially named objects which can later cause
name collision problems when only cogl.h header is included in a program
or library. Xlib headers are now only included through including the
standalone header cogl-xlib.h.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-01 15:55:53 +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