1
0
Fork 0
Commit graph

269 commits

Author SHA1 Message Date
Neil Roberts
a1e1527b69 Add a separate winsys vtable for each EGL platform
Instead of just having an "EGL" renderer, there is now a separate
winsys for each platform. Currently they just directly copy the vtable
for the EGL platform so it is still only possible to have one EGL
platform compiled into Cogl. However the intention is that the
winsys-specific code for each platform will be moved into override
functions in the corresponding platform winsys.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-08 17:38:25 +00:00
Chun-wei Fan
1e7f536c40 cogl/Makefile.am VS Support Update
Should be one %, not two (%%) for echoing...
2011-12-08 16:30:37 +08:00
Chun-wei Fan
7069825cb5 cogl/Makefile.am: VS support-Create a .bat to gen enums
Pre-generate a .bat file to be used to generate the cogl-enum-types.[ch]
for the build process.  This will greatly simplify the maintenace process
as the listing of headers to be parsed by glib-mkenums can be manifested
automatically during 'make dist', and this list changes quite a bit during
the development cycle.
2011-12-08 16:16:58 +08:00
Chun-wei Fan
9cff9236ca cogl/Makefile.am: Visual C++ support updates
Filter out the kms winsys sources... these aren't for Windows.
2011-12-08 12:51:05 +08:00
Neil Roberts
f005f517fe Flush matrices in the progend and flip with a vector
Previously flushing the matrices was performed as part of the
framebuffer state. When on GLES2 this matrix flushing is actually
diverted so that it only keeps a reference to the intended matrix
stack. This is necessary because on GLES2 there are no builtin
uniforms so it can't actually flush the matrices until the program for
the pipeline is generated. When the matrices are flushed it would
store the age of modifications on the matrix stack so that it could
detect when the matrix hasn't changed and avoid flushing it.

This patch changes it so that the pipeline is responsible for flushing
the matrices even when we are using the GL builtins. The same
mechanism for detecting unmodified matrix stacks is used in all
cases. There is a new CoglMatrixStackCache type which is used to store
a reference to the intended matrix stack along with its last flushed
age. There are now two of these attached to the CoglContext to track
the flushed state for the global matrix builtins and also two for each
glsl progend program state to track the flushed state for a
program. The framebuffer matrix flush now just updates the intended
matrix stacks without actually trying to flush.

When a vertex snippet is attached to the pipeline, the GLSL vertend
will now avoid using the projection matrix to flip the rendering. This
is necessary because any vertex snippet may cause the projection
matrix not to be used. Instead the flip is done as a forced final step
by multiplying cogl_position_out by a vec4 uniform. This uniform is
updated as part of the progend pre_paint depending on whether the
framebuffer is offscreen or not.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:06 +00:00
Neil Roberts
4cdf66f89b pipeline: Move the snippet source loop into a common function
The two loops that generate the functions for the snippets in the
fragend and vertend are very similar so to avoid code duplication this
patch moves the logic to its own function in a new
cogl-pipeline-snippet.c file.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:06 +00:00
Neil Roberts
f37738453e Add a CoglSnippet type
This adds a CoglObject called CoglSnippet which will be used to store
strings used as GLSL snippets to be attached at hook points to a
CoglPipeline. The snippets can currently contain three strings:

declarations - This will be placed in the global scope and is intended
               to be used to declare uniforms, attributes and
               functions.

pre           - This will be inserted before the hook point.

post          - This will be inserted after the hook point.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:05 +00:00
Rob Bradford
1b54c8023e kms: Add first version of "baremetal" backend for EGL on KMS
To start with this backend only supports creating a single CoglOnscreen
framebuffer and will automatically set is up to display fullscreen on
the first suitable crtc it can find.

To compile this backend - get some dribbly black candles, sacrifice a
goat and configure with: --enable-kms-egl-platform

Note: There is currently a problem with using GLES2 with this winsys
so you need to run with EGL_DRIVER=gl
Note: If you have problems with mesa crashing in XCB during
eglInitialize then you may need to explicitly run with EGL_PLATFORM=gbm

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-28 17:37:28 +00:00
Chun-wei Fan
2055f6ba91 VS 2008/2010 project files to build Cogl
These are the VS 2008/2010 project files to build Cogl, with a README.txt
to explain the process involved.

Note that the Cogl and Cogl-Pango projects (and filters for VS2010) are
expanded with the correct source file listings during "make dist", which
is done to simplify maintenance of these project files.

-added preconfigured config.h(.win32.in), which is expanded with the
 correct versioining info during autogen
-added preconfigued cogl/cogl-defines.h.win32
-added symbols files for cogl and cogl-pango
-Have configure.ac expand the config.h.win32.in into config.h.win32
 with the correct versioning info, etc, and to include the Visual C++
 project files for distribution
-Added rules in cogl/Makefile.am to expand the cogl VS 2008/2010 projects
 and filters from the templates with up-to-date source file listings, to
 distribute cogl-enum-types.c, cogl-enum-types.h to ease compilation and
 to avoid depending on PERL on Windows installations.
-Added rules in cogl-pango/Makefile.am to expand the cogl-pango VS2008/
 2010 projects and filters from the templates with up-to-date source file
 listings.
-Added/edited various Makefile.am's in build to distribute the VS2008/2010
 project files and associated items required for the build.
-Update .gitignore. There needs to be a pre-configured
 config.h(.win32) and its template, config.h.win32.in for Visual C++
 builds

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-25 13:12:45 +00:00
Neil Roberts
256f5791fd cogl-program: Move the code for CoglBoxedValue to its own file
The code for manipulating CoglBoxedValues is now separated from
cogl-program.c into its own file. That way when we add support for
setting uniform values on a CoglPipeline the code for storing the
values can be shared.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-16 16:32:10 +00:00
Rico Tzschichholz
567661ccf3 build: add missing header to fix make dist 2011-11-02 07:34:26 -04: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
Robert Bragg
18fb1ffab5 texture: Make CoglSubTexture experimental public api
This exposes cogl_sub_texture_new() and cogl_is_sub_texture() as
experimental public API. Previously sub-textures were only exposed via
cogl_texture_new_from_sub_texture() so there wasn't a corresponding
CoglSubTexture type. A CoglSubTexture is a high-level texture defined as
a sub-region of some other parent texture. CoglSubTextures are high
level textures that implement the CoglMetaTexture interface which can
be used to manually handle texture repeating.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:03 +00:00
Robert Bragg
90f106117f texture: Make CoglTextureRectangle experimentally public
This exposes CoglTextureRectangle in the experimental cogl 2.0 api. For
now we just expose a single constructor;
cogl_texture_rectangle_new_with_size() but we can add more later.

This is part of going work to improve our texture apis with more
emphasis on providing low-level access to the varying semantics of
different texture types understood by the gpu instead of only trying to
present a lowest common denominator api.

CoglTextureRectangle is notably useful for never being restricted to
power of two sizes and for being sampled with non-normalized texture
coordinates which can be convenient for use a lookup tables in glsl due
to not needing separate uniforms for mapping normalized coordinates to
texels. Unlike CoglTexture2D though rectangle textures can't have a
mipmap and they only support the _CLAMP_TO_EDGE wrap mode.

Applications wanting to use CoglTextureRectangle should first check
cogl_has_feature (COGL_FEATURE_ID_TEXTURE_RECTANGLE).

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
79719347c8 framebuffer: split out CoglOnscreen code
This factors out the CoglOnscreen code from cogl-framebuffer.c so we now
have cogl-onscreen.c, cogl-onscreen.h and cogl-onscreen-private.h.
Notably some of the functions pulled out are currently namespaced as
cogl_framebuffer but we know we are planning on renaming them to be in
the cogl_onscreen namespace; such as cogl_framebuffer_swap_buffers().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
1d8fd64e1c meta-texture: This publicly exposes CoglMetaTexture
CoglMetaTexture is an interface for dealing with high level textures
that may be comprised of one or more low-level textures internally. The
interface allows the development of primitive drawing APIs that can draw
with high-level textures (such as atlas textures) even though the
GPU doesn't natively understand these texture types.

There is currently just one function that's part of this interface:
cogl_meta_texture_foreach_in_region() which allows an application to
resolve the internal, low-level textures of a high-level texture.
cogl_rectangle() uses this API for example so that it can easily emulate
the _REPEAT wrap mode for textures that the hardware can't natively
handle repeating of.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:01 +00:00
Robert Bragg
6253b09c69 texture-2d-sliced: make CoglTexture2DSliced public
This make the CoglTexture2DSliced type public and adds
cogl_texture_2d_sliced_new_with_size() as an experimental API that can
be used to construct a sliced texture without any initial data.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:02:59 +00: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
Chun-wei Fan
34181d34f5 Makefile.am: Update sources list
There is no cogl/cogl-pipeline-debug-private.h, so remove that from
Makefile.am

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-26 15:54:07 +01:00
Robert Bragg
d4459e2d42 pipeline: Split more code out from cogl-pipeline.c
This splits out the core CoglPipelineLayer support code from
cogl-pipeline.c into cogl-pipeline-layer.c; it splits out the debugging
code for dumping a pipeline to a .dot file into cogl-pipeline-debug.c
and it splits the CoglPipelineNode support which is shared between
CoglPipeline and CoglPipelineLayer into cogl-node.c.

Note: cogl-pipeline-layer.c only contains the layer code directly
relating to CoglPipelineLayer objects; it does not contain any
_cogl_pipeline API relating to how CoglPipeline tracks and manipulates
layers.
2011-09-21 17:03:10 +01:00
Robert Bragg
db6c452aaa pipeline: split out all layer state apis
As part of an on-going effort to get cogl-pipeline.c into a more
maintainable state this splits out all the apis relating just to
layer state. This just leaves code relating to the core CoglPipeline
and CoglPipelineLayer design left in cogl-pipeline.c.

This splits out around 2k more lines from cogl-pipeline.c although we
are still left with nearly 4k lines so we still have some way to go!

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-09-19 16:40:00 +01:00
Robert Bragg
9b58b6f472 pipeline: split out all core state apis
Since cogl-pipeline.c has become very unwieldy this make a start at
trying to shape this code back into a manageable state. This patche
moves all the API relating to core pipeline state into
cogl-pipeline-state.c. This doesn't move code relating to layer state
out nor does it move any of the code supporting the core design
of CoglPipeline itself.

This change alone factors out 2k lines of code from cogl-pipeline.c
which is obviously a good start. The next step will be to factor
out the layer state and then probably look at breaking all of this
state code down into state-groups.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-09-19 16:35:59 +01:00
Neil Roberts
c7969a33af cogl: Bind the locale dir for the Cogl domain
dgettext (which Cogl is using) doesn't work unless you first tell
gettext where the locale dir is for the library's domain. This just
adds the necessary calls into _cogl_init.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-19 12:53:58 +01:00
Robert Bragg
f1c2d7e965 2.0: Add cogl2-experimental.h + don't pollute .pc CFLAGS
Instead of adding -DCOGL_ENABLE_EXPERIMENTAL_2_0_API to the
cogl-2.0-experimental.pc file we now install a cogl2-experimental.h
that #defines COGL_ENABLE_EXPERIMENTAL_2_0_API before including
cogl.h.

The problem with having the define in the .pc file is that you might
develop a library that depends on the experimental 2.0 api internally
and then you might want to use that library with Clutter which still
uses the 1.0 API but the .pc file for your library will indirectly,
automatically enable the 2.0 api which can cause conflicts.
2011-09-09 15:06:31 +01:00
Robert Bragg
2ac4002084 cogl: Add support for reading a cogl.conf config file
When cogl initializes we now check for a cogl/cogl.conf in any of the
system config dirs (determined using $XDG_CONFIG_DIRS on linux) we then
also check the user's config directory (determined using XDG_CONFIG_HOME
on linux) for a cogl/cogl.conf file. Options specified in the user
config file have priority over the system config options.

The config file has an .ini style syntax with a mandatory [global]
section and we currently understand 3 keynames: COGL_DEBUG, COGL_DRIVER
and COGL_RENDERER which have the same semantics as the corresponding
environment variables.

Options set using the environment variables have priority over options
set in the config files. To allow users to undo the enabling of debug
options in config files this patch also adds a check for COGL_NO_DEBUG
environment variable which will disable the specified options which may
have been enabled in config files.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:42 +01:00
Neil Roberts
461bff1867 fragend-arbfp: Move the pipeline cache to a separate file
The pipeline cache is now handled in CoglPipelineCache instead of
directly in the ARBfp fragend. The flags needed to hash a pipeline
should be exactly the same for the ARBfp and GLSL fragends so it's
convenient to share the code. The hash table now stores the actual
pipeline as the value instead of the private data so that the two
fragends can attach their data to it. That way it's possible to use
the same pipeline key with ancestors that are using different
fragends.

The hash table is created with g_hash_table_new_full to set a
destructor for the key and value and there is a destructor for
CoglPipelineCache that gets called when the CoglContext is
destroyed. That way we no longer leak the pipelines and shader state
when the context is desroyed.
2011-07-13 12:30:07 +01:00
Robert Bragg
d7bbc44235 dist: Make sure to dist cogl-winsys-egl-feature-functions.h
cogl-winsys-egl-feature-functions.h wasn't being listed as source and so
it wasn't ending up in dist tarballs.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 15:40:02 +01:00
Neil Roberts
b2e735ff7f Dynamically load the GL or GLES library
The GL or GLES library is now dynamically loaded by the CoglRenderer
so that it can choose between GL, GLES1 and GLES2 at runtime. The
library is loaded by the renderer because it needs to be done before
calling eglInitialize. There is a new environment variable called
COGL_DRIVER to choose between gl, gles1 or gles2.

The #ifdefs for HAVE_COGL_GL, HAVE_COGL_GLES and HAVE_COGL_GLES2 have
been changed so that they don't assume the ifdefs are mutually
exclusive. They haven't been removed entirely so that it's possible to
compile the GLES backends without the the enums from the GL headers.

When using GLX the winsys additionally dynamically loads libGL because
that also contains the GLX API. It can't be linked in directly because
that would probably conflict with the GLES API if the EGL is
selected. When compiling with EGL support the library links directly
to libEGL because it doesn't contain any GL API so it shouldn't have
any conflicts.

When building for WGL or OSX Cogl still directly links against the GL
API so there is a #define in config.h so that Cogl won't try to dlopen
the library.

Cogl-pango previously had a #ifdef to detect when the GL backend is
used so that it can sneakily pass GL_QUADS to
cogl_vertex_buffer_draw. This is now changed so that it queries the
CoglContext for the backend. However to get this to work Cogl now
needs to export the _cogl_context_get_default symbol and cogl-pango
needs some extra -I flags to so that it can include
cogl-context-private.h
2011-07-11 12:57:38 +01:00
Neil Roberts
59f746d281 cogl-context: Remove the driver private data
Since the GL function pointers have move to the root of CoglContext,
the driver specific data for GLES became empty and the GL data had
only one varible which apparently nothing was using. It's therefore
convenient to remove the private driver data to make it easier to have
a build of Cogl which enables both GL and GLES support. If we ever
need driver private data later we might want to use
cogl_object_set_user_data instead.
2011-07-08 15:35:50 +01:00
Neil Roberts
dae02a99a5 Move all of the GL function pointers directly to CoglContext
Instead of storing all of the feature function pointers in the driver
specific data of the CoglContext they are now all stored directly in
CoglContext. There is a single header containing the description of
the functions which gets included by cogl-context.h. There is a single
function in cogl-feature-private.c to check for all of these
functions.

The name of the function pointer variables have been changed from
ctx->drv.pf_glWhatever to just ctx->glWhatever.

The feature flags that get set when an extension is available are now
separated from the table of extensions. This is necessary because
different extensions can mean different things on GLES and GL. For
example, having access to glMapBuffer implies read and write support
on GL but only write support on GLES. The flags are instead set in the
driver specific init function by checking whether the function
pointers were successfully resolved.

_cogl_feature_check has been changed to assume the feature is
supported if any of the listed extensions are available instead of
requiring all of them. This makes it more convenient to specify
alternate names for the extension. Nothing else had previously listed
more than one name for an extension so this shouldn't cause any
problems.
2011-07-07 02:05:42 +01:00
Robert Bragg
8bfde524f8 matrix: Flatten cogl-matrix-mesa.[ch] into cogl-matrix.[ch]
It has been overly cumbersome to work with the matrix code ever since we
pulled in the mesa code because we initially kept the mesa and the
original cogl code separate. We have made several updates to the mesa
code since integrating, and the coding style has changed a lot compared
to the original mesa code, so there's little point in keeping the two
files separate any longer.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Neil Roberts
17c9cb8d49 Add the code from FreeBSD for their linked-list/queue implementation
This directly copies in the header from the FreeBSD kernel for their
linked-list implementation. A later patch will modify it but this
patch is here so we can have a clear patch to show what the
changes are.

Using the list implementation from this header is beneficial as
opposed to using GList because it's possible to embed the list
pointers directly into another struct. This saves a separate
allocation and it also makes it possible to remove an item from the
list without having to iterate the entire list to find its list
node. The header provides four different list types: single and
doubley linked lists and each of them can either have a header with
pointers to the beginning and end or just to the beginning. Glib
effectively only provides single and doubley linked lists with a
pointer to the beginning or a doubley-linked list with a pointer to
both (GQueue).

https://bugzilla.gnome.org/show_bug.cgi?id=652514
2011-07-01 17:52:55 +01:00
Robert Bragg
5dff6f6aa1 renderer: split win32 api out into separate header
This adds a cogl-win32-renderer.h for the win32 specific cogl-renderer
API instead of having #ifdef guards in cogl-renderer.h

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:46 +01:00
Robert Bragg
cd6e1d183d Updates wayland symbol names to be consistent
This updates the public wayland symbols to follow the pattern
cogl_wayland_blah instead of cogl_blah_wayland.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:46 +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
57d76e315f Fixes for make distcheck 2011-06-14 17:09:55 +01:00
Robert Bragg
800f5e6d6e profile: Adds a --enable-profile option
This adds a --enable-profile option which enables uprof based profiling.
It was also necessary to fixup a CLUTTER_ENABLE_PROFILING #ifdef in
cogl-context.c to renamed COGL_ENABLE_PROFILING instead. By default Cogl
doesn't output uprof reports directly, instead it assumes a higher level
toolkit will output a report. If you want a report from Cogl you can
export COGL_PROFILE_OUTPUT_REPORT=1 before running your app.

The latest version of uprof can be fetched from:
git://github.com/rib/UProf.git
2011-06-14 17:09:55 +01:00
Robert Bragg
3729bf2769 Make it clearer that the 2.0 API is experimental
This explicitly renames the cogl-2.0 reference manual to
cogl-2.0-experimental and renames the cogl-2.0 pkg-config file to
cogl-2.0-experimental.pc. Hopefully this should avoid
miss-understandings.
2011-06-14 17:09:55 +01:00
Robert Bragg
bbfe8b8ec4 gir: pass dep cflags to gobject introspection scanner
The gobject introspection scanner was failing to find EGL headers so we
now pass the COGL_DEP_CFLAGS to Cogl_1_0_gir_CFLAGS.
2011-06-01 20:44:43 +01:00
Robert Bragg
60b25615fd Add _cogl_egl_texture_2d_new_from_image API
This adds an internal texture_2d constructor that can wrap an EGLImage
as a CoglTexture2D. The plan is to utilize this for texture-from-pixmap
support with EGL as well as creating textures from wayland buffers.
2011-06-01 20:44:42 +01:00
Robert Bragg
b380fed23d Make stub winsys into a proper winsys backend
Instead of the stub winsys being a special case set of #ifdef'd code
used when COGL_HAS_FULL_WINSYS wasn't defined, the stub winsys now
implements a CoglWinsysVtable like all other winsys backends (it's just
that everything is a NOP). This way we can get rid of the
COGL_HAS_FULL_WINSYS define and also the stub winsys can be runtime
selected whereas before it was incompatible with all other winsys
backends.
2011-06-01 20:44:41 +01:00
Robert Bragg
ee7cc9e788 Make CoglTexture2D public as experimental API
This exposes a CoglTexture2D typedef and adds the following experimental
API:
    cogl_is_texture_2d
    cogl_texture_2d_new_with_size
    cogl_texture_2d_new_from_data
    cogl_texture_2d_new_from_foreign

Since this is experimental API you need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h.

Note: With these new entrypoints we now expect a CoglContext pointer to
be passed in, instead of assuming there is a default context. The aim is
that for Cogl 2.0 we won't have a default context so this is a step in
that direction.
2011-06-01 20:44:41 +01:00
Robert Bragg
5a9b92a4a5 Revert "Initial build of a Quartz winsys stub"
This reverts commit b2e41f1bfa.

We are backing out the quartz specific stub winsys since we can simply
use the generic stub winsys on quartz until we develop a standalone
winsys. Since we plan on removing all special cases for the stub winsys
by handling with a winsys vtable like all the others it's better if we
don't introduce a quartz specific stub.
2011-06-01 20:21:59 +01:00
Emmanuele Bassi
b2e41f1bfa Initial build of a Quartz winsys stub 2011-05-24 23:08:59 +01:00
Damien Lespiau
f436582114 android: Add support for an EGL/Android winsys
The native window type of the EGL/Android winsys is ANativeWinow*. The
Android NDK gives you a pointer to this ANativeWindow and you just need
to configure that window using the EGLConfig you are choosing when
creating the context.

This means you have to know the ANativeWindow* window before creating
the context. This is solved here by just having a global variable you
can set with cogl_android_set_native_window() before creating the
context. This is a bit ugly though, and it conceptually belongs to the
OnScreen creation to know which ANativeWindow* to use. This would need a
"lazy context creation" mechanism, waiting for the user to create the
OnScreen to initialize the GL context.
2011-05-17 15:24:54 +01:00
Robert Bragg
07c0b9f89f Add CoglDepthState API
Instead of simply extending the cogl_pipeline_ namespace to add api for
controlling the depth testing state we now break the api out. This adds
a CoglDepthState type that can be stack allocated. The members of the
structure are private but we have the following API to setup the state:

    cogl_depth_state_init
    cogl_depth_state_set_test_enabled
    cogl_depth_state_get_test_enabled
    cogl_depth_state_set_test_function
    cogl_depth_state_get_test_function
    cogl_depth_state_set_writing_enabled
    cogl_depth_state_get_writing_enabled
    cogl_depth_state_set_range
    cogl_depth_state_get_range

This removes the following experimental API which is now superseded:

    cogl_material_set_depth_test_enabled
    cogl_material_get_depth_test_enabled
    cogl_material_set_depth_test_function
    cogl_material_get_depth_test_function
    cogl_material_set_depth_writing_enabled
    cogl_material_get_depth_writing_enabled
    cogl_material_set_depth_range
    cogl_material_get_depth_range

Once a CoglDepthState structure is setup it can be set on a pipeline
using cogl_pipeline_set_depth_state().
2011-05-16 18:36:44 +01:00
Neil Roberts
a466dc272b Don't include cogl-pango.h when scanning introspection data
cogl/cogl-pango.h can't be included unless the include directory for
Pango is given in the compiler flags. In an application, it is
expected that if they are using this header then they would pull in
cogl-pango-1.0.pc which would provide this. However when building Cogl
itself we might be building without Pango support so the Makefile
can't rely on PANGO_CFLAGS. This was breaking building the
introspection data because cogl-pango.h was listed as one of the files
to scan but it can't be included.
2011-05-16 15:41:25 +01:00
Robert Bragg
bf7653ac93 Rename CoglIndexArray to CoglIndexBuffer
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to strongly imply a relationship between
CoglBuffers and CoglIndexBuffers and be consistent with the
CoglAttributeBuffer and CoglPixelBuffer APIs.
2011-05-16 14:31:31 +01:00
Robert Bragg
c328e0608f Rename CoglPixelArray to CoglPixelBuffer
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to strongly imply a relationship between
CoglBuffers and CoglPixelBuffers and be consistent with the
CoglAttributeBuffer and CoglIndexBuffer APIs.
2011-05-16 14:31:31 +01:00
Robert Bragg
ce7c06dc03 Rename CoglVertexArray to CoglAttributeBuffer
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to have a strongly implied relationship
between CoglAttributes and CoglAttributeBuffers.
2011-05-16 14:31:31 +01:00
Robert Bragg
df1915d957 math: Adds an experimental euler API
This adds an experimental CoglEuler data type and the following new
functions:

    cogl_euler_init
    cogl_euler_init_from_matrix
    cogl_euler_init_from_quaternion
    cogl_euler_equal
    cogl_euler_copy
    cogl_euler_free
    cogl_quaternion_init_from_euler

Since this is experimental API you need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h
2011-05-16 14:12:42 +01:00
Robert Bragg
d1434d1c33 math: Adds an experimental quaternion API
This adds an experimental quaternion utility API. It's not yet fully
documented but it's complete enough that people can start to experiment
with using it. It adds the following functions:

    cogl_quaternion_init_identity
    cogl_quaternion_init
    cogl_quaternion_init_from_angle_vector
    cogl_quaternion_init_from_array
    cogl_quaternion_init_from_x_rotation
    cogl_quaternion_init_from_y_rotation
    cogl_quaternion_init_from_z_rotation
    cogl_quaternion_equal
    cogl_quaternion_copy
    cogl_quaternion_free
    cogl_quaternion_get_rotation_angle
    cogl_quaternion_get_rotation_axis
    cogl_quaternion_normalize
    cogl_quaternion_dot_product
    cogl_quaternion_invert
    cogl_quaternion_multiply
    cogl_quaternion_pow
    cogl_quaternion_slerp
    cogl_quaternion_nlerp
    cogl_quaternion_squad
    cogl_get_static_identity_quaternion
    cogl_get_static_zero_quaternion

Since it's experimental API you'll need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h.
2011-05-16 14:11:47 +01:00
Robert Bragg
b316241612 deprecate #include <cogl/cogl-pango.h>
cogl-pango is conceptually a separate library so it doesn't seem
appropriate to bundle the headers with all the other cogl headers. Also
in-tree the headers live in a cogl-pango directory so if we want
examples that can include cogl-pango consistently when built in or out
of tree using the convention #include <cogl-pango/cogl-pango.h> makes
that easy.

This adds a compatibility cogl/cogl-pango.h header that's will redirect
to cogl-pango/cogl-pango.h with a warning, or result in an error if
COGL_ENABLE_EXPERIMENTAL_2_0_API is defined.
2011-05-16 13:28:17 +01:00
Neil Roberts
6788c80342 Add a WGL winsys
This adds a full winsys to handle WGL and Win32.
2011-05-10 17:58:41 +01:00
Robert Bragg
e8b83f2880 Adds wayland support to the cogl EGL winsys
Wayland now supports integration via standard eglSurfaces which makes it
possible to share more code with other EGL platforms. (though at some
point cogl-winsys-egl.c really needs to gain a more formal
CoglEGLPlatform abstraction so we can rein back on the amount of #ifdefs
we have.)
2011-05-10 16:36:40 +01:00
Damien Lespiau
62b7ea5972 build: Fix make distcheck
Some header files were split but never included in the list of source
files and thus not distributed.
2011-05-06 17:13:42 +01:00
Emmanuele Bassi
48c9157e97 build: Compile the introspection data
The compilation step for the introspection data was missing.
2011-05-06 16:53:43 +01:00
Robert Bragg
8b4ee0964b Remove all the options for building cogl standalone
This removes all the remnants from being able to build Cogl standalone
while it was part of the Clutter repository. Now that Cogl has been
split out then standalone builds are the only option.
2011-05-06 12:36:39 +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
3a4d0a735b Export some private symbols from libcogl for coglpango
Ideally we wouldn't have any private symbols exported, but for now there
are some APIs that coglpango needs access to that aren't public so we
have ensure they are exported. The aim is to get rid of this need at
some point.
2011-05-05 20:34:54 +01:00
Robert Bragg
195cfa7814 cogl/Makefile.am: pass EXTRA_LDFLAGS for linking
When building on windows for example we need to ensure we pass
-no-undefined to the linker. Although we were substituting a
COGL_EXTRA_LDFLAGS variable from our configure.ac we forgot to
reference that when linking cogl.
2011-05-05 15:05:41 +01:00
Robert Bragg
b3a7ee5930 cogl: remove OSX/WIN32 specific bits in favour of a stub winsys
Until Cogl gains native win32/OSX support this remove the osx and win32
winsys files and instead we'll just rely on the stub-winsys.c to handle
these platforms. Since the only thing the platform specific files were
providing anyway was a get_proc_address function; it was trivial to
simply update the clutter backend code to handle this directly for now.
2011-05-05 15:05:41 +01:00
Robert Bragg
7037812ae6 EGL: Updates GDL platform support
The GDL API is used for example on intel ce4100 (aka Sodaville) based
systems as a way to allocate memory that can be composited using the
platforms overlay hardware. This updates the Cogl EGL winsys and the
support in Clutter so we can continue to support these platforms.
2011-05-05 14:46:02 +01:00
Robert Bragg
d5d11f1878 Moves all EGL code down from Clutter to Cogl
As was recently done for the GLX window system code, this commit moves
the EGL window system code down from the Clutter backend code into a
Cogl winsys.

Note: currently the cogl/configure.ac is hard coded to only build the GLX
winsys so currently this is only available when building Cogl as part
of Clutter.
2011-05-05 14:46:01 +01:00
Robert Bragg
8399f5e61c remove references to unused DRM_SURFACELESS EGL platform
The "DRM_SURFACELESS" EGL platform was invented when we were adding the
wayland backend to Clutter but in the end we added a dedicated backend
instead of extending the EGL backend so actually the platform name isn't
used.
2011-05-05 14:46:01 +01:00
Neil Roberts
4a7762d6d7 cogl-context: Store winsys features in an array of unsigned ints
Previously the mask of available winsys features was stored in a
CoglBitmask. That isn't the ideal type to use for this because it is
intended for a growable array of bits so it can allocate extra memory
if there are more than 31 flags set. For the winsys feature flags the
highest used bit is known at compile time so it makes sense to
allocate a fixed array instead. This is conceptually similar to the
CoglDebugFlags which are stored in an array of integers with macros to
test a bit in the array. This moves the macros used for CoglDebugFlags
to cogl-flags.h and makes them more generic so they can be shared with
CoglContext.
2011-04-20 18:20:10 +01:00
Robert Bragg
1928f7ec0e backend: remove untested fruity backend
This backend hasn't been used for years now and so because it is
untested code and almost certainly doesn't work any more it would be a
burdon to continue trying to maintain it. Considering that we are now
looking at moving OpenGL window system integration code down from
Clutter backends into Cogl that will be easier if we don't have to
consider this backend.
2011-04-11 17:54:36 +01:00
Robert Bragg
efb570fdae Adds the ability to build Cogl standalone
This adds an autogen.sh, configure.ac and build/autotool files etc under
clutter/cogl and makes some corresponding Makefile.am changes that make
it possible to build and install Cogl as a standalone library.

Some notable things about this are:
A standalone installation of Cogl installs 3 pkg-config files;
cogl-1.0.pc, cogl-gl-1.0.pc and cogl-2.0.pc. The second is only for
compatibility with what clutter installed though I'm not sure that
anything uses it so maybe we could remove it. cogl-1.0.pc is what
Clutter would use if it were updated to build against a standalone cogl
library. cogl-2.0.pc is what you would use if you were writing a
standalone Cogl application.

A standalone installation results in two libraries currently, libcogl.so
and libcogl-pango.so. Notably we don't include a major number in the
sonames because libcogl supports two major API versions; 1.x as used by
Clutter and the experimental 2.x API for standalone applications.
Parallel installation of later versions e.g. 3.x and beyond will be
supportable either with new sonames or if we can maintain ABI then we'll
continue to share libcogl.so.

The headers are similarly not installed into a directory with a major
version number since the same headers are shared to export the 1.x and
2.x APIs (The only difference is that cogl-2.0.pc ensures that
-DCOGL_ENABLE_EXPERIMENTAL_2_0_API is used). Parallel installation of
later versions is not precluded though since we can either continue
sharing or later add a major version suffix.
2011-04-11 17:54:36 +01:00
Robert Bragg
d40cdfa3e1 Moves all GLX code down from Clutter to Cogl
This migrates all the GLX window system code down from the Clutter
backend code into a Cogl winsys. Moving OpenGL window system binding
code down from Clutter into Cogl is the biggest blocker to having Cogl
become a standalone 3D graphics library, so this is an important step in
that direction.
2011-04-11 17:54:36 +01:00
Robert Bragg
bcd97f35ea Adds renderer,display,onscreen-template and swap-chain stubs
As part of the process of splitting Cogl out as a standalone graphics
API we need to introduce some API concepts that will allow us to
initialize a new CoglContext when Clutter isn't there to handle that for
us...

The new objects roughly in the order that they are (optionally) involved
in constructing a context are: CoglRenderer, CoglOnscreenTemplate,
CoglSwapChain and CoglDisplay.

Conceptually a CoglRenderer represents a means for rendering.  Cogl
supports rendering via OpenGL or OpenGL ES 1/2.0 and those APIs are
accessed through a number of different windowing APIs such as GLX, EGL,
SDL or WGL and more. Potentially in the future Cogl could render using
D3D or even by using libdrm and directly banging the hardware. All these
choices are wrapped up in the configuration of a CoglRenderer.

Conceptually a CoglDisplay represents a display pipeline for a renderer.
Although Cogl doesn't aim to provide a detailed abstraction of display
hardware, on some platforms we can give control over multiple display
planes (On TV platforms for instance video content may be on one plane
and 3D would be on another so a CoglDisplay lets you select the plane
up-front.)

Another aspect of CoglDisplay is that it lets us negotiate a display
pipeline that best supports the type of CoglOnscreen framebuffers we are
planning to create. For instance if you want transparent CoglOnscreen
framebuffers then we have to be sure the display pipeline wont discard
the alpha component of your framebuffers. Or if you want to use
double/tripple buffering that requires support from the display
pipeline.

CoglOnscreenTemplate and CoglSwapChain are how we describe our default
CoglOnscreen framebuffer configuration which can affect the
configuration of the display pipeline.

The default/simple way we expect most CoglContexts to be constructed
will be via something like:

 if (!cogl_context_new (NULL, &error))
   g_error ("Failed to construct a CoglContext: %s", error->message);

Where that NULL is for an optional "display" parameter and NULL says to
Cogl "please just try to do something sensible".

If you want some more control though you can manually construct a
CoglDisplay something like:

 display = cogl_display_new (NULL, NULL);
 cogl_gdl_display_set_plane (display, plane);
 if (!cogl_display_setup (display, &error))
   g_error ("Failed to setup a CoglDisplay: %s", error->message);

And in a similar fashion to cogl_context_new() you can optionally pass
a NULL "renderer" and/or a NULL "onscreen template" so Cogl will try to
just do something sensible.

If you need to change the CoglOnscreen defaults you can provide a
template something like:
  chain = cogl_swap_chain_new ();
  cogl_swap_chain_set_has_alpha (chain, TRUE);
  cogl_swap_chain_set_length (chain, 3);

  onscreen_template = cogl_onscreen_template_new (chain);
  cogl_onscreen_template_set_pixel_format (onscreen_template,
                                           COGL_PIXEL_FORMAT_RGB565);

  display = cogl_display_new (NULL, onscreen_template);
  if (!cogl_display_setup (display, &error))
    g_error ("Failed to setup a CoglDisplay: %s", error->message);
2011-04-11 17:54:35 +01:00
Robert Bragg
e80a2b9b2f rename winsys files to be more consistent
This tries to make the naming style of files under cogl/winsys/
consistent with other cogl source files. In particular private header
files didn't have a '-private' infix.
2011-04-11 17:54:35 +01:00
Robert Bragg
9f19244971 Add temporary cogl-clutter.h to aid splitting out Cogl
This gives us a way to clearly track the internal Cogl API that Clutter
depends on. The aim is to split Cogl out from Clutter into a standalone
3D graphics API and eventually we want to get rid of any private
interfaces for Clutter so its useful to have a handle on that task.
Actually it's not as bad as I was expecting though.
2011-04-11 17:54:35 +01:00
Robert Bragg
c415818537 cogl: consolidate _create_context_driver + _features_init
This moves the functionality of _cogl_create_context_driver from
driver/{gl,gles}/cogl-context-driver-{gl,gles}.c into
driver/{gl,gles}/cogl-{gl,gles}.c as a static function called
initialize_context_driver.

cogl-context-driver-{gl,gles}.[ch] have now been removed.
2011-04-11 15:26:25 +01:00
Robert Bragg
e9b1ca0165 cogl: Adds experimental cogl_context_new() API
This adds a new experimental function (you need to define
COGL_ENABLE_EXPERIMENTAL_API to access it) which takes us towards being
able to have a standalone Cogl API. This is really a minor aesthetic
change for now since all the GL context creation code still lives in
Clutter but it's a step forward none the less.

Since our current designs introduce a CoglDisplay object as something
that would be passed to the context constructor this provides a stub
cogl-display.h with CoglDisplay typedef.

_cogl_context_get_default() which Clutter uses to access the Cogl
context has been modified to use cogl_context_new() to initialize
the default context.

There is one rather nasty hack used in this patch which is that the
implementation of cogl_context_new() has to forcibly make the allocated
context become the default context because currently all the code in
Cogl assumes it can access the context using _COGL_GET_CONTEXT including
code used to initialize the context.
2011-04-11 15:26:20 +01:00
Robert Bragg
fdbc741770 cogl: rename cogl-context.h cogl-context-private.h
Since we plan to add public cogl_context_* API we need to rename the
current cogl-context.h which contains private member details.
2011-04-11 15:18:12 +01:00
Neil Roberts
f38b7a78fb cogl: Use GHookList instead of CoglCallbackList
glib already has a data type to manage a list of callbacks called a
GHookList so we might as well use it instead of maintaining Cogl's own
type. The glib version may be slightly more efficient because it
avoids using a GList and instead encodes the prev and next pointers
directly in the GHook structure. It also has more features than
CoglCallbackList.
2011-03-14 18:18:15 +00:00
Jasper St. Pierre
30fa4e1a20 cogl-clip-state: Adapt to experimental cogl2 API.
The current clip state implementation couldn't be used in
conjunction with the CoglPath experimental API.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2594

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-03-10 13:05:43 +00:00
Neil Roberts
c8ddb3b55a cogl-atlas: Try 4 different approaches for migrating textures
Instead of directly banging GL to migrate textures the atlas now uses
the CoglFramebuffer API. It will use one of four approaches; it can
set up two FBOs and use _cogl_blit_framebuffer to copy between them;
it can use a single target fbo and then render the source texture to
the FBO using a Cogl draw call; it can use a single FBO and call
glCopyTexSubImage2D; or it can fallback to reading all of the texture
data back to system memory and uploading it again with a sub texture
update.

Previously GL calls were used directly because Cogl wasn't able to
create a framebuffer without a stencil and depth buffer. However there
is now an internal version of cogl_offscreen_new_to_texture which
takes a set of flags to disable the two buffers.

The code for blitting has now been moved into a separate file called
cogl-blit.c because it has become quite long and it may be useful
outside of the atlas at some point.

The 4 different methods have a fixed order of preference which is:

* Texture render between two FBOs
* glBlitFramebuffer
* glCopyTexSubImage2D
* glGetTexImage + glTexSubImage2D

Once a method is succesfully used it is tried first for all subsequent
blits. The default default can be overridden by setting the
environment variable COGL_ATLAS_DEFAULT_BLIT_MODE to one of the
following values:

* texture-render
* framebuffer
* copy-tex-sub-image
* get-tex-data
2011-02-15 12:10:54 +00:00
Robert Bragg
9b0fd92527 cogl: rename CoglVertexAttribute CoglAttribute
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to reduce the verbosity
of using the API. Another reason is that CoglVertexArray is going to be
renamed CoglAttributeBuffer and we want to help emphasize the
relationship between CoglAttributes and CoglAttributeBuffers.
2011-01-21 16:24:14 +00:00
Robert Bragg
1f0826543e cogl: Adds _cogl_util_point_in_polygon API
This adds a utility function that can determine if a given point
intersects an arbitrary polygon, by counting how many edges a
"semi-infinite" horizontal ray crosses from that point. The plan is to
use this for a software based read-pixel fast path that avoids using the
GPU to rasterize journaled primitives and can instead intersect a point
being read with quads in the journal to determine the correct color.
2011-01-21 16:18:11 +00:00
Neil Roberts
dc1f1949d0 Remove the GLES2 wrapper
The GLES2 wrapper is no longer needed because the shader generation is
done within the GLSL fragend and vertend and any functions that are
different for GLES2 are now guarded by #ifdefs.
2010-12-13 17:29:14 +00:00
Neil Roberts
fa13f6c107 cogl: Add a vertend to generate GLSL
The GLSL vertend is mostly only useful for GLES2. The fixed function
vertend is kept at higher priority than the GLSL vertend so it is
unlikely to be used in any other circumstances.
2010-12-13 17:28:28 +00:00
Neil Roberts
3cf9159769 cogl: Add a fixed function vertend
The vertends are intended to flush state that would be represented in
a vertex program. Code to handle the layer matrix, lighting and
point size has now been moved from the common cogl-pipeline-opengl
backend to the fixed vertend.
2010-12-13 17:22:57 +00:00
Neil Roberts
9b1ab9f0ec cogl: Add a GLSL 'progend'
'progend' is short for 'program backend'. The progend is intended to
operate on combined state from a fragment backend and a vertex
backend. The progend has an 'end' function which is run whenever the
pipeline is flushed and the two pipeline change notification
functions. All of the progends are run whenever the pipeline is
flushed instead of selecting a single one because it is possible that
multiple progends may be in use for example if the vertends and
fragends are different. The GLSL progend will take the shaders
generated by the fragend and vertend and link them into a single
program. The fragend code has been changed to only generate the shader
and not the program. The idea is that pipelines can share fragment
shader objects even if their vertex state is different. The authority
for the progend needs to be the combined authority on the vertend and
fragend state.
2010-12-13 17:22:57 +00:00
Neil Roberts
0098dc7acc Rename CoglPipelineBackend to CoglPipelineFragend
The current Cogl pipeline backends are entirely concerned with the
fragment processing state. We also want to eventually have separate
backends to generate shaders for the vertex processing state so we
need to rename the fragment backends. 'Fragend' is a somewhat weird
name but we wanted to avoid ending up with illegible symbols like
CoglPipelineFragmentBackendGlslPrivate.
2010-12-13 17:22:57 +00:00
Robert Bragg
fd10e3a545 matrix gtype: registers a boxed type for CoglMatrix
To allow us to have gobject properties that accept a CoglMatrix value we
need to register a GType. This adds a cogl_gtype_matrix_get_type function
that will register a static boxed type called "CoglMatrix".

This adds a new section to the reference manual for GType integration
functions.
2010-12-07 12:16:50 +00:00
Neil Roberts
c50cb72748 Remove the fragment shader generation from the GLES2 wrapper
The GLES2 wrapper no longer needs to generate any fragment shader
state because the GLSL pipeline backend will always give the wrapper a
custom fragment shader. This simplifies a lot of the state comparison
done by the wrapper. The fog generation is also removed even though
it's actually part of the vertex shader because only the fixed
function pipeline backend actually calls the fog functions so it would
be disabled when using any of the other backends anyway. We can fix
this when the two shader backends also start generating vertex
shaders.
2010-11-24 18:06:44 +00:00
Evan Nemerson
3be05abf60 cogl: Include exported pacakges information in GIR
http://bugzilla.clutter-project.org/show_bug.cgi?id=2438
2010-11-24 17:18:17 +00:00
Emmanuele Bassi
ebdf112732 build: Add missing cogl-shader-boilerplate.h 2010-11-20 10:47:22 +00:00
Emmanuele Bassi
13561e2e2d build: Add a missing file 2010-11-19 18:30:06 +00:00
Emmanuele Bassi
05f5ae1a97 build: Don't reference non-existing files 2010-11-19 18:15:49 +00:00
Robert Bragg
cce8645aba path 2.0: update path API for experimental 2.0 API
When COGL_ENABLE_EXPERIMENTAL_2_0_API is defined cogl.h will now include
cogl2-path.h which changes cogl_path_new() so it can directly return a
CoglPath pointer; it no longer exposes a prototype for
cogl_{get,set}_path and all the remaining cogl_path_ functions now take
an explicit path as their first argument.

The idea is that we want to encourage developers to retain path objects
for as long as possible so they can take advantage of us uploading the
path geometry to the GPU. Currently although it is possible to start a
new path and query the current path, it is not convenient.

The other thing is that we want to get Cogl to the point where nothing
depends on a global, current context variable. This will allow us to one
day define a sensible threading model if/when that is ever desired.
2010-11-11 13:17:26 +00:00
Neil Roberts
caa991d7a1 cogl: Don't flush the journal when flushing clip state
Flushing the clip state no longer does anything that would cause the
journal to flush. The clip state is only flushed when flushing the
framebuffer state and in all cases this ends up flushing the journal
in one way or another anyway. Avoiding flushing the journal will make
it easier to log the clip state in the journal.

Previously when trying to set up a rectangle clip that can't be
scissored or when using a path clip the code would use cogl_rectangle
as part of the process to fill the stencil buffer. This is now changed
to use a new internal _cogl_rectangle_immediate function which
directly uses the vertex array API to draw a triangle strip without
affecting the journal. This should be just as efficient as the
previous journalled code because these places would end up flushing
the journal immediately before and after submitting the single
rectangle anyway and flushing the journal always creates a new vbo so
it would effectively do the same thing.

Similarly there is also a new internal _cogl_clear function that does
not flush the journal.
2010-11-04 18:10:08 +00:00
Robert Bragg
f80cb197a9 cogl: rename CoglMaterial -> CoglPipeline
This applies an API naming change that's been deliberated over for a
while now which is to rename CoglMaterial to CoglPipeline.

For now the new pipeline API is marked as experimental and public
headers continue to talk about materials not pipelines. The CoglMaterial
API is now maintained in terms of the cogl_pipeline API internally.
Currently this API is targeting Cogl 2.0 so we will have time to
integrate it properly with other upcoming Cogl 2.0 work.

The basic reasons for the rename are:
- That the term "material" implies to many people that they are
  constrained to fragment processing; perhaps as some kind of high-level
  texture abstraction.
    - In Clutter they get exposed by ClutterTexture actors which may be
      re-inforcing this misconception.
- When comparing how other frameworks use the term material, a material
  sometimes describes a multi-pass fragment processing technique which
  isn't the case in Cogl.
- In code, "CoglPipeline" will hopefully be a much more self documenting
  summary of what these objects represent; a full GPU pipeline
  configuration including, for example, vertex processing, fragment
  processing and blending.
- When considering the API documentation story, at some point we need a
  document introducing developers to how the "GPU pipeline" works so it
  should become intuitive that CoglPipeline maps back to that
  description of the GPU pipeline.
- This is consistent in terminology and concept to OpenGL 4's new
  pipeline object which is a container for program objects.

Note: The cogl-material.[ch] files have been renamed to
cogl-material-compat.[ch] because otherwise git doesn't seem to treat
the change as a moving the old cogl-material.c->cogl-pipeline.c and so
we loose all our git-blame history.
2010-11-03 18:09:23 +00:00
Robert Bragg
9498d505dd cogl: Adds experimental CoglPrimitive API
A CoglPrimitive is a retainable object for drawing a single primitive,
such as a triangle strip, fan or list.

CoglPrimitives build on CoglVertexAttributes and CoglIndices which
themselves build on CoglVertexArrays and CoglIndexArrays respectively.

A CoglPrimitive encapsulates enough information such that it can be
retained in a queue (e.g. the Cogl Journal, or renderlists in the
future) and drawn at some later time.
2010-11-03 18:04:31 +00:00
Robert Bragg
070d90937b cogl: Adds experimental CoglVertexAttribute API
A CoglVertexAttribute defines a single attribute contained in a
CoglVertexArray. I.e. a CoglVertexArray is simply a buffer of N bytes
intended for containing a collection of attributes (position, color,
normals etc) and a CoglVertexAttribute defines one such attribute by
specifying its start offset in the array, its type, the number of
components and the stride etc.
2010-11-03 18:04:26 +00:00
Robert Bragg
6e620e94b6 cogl: Adds experimental CoglIndices API
CoglIndices define a range of indices inside a CoglIndexArray. I.e. a
CoglIndexArray is simply a buffer of N bytes and you can then
instantiate multiple CoglIndices collections that define a sub-region of
a CoglIndexArray by specifying a start offset and an index data type.
2010-11-03 18:04:00 +00:00
Robert Bragg
296d14e946 cogl: Adds experimental CoglVertexArray type
This adds a new CoglVertexArray object which is a subclass of CoglBuffer
used to hold vertex attributes. A later commit will add a
CoglVertexAttribute API which will be used to describe the attributes
inside a CoglVertexArray.
2010-11-03 18:04:00 +00:00
Robert Bragg
4d990a93a8 cogl: Adds experimental CoglIndexArray type
A CoglIndexArray is a subclass of CoglBuffer and will be used to hold
vertex indices. A later commit will add a CoglIndices API which will
allow describing a range of indices inside a CoglIndexArray.
2010-11-03 18:04:00 +00:00
Neil Roberts
63206a208b Merge cogl-program-{gl,gles}.c into one cogl-program.c
This merges the two implementations of CoglProgram for the GLES2 and
GL backends into one. The implementation is more like the GLES2
version which would track the uniform values and delay sending them to
GL. CoglProgram is now effectively just a GList of CoglShaders along
with an array of stored uniform values. CoglProgram never actually
creates a GL program, instead this is left up to the GLSL material
backend. This is necessary on GLES2 where we may need to relink the
user's program with different generated shaders depending on the other
emulated fixed function state. It will also be necessary in the future
GLSL backends for regular OpenGL. The GLSL and ARBfp material backends
are now the ones that create and link the GL program from the list of
shaders. The linked program is attached to the private material state
so that it can be reused if the CoglProgram is used again with the
same material. This does mean the program will get relinked if the
shader is used with multiple materials. This will be particularly bad
if the legacy cogl_program_use function is used because that
effectively always makes one-shot materials. This problem will
hopefully be alleviated if we make a hash table with a cache of
generated programs. The cogl program would then need to become part of
the hash lookup.

Each CoglProgram now has an age counter which is incremented every
time a shader is added. This is used by the material backends to
detect when we need to create a new GL program for the user program.

The internal _cogl_use_program function now takes a GL program handle
rather than a CoglProgram. It no longer needs any special differences
for GLES2. The GLES2 wrapper function now also uses this function to
bind its generated shaders.

The ARBfp shaders no longer store a copy of the program source but
instead just directly create a program object when cogl_shader_source
is called. This avoids having to reupload the source if the same
shader is used in multiple materials.

There are currently a few gross hacks to get the GLES2 backend to work
with this. The problem is that the GLSL material backend is now
generating a complete GL program but the GLES2 wrapper still needs to
add its fixed function emulation shaders if the program doesn't
provide either a vertex or fragment shader. There is a new function in
the GLES2 wrapper called _cogl_gles2_use_program which replaces the
previous cogl_program_use implementation. It extracts the GL shaders
from the GL program object and creates a new GL program containing all
of the shaders plus its fixed function emulation. This new program is
returned to the GLSL material backend so that it can still flush the
custom uniforms using it. The user_program is attached to the GLES2
settings struct as before but its stored using a GL program handle
rather than a CoglProgram pointer. This hack will go away once the
GLSL material backend replaces the GLES2 wrapper by generating the
code itself.

Under Mesa this currently generates some GL errors when glClear is
called in test-cogl-shader-glsl. I think this is due to a bug in Mesa
however. When the user program on the material is changed the GLSL
backend gets notified and deletes the GL program that it linked from
the user shaders. The program will still be bound in GL
however. Leaving a deleted shader bound exposes a bug in Mesa's
glClear implementation. More details are here:

https://bugs.freedesktop.org/show_bug.cgi?id=31194
2010-10-28 19:51:42 +01:00
Kristian Høgsberg
963a0662b4 Add wayland backend
This adds a clutter backend for running under the wayland window system.
Initial cogl framebuffer integration by Robert Bragg.
2010-10-14 16:23:05 +01:00
Emmanuele Bassi
d9e1821501 build: Unconditionally add GLES2 shaders to EXTRA_DIST 2010-10-04 08:57:29 +01:00
Emmanuele Bassi
eb179d4b67 build: Start moving to a non-recursive layout
*** WARNING: THIS COMMIT CHANGES THE BUILD ***

Do not recurse into the backend directories to build private, internal
libraries.

We only recurse from clutter/ into the cogl sub-directory; from there,
we don't recurse any further. All the backend-specific code in Cogl and
Clutter is compiled conditionally depending on the macros defined by the
configure script.

We still recurse from the top-level directory into doc, clutter and
tests, because gtk-doc and tests do not deal nicely with non-recursive
layouts.

This change makes Clutter compile slightly faster, and cleans up the
build system, especially when dealing with introspection data.

Ideally, we also want to make Cogl part of the top-level build, so that
we can finally drop the sed trick to change the shared library from the
GIR before compiling it.

Currently disabled:

  ‣ OSX backend
  ‣ Fruity backend

Currently enabled but untested:

  ‣ EGL backend
  ‣ Windows backend
2010-09-29 14:40:15 +01:00
Emmanuele Bassi
c8f83525ce build: Add cogl-debug-options.h 2010-09-15 16:12:56 +01:00
Emmanuele Bassi
bc4be1c673 build: Add tesselator to the include paths 2010-09-13 11:31:46 +01:00
Emmanuele Bassi
a856003791 build: Remove gir files from dist
The introspection data is going to be generated, so it should never be
in the dist.
2010-09-13 02:10:35 +01:00
Emmanuele Bassi
8f049b360a build: Do not build a noinst library for the tesselator
Let's try to keep Cogl's build as non-recursive as possible, in the hope
that one day we'll be able to make it fully non-recursive along with the
rest of Clutter.
2010-09-12 19:25:47 +01:00
Emmanuele Bassi
08eb738c93 build: Use Makefile.introspection
Whenever possible, instead of writing our own rules for generating GIR
files and typelibs.
2010-09-03 11:38:22 +01:00
Colin Walters
d4d899fa27 introspection: Build fixes
This patch merges in substantial work from
Emmanuele Bassi <ebassi@linux.intel.com>

* Use new introspection --include-uninstalled API since we don't want
  to try to find the clutter-1.0.pc file before it's installed.
* Use --pkg-export for Clutter-1.0.gir, since we want the .gir file to
  contain the associated pkg-config file.
* Drop the use of --pkg for dependencies; those come from the associated
  .gir files.  (Actually, --pkg is almost never needed)
* Add --quiet

http://bugzilla.clutter-project.org/show_bug.cgi?id=2292
2010-09-03 11:38:22 +01:00
Damien Lespiau
7e158c6bc5 cex100: Add a Clutter EGL backend for CE3100/CE4100 SoCs
Intel CE3100 and CE4100 SoCs are designed for TVs. They have separate
framebuffers that are blended together by a piece of hardware to make
the final output. The library that allows you to initialize and
configure those planes is called GDL. A EGL GDL winsys can then be
use with those planes as NativeWindowType to select which plane to use.

This patch adds a new ClutterBackendCex100 backend that can be
selected at compile time with the new --with-flavour=cex100 option.
2010-09-03 11:13:35 +01:00
Damien Lespiau
64b5308d7f introspection: Use the --quiet flag conditionally
--quiet has been added to g-ir-scanner in the 0.9.1 cycle. We really
want to be able to compile clutter with 0.6.14 to be able to reuse
gir files that are distributed in current distributions.

Use the INTROSPECTION_SCANNER_ARGS (previously unused) variable to
convey --quiet when necessary.

Fixes: http://bugzilla.clutter-project.org/show_bug.cgi?id=2265
2010-08-12 16:43:07 +01:00
Neil Roberts
b2f2e69264 cogl-atlas-texture: Split out the atlas data structure
Instead of storing a pointer to the CoglRectangleMap and a handle to
the atlas texture in the context, there is a now a separate data
structure called a CoglAtlas to manage these two. The context just
contains a pointer to this. The code to reorganise the atlas has been
moved from cogl-atlas-texture.c to cogl-atlas.c
2010-08-12 11:56:59 +01:00
Neil Roberts
cb114f43ab cogl: Add an internal utility to maintain a list of callback functions
This adds an internal CoglCallbackList type which is just a GSList of
of function pointers along with a data pointer to form a
closure. There are functions to add and remove items and to invoke the
list of functions. This could be used in a number of places in Cogl.
2010-08-12 11:54:42 +01:00
Neil Roberts
bc20010582 cogl-atlas: Rename to CoglRectangleMap
This simply renames CoglAtlas to CoglRectangleMap without making any
functional changes. The old 'CoglAtlas' is just a data structure for
managing unused areas of a rectangle and it doesn't neccessarily have
to be used for an atlas so it wasn't a very good name.
2010-08-12 11:54:42 +01:00
Emmanuele Bassi
4be7310fb1 build: Make the introspection generation quiet (again) 2010-08-12 09:03:58 +01:00
Robert Bragg
7705469d2b cogl-shader: unifies the driver/{gl,gles} shader files
The per driver implementations of cogl-shader.c had become almost
identical we now have a single cogl/cogl-shader.c instead.
2010-08-03 12:41:37 +01:00
Robert Bragg
8640f527cb cogl: don't include cogl-debug.h in cogl.h or install
cogl-debug.h is an internal header so it shouldn't have been included by
cogl.h and the header shouldn't be installed either.
2010-08-02 17:41:42 +01:00
Robert Bragg
5442e429ba material: split the texture unit management out
In general cogl-material.c has become far to large to manage in one
source file. As one of the ways to try and break it down this patch
starts to move some of lower level texture unit state management out
into cogl-material-opengl.c. The naming is such because the plan is to
follow up and migrate the very GL specific state flushing code into the
same file.
2010-07-13 19:26:58 +01:00
Neil Roberts
5288f6d88d Add a Cogl texture 3D backend
This adds a publicly exposed experimental API for a 3D texture
backend. There is a feature flag which can be checked for whether 3D
textures are supported. Although we require OpenGL 1.2 which has 3D
textures in core, GLES only provides them through an extension so the
feature can be used to detect that.

The textures can be created with one of two new API functions :-

cogl_texture_3d_new_with_size

 and

cogl_texture_3d_new_from_data

There is also internally a new_from_bitmap function. new_from_data is
implemented in terms of this function.

The two constructors are effectively the only way to upload data to a
3D texture. It does not work to call glTexImage2D with the
GL_TEXTURE_3D target so the virtual for cogl_texture_set_region does
nothing. It would be possible to make cogl_texture_get_data do
something sensible like returning all of the images as a single long
image but this is not currently implemented and instead the virtual
just always fails. We may want to add API specific to the 3D texture
backend to get and set a sub region of the texture.

All of those three functions can throw a GError. This will happen if
the GPU does not support 3D textures or it does not support NPOTs and
an NPOT size is requested. It will also fail if the FBO extension is
not supported and the COGL_TEXTURE_NO_AUTO_MIPMAP flag is not
given. This could be avoided by copying the code for the
GL_GENERATE_MIPMAP TexParameter fallback, but in the interests of
keeping the code simple this is not yet done.

This adds a couple of functions to cogl-texture-driver for uploading
3D data and querying the 3D proxy
texture. prep_gl_for_pixels_upload_full now also takes sets the
GL_UNPACK_IMAGE_HEIGHT parameter so that 3D textures can have padding
between the images. Whenever 3D texture is uploading, both the height
of the images and the height of all of the data is specified (either
explicitly or implicilty from the CoglBitmap) so that the image height
can be deduced by dividing by the depth.
2010-07-13 14:28:52 +01:00
Emmanuele Bassi
added497f4 Merge branch 'cally-merge'
* cally-merge:
  cally: Add introspection generation
  cally: Improving cally doc
  cally: Cleaning CallyText
  cally: Refactoring "window:create" and "window:destroy" emission code
  cally: Use proper backend information on CallyActor
  cally: Check HAVE_CONFIG_H on cally-util.c
  docs: Fix Cally documentation
  cally: Clean up the headers
  Add binaries of the Cally examples to the ignore file
  docs: Add Cally API reference
  Avoid to load cally module on a11y examples
  Add accessibility tests
  Initialize accessibility support on clutter_init
  Rename some methods and includes to avoid -Wshadow warnings
  Cally initialization code
  Add Cally
2010-07-07 16:06:30 +01:00
Emmanuele Bassi
0eb9fc04f5 cally: Add introspection generation
Toolkits and applications not written in C might still need access to
the Cally API to write accessibility extensions based on it for their
own native elements.
2010-07-07 15:57:43 +01:00
Alexandros Frantzis
bf56e798c6 build: Exclude built sources from the dist
http://bugzilla.clutter-project.org/show_bug.cgi?id=2169

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-06 13:24:00 +01:00
Robert Bragg
521d9ca203 rename CoglPixelBuffer to CoglPixelArray
This renames CoglPixelBuffer to CoglPixelArray to be consistent with the
new CoglVertexArray API.
2010-07-05 15:20:04 +01:00
Robert Bragg
17731b3af1 material: Split the fragment processing backends out
This splits the fragment processing backends (glsl, arbfp and fixed) out
from cogl-material.c into their own cogl-material-{glsl,arbfp,fixed}.c
files in an effort to help and keep cogl-material.c maintainable.
2010-06-30 15:04:10 +01:00
Neil Roberts
b86e330957 cogl: Pull in the code for GLU tesselator from Mesa/SGI
This copies the files for the GLU tesselator from Mesa. The Mesa code
is based on the original SGI code and is released under a BSD license.

The memalloc.h header has been replaced with one that forces the code
to use g_malloc and friends. The rest of the files are not altered
from the original so it should be possible to later upgrade the files
by simply overwriting them.

There is a tesselator.h header which is expected to be included by
rest of Cogl to use the tesselator. This contains a trimmed down
version of glu.h that only includes parts that pertain to the
tesselator. There is also a stub glu.h in the GL directory which is
just provided so that the tesselator code can include <GL/gl.h>
without depending on the system header. It just redirects to
tesselator.h
2010-06-29 20:37:13 +01:00
Neil Roberts
e33a94bff4 cogl: Remove cogl-defines.h.in from the driver make files
Commit 7fae8ac051 changed cogl-defines.h.in so there is only a
single copy in clutter/cogl/ instead of one for each driver. However
the old files were still mentioned in the EXTRA_DIST of the
Makefile.am so make distcheck was failing.
2010-06-23 17:44:09 +01:00
Neil Roberts
8458fb7e20 Add a CoglTexturePixmapX11 texture backend
This is a publicly exposed texture backend to create a texture which
contains the contents of an X11 pixmap. The API is currently marked as
experimental.

The backend internally holds a handle to another texture. All of the
backend virtuals simply redirect to the internal texture.

The texture can optionally be automatically updated if the
automatic_updates parameter is TRUE. If set then Cogl will listen for
damage events on the pixmap and update the texture accordingly.
Alternatively a damage object can be created externally and passed
down to Cogl.

The updates can be performed with XGetImage, XShmGetImage or the
GLX_EXT_texture_pixmap extension. If the TFP extension is used it will
optionally try to create a rectangle texture if the driver does not
support NPOTs or it is forced through the
COGL_PIXMAP_TEXTURE_RECTANGLE or CLUTTER_PIXMAP_TEXTURE_RECTANGLE
environment variables.

If the GLXFBConfig does not support mipmapping then it will fallback
to using X{Shm,}GetImage. It keeps a separate texture around for this
so that it can later start using the TFP texture again if the texture
is later drawn with mipmaps disabled.
2010-06-22 12:22:48 +01:00
Neil Roberts
9c62265939 Add -DCOGL_ENABLE_EXPERIMENTAL_API to Makefiles for Cogl and x11/glx
Cogl and Clutter should be able to use the experimental API so this
adds the required define to the CPPFLAGS in the Makefiles.
2010-06-22 12:22:47 +01:00
Neil Roberts
9d0962098f cogl-defines.h: Add a COGL_HAS_X11 define
This will be defined in cogl-defines.h whenever Cogl is built using a
winsys that supports X11. This implies CoglTexturePixmapX11 will be
available.

To make this work the two separate cogl-defines.h.in files have been
merged into one. The configure script now makes a @COGL_DEFINES@
substitution variable which contains the #define lines to put in
rather than directly having them in the seperate files.
2010-06-22 12:22:47 +01:00
Neil Roberts
31b5beb2c0 cogl: Add the infrastructure for checking for winsys extensions
This adds the framework needed to check for winsys specific extensions
(such as GLX extensions) using a similar mechanism to the
cogl-feature-functions header. There is a separate
cogl-winsys-feature-functions header which will contain macros to list
the extensions and functions. cogl_create_context_winsys now calls
_cogl_feature_check for each of these functions. _cogl_feature_check
has had to be changed to accept the driver prefix as the first
parameter so that it can prepend "GLX" rather than "GL" in this case.
2010-06-22 12:22:43 +01:00
Neil Roberts
9646e85ba7 Pass all Xlib events through Cogl
The Clutter X11 backend now passes all events through
_cogl_xlib_handle_event. This function can now internally be hooked
with _cogl_xlib_add_filter. These are added to a list of callbacks
which are all called in turn by _cogl_xlib_handle_event. This is
intended to be used internally in Cogl by any parts that need to see
Xlib events.

Cogl now also has an internally exposed function to set a pointer to
the Xlib display. This is stored in a global variable. The Clutter X11
backend sets this.

_cogl_xlib_handle_event and _cogl_xlib_set_display can be removed once
Cogl gains a proper window system abstraction.
2010-06-22 12:20:59 +01:00
Neil Roberts
2e5b4a5b81 cogl: Add a struct for winsys-specific data to CoglContext
This creates a separate struct to store the fields of the context that
are specific to the winsys. This is all stored in one file but ideally
this could work more like the CoglContextDriver struct and have a
different header for each winsys.
2010-06-22 11:47:33 +01:00
Neil Roberts
9a1aa08fda cogl: Add an internal CoglTextureRectangle backend
This adds an internal rectangle texture backend which is mostly based
on the CoglTexture2D backend. It will throw assert failures if any
operations are attempted that rectangle textures don't support, such
as mipmapping or hardware repeating.
2010-06-22 11:47:33 +01:00
Robert Bragg
c8aae9a663 egl: Consolidates eglx and eglnative into one "egl" winsys
This remove quite a lot of redundant code by consolidating the eglx and
eglnative window system backends.
2010-06-18 17:38:41 +01:00
Richard Hughes
7cd5908ef0 build: Fix a compiler warning when using make dist
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-16 10:43:55 +01:00
Damien Lespiau
7fa011b037 build: Don't distribute clutter-version.h and cogl-defines.h
As with a351ff2af earlier, distributing headers generated at configure
time conflicts with out of tree builds as the distributed headers will
be included first instead of including the generated ones.
2010-06-04 17:43:57 +01:00
Robert Bragg
5af3ead3a2 CoglObject: Adds cogl_object_{get,set}_user_data
This provides a mechanism for associating private data with any
CoglObject. We expect Clutter will use this to associate weak materials
with normal materials.
2010-06-04 14:44:15 +01:00
Damien Lespiau
63eeaa86ea build: Distribute cogl-object.h
cogl-object.h is a new public header. Include it in the right list of
source files to have it distributed.
2010-06-03 11:41:03 +01:00
Neil Roberts
4fb784d111 cogl: Add an internal CoglBitmask type
This implements a growable array of bits called CoglBitmask. The
CoglBitmask is intended to be cheap if less than 32 bits are used. If
more bits are required it will allocate a GArray. The type is meant to
be allocated on the stack but because it can require additional
resources it also has a destroy function.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Robert Bragg
fa22ee0e8d math: Adds an experimental cogl_vector3_* API
This adds a math utility API for handling 3 component, single precision
float vectors with the following; mostly self explanatory functions:

cogl_vector3_init
cogl_vector3_init_zero
cogl_vector3_equal
cogl_vector3_equal_with_epsilon
cogl_vector3_copy
cogl_vector3_free
cogl_vector3_invert
cogl_vector3_add
cogl_vector3_subtract
cogl_vector3_multiply_scalar
cogl_vector3_divide_scalar
cogl_vector3_normalize
cogl_vector3_magnitude
cogl_vector3_cross_product
cogl_vector3_dot_product
cogl_vector3_distance

Since the API is experimental you will need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h if you want to use
the API.
2010-05-20 17:18:24 +01:00
Robert Bragg
76d5a1a858 Stubs out _cogl_xlib_handle_event
This stubs out an xlib event handling mechanism for Cogl. The intention
is for Clutter to use this to forward all x11 events to Cogl. As we move
winsys functionality down into Cogl, Cogl will become responsible for
handling a number of X events: ConfigureNotify events for onscreen
framebuffers, swap events and Damage events for cogl_x11_texture_pixmap.
2010-05-19 15:28:04 +01:00
Robert Bragg
1ed1d4fc6a build: expose automake conditionals for cogl winsys
Expose the ./configured window system/backend options to the Cogl
automake files via some new SUPPORT_XYZ conditionals.
2010-05-19 15:08:14 +01:00
Neil Roberts
f6f375cb36 Separate out CoglClipStackState from cogl-clip-stack.c
CoglClipStackState has now been renamed to CoglClipState and is moved
to a separate file. CoglClipStack now just maintains a stack and
doesn't worry about the rest of the state. CoglClipStack sill contains
the code to flush the stack to GL.
2010-04-15 14:51:00 +01:00
Neil Roberts
067a520f26 cogl: Support retained paths
This adds three new API calls:

  CoglHandle cogl_path_get()
  void cogl_path_set(CoglHandle path)
  CoglHandle cogl_path_copy(CoglHandle path)

All of the fields relating to the path have been moved from the Cogl
context to a new CoglPath handle type. The cogl context now just
contains a CoglPath handle. All of the existing path commands
manipulate the data in the current path handle. cogl_path_new now just
creates a new path handle and unrefs the old one.

The path handle can be stored for later with cogl_path_get. The path
can then be copied with cogl_path_copy. Internally it implements
copy-on-write semantics with an extra optimisation that it will only
copy the data if the new path is modified, but not if the original
path is modified. It can do this because the only way to modify a path
is by appending to it so the copied path is able to store its own path
length and only render the nodes up to that length. For this to work
the copied path also needs to keep its own copies of the path extents
because the parent path may change these by adding nodes.

The clip stack now uses the cogl_path_copy mechanism to store paths in
the stack instead of directly copying the data. This should save some
memory and processing time.
2010-04-08 19:53:38 +01:00
Robert Bragg
7d9b733446 cogl: cleanly separate primitives + paths code
The function prototypes for the primitives API were spread between
cogl-path.h and cogl-texture.h and should have been in a
cogl-primitives.h.

As well as shuffling the prototypes around into more sensible places
this commit splits the cogl-path API out from cogl-primitives.c into
a cogl-path.c
2010-02-12 14:05:01 +00:00
Damien Lespiau
47cc5a4e43 cogl-pixel-buffer: add a pixel buffer object class
This subclass of CoglBuffer aims at wrapping PBOs or other system
surfaces like DRM buffer objects. Two constructors are available:

cogl_pixel_buffer_new() with a size when you only care about the size of
the buffer (such a buffer can be used to store several texture data such
as the three planes of a I420 frame).

cogl_pixel_buffer_new_full() is more a 1:1 mapping between the data and
an underlying surface, with the possibility of having access to a low
level memory buffer that may have a stride.
2010-02-08 17:14:49 +00:00
Damien Lespiau
40b73a8c0c cogl-buffer: add an abstract class around openGL's buffer objects
Buffer objects are cool! This abstracts the buffer API first introduced
by GL_ARB_vertex_buffer_object and then extended to other objects.

The coglBuffer abstract class is intended to be the base class of all
the buffer objects, letting the user map() buffers. If the underlying
implementation does not support buffer objects (or only support VBO but
not FBO for instance), fallback paths should be provided.
2010-02-08 17:14:49 +00:00
Neil Roberts
f5d809f1e8 Merge branch 'master' into more-texture-backends 2010-01-15 12:15:46 +00:00
Emmanuele Bassi
deecf83c4a build: Clean up COGL build flags 2010-01-13 17:15:06 +00:00