Commit Graph

21 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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