1
0
Fork 0
Commit graph

35 commits

Author SHA1 Message Date
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
Robert Bragg
bfb69d32ab tests: Adds a really simple cogl-info program
It could be nice to extend this as Cogl gains more APIs for
introspecting its own features but for now cogl-info just uses the new
cogl_foreach_feature() API to enumerate the available features for
a default context and prints those to the terminal.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
405cacabe2 examples: Adds a simple 4x msaa example
This adds a very basic test of onscreen and offscreen multisample
rendering with 4 samples per pixel. The test simply draws two triangles;
the one on the left is rendered directly to the onscreen framebuffer and
the other is first rendered offscreen before copying it onscreen.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-10-28 19:10:16 +01:00
Rico Tzschichholz
ebc53587ae Fix make dist
Add crate.jpg to EXTRA_DIST to make sure it gets pulled in
2011-10-18 17:42:07 +02: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
Neil Roberts
5aab8a2310 Add an option to avoid defining G_DISABLE_DEPRECATED
G_DISABLE_DEPRECATED is only intended for developers of Cogl and it
sometimes breaks the build for people just trying to build a
release. This patch adds an option to enable deprecated Glib
features. By default it is enabled for non-git versions of Cogl.

The patch is based on similar code in Clutter except it adds the flags
to COGL_EXTRA_CFLAGS instead of having a separate variable.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-27 10:27:19 +01:00
Robert Bragg
4c3dadd35e Add a strong CoglTexture type to replace CoglHandle
As part of the on going, incremental effort to purge the non type safe
CoglHandle type from the Cogl API this patch tackles most of the
CoglHandle uses relating to textures.

We'd postponed making this change for quite a while because we wanted to
have a clearer understanding of how we wanted to evolve the texture APIs
towards Cogl 2.0 before exposing type safety here which would be
difficult to change later since it would imply breaking APIs.

The basic idea that we are steering towards now is that CoglTexture
can be considered to be the most primitive interface we have for any
object representing a texture. The texture interface would provide
roughly these methods:

  cogl_texture_get_width
  cogl_texture_get_height
  cogl_texture_can_repeat
  cogl_texture_can_mipmap
  cogl_texture_generate_mipmap;
  cogl_texture_get_format
  cogl_texture_set_region
  cogl_texture_get_region

Besides the texture interface we will then start to expose types
corresponding to specific texture types: CoglTexture2D,
CoglTexture3D, CoglTexture2DSliced, CoglSubTexture, CoglAtlasTexture and
CoglTexturePixmapX11.

We will then also expose an interface for the high-level texture types
we have (such as CoglTexture2DSlice, CoglSubTexture and
CoglAtlasTexture) called CoglMetaTexture. CoglMetaTexture is an
additional interface that lets you iterate a virtual region of a meta
texture and get mappings of primitive textures to sub-regions of that
virtual region. Internally we already have this kind of abstraction for
dealing with sliced texture, sub-textures and atlas textures in a
consistent way, so this will just make that abstraction public. The aim
here is to clarify that there is a difference between primitive textures
(CoglTexture2D/3D) and some of the other high-level textures, and also
enable developers to implement primitives that can support meta textures
since they can only be used with the cogl_rectangle API currently.

The thing that's not so clean-cut with this are the texture constructors
we have currently; such as cogl_texture_new_from_file which no longer
make sense when CoglTexture is considered to be an interface.  These
will basically just become convenient factory functions and it's just a
bit unusual that they are within the cogl_texture namespace.  It's worth
noting here that all the texture type APIs will also have their own type
specific constructors so these functions will only be used for the
convenience of being able to create a texture without really wanting to
know the details of what type of texture you need.  Longer term for 2.0
we may come up with replacement names for these factory functions or the
other thing we are considering is designing some asynchronous factory
functions instead since it's so often detrimental to application
performance to be blocked waiting for a texture to be uploaded to the
GPU.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-09-21 15:27:03 +01:00
Robert Bragg
5ac563afdb examples: use $(COGL_PANGO_DEP_LIBS) for cogl-pango users
The crate example uses the cogl_pango API and perviously we just
explicitly said to link with the libcogl-pango.la but that doesn't seem
to be enough (not really sure why since libtool should know the required
dependencies to brining in for linking) so we now pass
$(COGL_PANGO_DEP_LIBS) when linking the crate demo.

https://bugzilla.gnome.org/show_bug.cgi?id=656441
2011-09-05 19:01:49 +01:00
Robert Bragg
11d221af1a android: don't list android/hello/res/values for dist
EXTRA_DIST should only include files so this removes the listing
of the android/hello/res/values directory.
2011-09-05 17:54:46 +01:00
Robert Bragg
5b5e475dff android: Make sure to dist the hello example
This ensures that our releases include the example android application.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 17:33:05 +01:00
Damien Lespiau
78e2d3b333 android: Update the hello example to the latest glib-android API change
When using glib-android, it's not possible to select parts of the
library you want to initialize anymore. Plus it was decided that argc
and argv are useless as you basically don't start applications with
command line arguments on Android.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-12 17:24:19 +01:00
Damien Lespiau
27df5c73a2 android: Commit the build.xml file
This file is generated by:
  android update project -p . -t $i

but it needs to have the name changed to the application name and thus
needs to be checked in.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-12 17:22:48 +01:00
Robert Bragg
5012bcf1d1 build: only have libcogl-pango depend on pango
Only cogl-pango needs a dependency on pangocairo so we are now careful to
separate the pangocairo pkg-config flags from the others so we can avoid
having libcogl builds refer to them.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:42 +01:00
Robert Bragg
db7f087953 hello: Make sure to clear background explicitly
This test wasn't actually explicitly clearing the background to black
it was simply a fluke that some drivers clear the background when
allocating a new framebuffer.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 16:49:07 +01:00
Robert Bragg
83db796744 examples: Add x11-tfp example
This adds a minimal example that tests the cogl_texture_pixmap_x11 API.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 16:49:07 +01:00
Robert Bragg
09e7174b1d Remove cogl_context_set_default API
For cogl 2.0 we don't want to have a default context. In the meantime
we can simply assume that calling cogl_context_new() implicitly
sets that context as the default context before returning.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:02 +01:00
Robert Bragg
38b67e2884 onscreen: make platform specific onscreen apis consistent
There were several CoglOnscreen functions named like:
cogl_onscreen_<platform>_blah instead of cogl_<platform>_onscreen_blah
so this patch updates those to be consistent with other platform
specific apis we have in cogl.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:01 +01:00
Robert Bragg
89562dda73 work towards consistent platform file/symbol naming
we've got into a bit of a mess with how we name platform specific
symbols and files, so this is a first pass at trying to tidy that up.

All platform specific symbols should be named like
cogl_<platform>_symbol_name and similarly files should be named like
cogl-<platform>-filename.c

This patch tackles the X11 specific renderer/display APIs as a start.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:33 +01:00
Robert Bragg
3b64a439f0 replace public native_event APIs with typesafe APIs
This adds Xlib and Win32 typesafe replacements for
cogl_renderer_handle_native_event, cogl_renderer_add_native_filter,
cogl_renderer_remove_native_filter. The old functions are kept as an
implementation detail so we can share code.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:13 +01:00
Robert Bragg
716b88b0c8 Adds another example that draws a 3D crate
Based on the Cogl example we had on wiki.clutter-project.org this shows
how to use the primitive API to draw a simple spinning crate.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:11 +01:00
Robert Bragg
c2bbf90c2e examples: pass COGL_DEP_LIBS as ldflags when linking
To be sure our examples link with all the libraries required, we now
simply pass the $(COGL_DEP_LIBS) as ldflags when linking them.
2011-06-15 14:52:21 +01:00
Robert Bragg
44e4b13324 x11-foreign: Updates to forward X Events to Cogl
This update the x11-foreign test so that it checks for events on its X
display and forwards them on to Cogl. It will now also quit if any key
of button is pressed.
2011-06-14 17:09:55 +01:00
Robert Bragg
a9643f38e6 x11-foreign: explicitly pass -lX11 ldflag
The x11-foreign example directly uses the X11 API at it seems that more
recent versions of binutils complain if we don't directly link the test
with libX11 as opposed to relying on indirect linkage via cogl.
2011-06-14 17:08:33 +01: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
Damien Lespiau
aa27ec56df android: Add a port of the Cogl hello world example 2011-05-17 15:24:54 +01:00
Robert Bragg
a54aa40dbe don't call cogl_set_default_context in hello.c
Actually calling cogl_set_default_context isn't required because
cogl_context_new implicitly sets the new context to be the default
context. Since we want to eventually get rid of the concept of a default
context we'd rather not pollute the example with the concept.
2011-05-11 16:42:00 +01:00
Robert Bragg
6f2193545e consistently refer to cogl-pango as "cogl-pango"
This renames the pango directory to cogl-pango and it renames the
installed library to libcogl-pango instead of libcoglpango.
2011-05-06 12:12:08 +01:00
Robert Bragg
ccd0079b57 fix a /XDisplay/Display/ typo in x11-foreign.c
This removes a spurious X prefix that was causing a compilation error.
2011-05-05 20:38:13 +01:00
Robert Bragg
6c23f27801 Adds a way for Cogl to control event_mask of foreign wins
This extends cogl_onscreen_x11_set_foreign_xid to take a callback to a
function that details the event mask the Cogl requires the application
to select on foreign windows. This is required because Cogl, for
example, needs to track size changes of a window and may also in the
future want other notifications such as map/unmap.

Most applications wont need to use the foreign xwindow apis, but those
that do are required to pass a valid callback and update the event mask
of their window according to Cogl's requirements.
2011-05-05 15:05:42 +01:00
Robert Bragg
97243ad9ac Adds cogl_onscreen_show/hide functions
This adds Cogl API to show and hide onscreen framebuffers. We don't want
to go too far down the road of abstracting window system APIs with Cogl
since that would be out of its scope but the previous idea that we would
automatically map framebuffers on allocation except for those made from
foreign windows wasn't good enough. The problem is that we don't want to
make Clutter always create stages from foreign windows but with the
automatic map semantics then Clutter doesn't get an opportunity to
select for all the events it requires before mapping. This meant that we
wouldn't be delivered a mouse enter event for windows mapped underneath
the cursor which would break Clutters handling of button press events.
2011-05-05 15:05:42 +01:00
Robert Bragg
f5bb20212b Adds Cogl Hello World and "X11 foreign" example applications
This adds a simple standalone Cogl application that can be used to
smoke test a standalone build of Cogl without Clutter.

This also adds an x11-foreign app that shows how a toolkit can ask Cogl
to draw to an X Window that it owns instead of Cogl being responsible
for automatically creating and mapping an X Window for CoglOnscreen.
2011-05-05 14:46:03 +01:00