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)
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)
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)
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)
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>
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>
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>
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>
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>
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
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>
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>
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.
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.
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.