summaryrefslogtreecommitdiff
path: root/cogl/cogl.h
Commit message (Collapse)AuthorAgeFilesLines
* Clean up Since: and Stability: for frame-info additionsOwen W. Taylor2013-01-281-0/+1
| | | | | | Consistently use Since: 1.14 Stability: Unstable for CoglFrameInfo related additions, also guard cogl-output.h and cogl-frame-info.h with COGL_ENABLE_EXPERIMENTAL_API.
* renderer: expose CoglOutputsRobert Bragg2013-01-241-0/+1
| | | | | | | | This adds a cogl_renderer_foreach_output() function that can be used to iterate the display outputs for a particular renderer. This also updates cogl-info to use this new api so it can dump out all the output information.
* matrix-stack: make CoglMatrixStack publicRobert Bragg2013-01-221-0/+1
| | | | | | | | | | | | We have found several times now when writing code using Cogl that it would really help if Cogl's matrix stack api was public as a utility api. In Rig for example we want to avoid redundant arithmetic when deriving the matrices of entities used to render and we aren't able to simply use the framebuffer's matrix stack to achieve this. Also when implementing cairo-cogl we found that it would be really useful if we could have a matrix stack utility api. (cherry picked from commit d17a01fd935d88fab96fe6cc0b906c84026c0067)
* Fixes for --disable-glibNeil Roberts2013-01-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This fixes some problems which were stopping --disable-glib from working properly: • A lot of the public headers were including glib.h. This shouldn't be necessary because the API doesn't expose any glib types. Otherwise any apps would require glib in order to get the header. • The public headers were using G_BEGIN_DECLS. There is now a replacement macro called COGL_BEGIN_DECLS which is defined in cogl-types.h. • A similar fix has been done for G_GNUC_NULL_TERMINATED and G_GNUC_DEPRECATED. • The CFLAGS were not including $(builddir)/deps/glib which was preventing it finding the generated glibconfig.h when building out of tree. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 4138b3141c2f39cddaea3d72bfc04342ed5092d0)
* texture-2d: factor out all GL specific codeRobert Bragg2013-01-221-0/+1
| | | | | | | | | | | This factors out all of the OpenGL specific code in cogl-texture-2d.c into cogl-texture-2d-gl.c and where necessary adds indirection through the CoglDriver vtable so that we can eventually start to experiment with non-OpenGL backends for Cogl. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit ec57588671696bbe7ce714bdfe7324236146c9c0)
* Adds CoglError apiRobert Bragg2013-01-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although we use GLib internally in Cogl we would rather not leak GLib api through Cogl's own api, except through explicitly namespaced cogl_glib_ / cogl_gtype_ feature apis. One of the benefits we see to not leaking GLib through Cogl's public API is that documentation for Cogl won't need to first introduce the Glib API to newcomers, thus hopefully lowering the barrier to learning Cogl. This patch provides a Cogl specific typedef for reporting runtime errors which by no coincidence matches the typedef for GError exactly. If Cogl is built with --enable-glib (default) then developers can even safely assume that a CoglError is a GError under the hood. This patch also enforces a consistent policy for when NULL is passed as an error argument and an error is thrown. In this case we log the error and abort the application, instead of silently ignoring it. In common cases where nothing has been implemented to handle a particular error and/or where applications are just printing the error and aborting themselves then this saves some typing. This also seems more consistent with language based exceptions which usually cause a program to abort if they are not explicitly caught (which passing a non-NULL error signifies in this case) Since this policy for NULL error pointers is stricter than the standard GError convention, there is a clear note in the documentation to warn developers that are used to using the GError api. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit b068d5ea09ab32c37e8c965fc8582c85d1b2db46) Note: Since we can't change the Cogl 1.x api the patch was changed to not rename _error_quark() functions to be _error_domain() functions and although it's a bit ugly, instead of providing our own CoglError type that's compatible with GError we simply #define CoglError to GError unless Cogl is built with glib disabled. Note: this patch does technically introduce an API break since it drops the cogl_error_get_type() symbol generated by glib-mkenum (Since the CoglError enum was replaced by a CoglSystemError enum) but for now we are assuming that this will not affect anyone currently using the Cogl API. If this does turn out to be a problem in practice then we would be able to fix this my manually copying an implementation of cogl_error_get_type() generated by glib-mkenum into a compatibility source file and we could also define the original COGL_ERROR_ enums for compatibility too. Note: another minor concern with cherry-picking this patch to the 1.14 branch is that an api scanner would be lead to believe that some APIs have changed, and for example the gobject-introspection parser which understands the semantics of GError will not understand the semantics of CoglError. We expect most people that have tried to use gobject-introspection with Cogl already understand though that it is not well suited to generating bindings of the Cogl api anyway and we aren't aware or anyone depending on such bindings for apis involving GErrors. (GnomeShell only makes very-very minimal use of Cogl via the gjs bindings for the cogl_rectangle and cogl_color apis.) The main reason we have cherry-picked this patch to the 1.14 branch even given the above concerns is that without it it would become very awkward for us to cherry-pick other beneficial patches from master.
* Adds initial GLES2 integration supportRobert Bragg2012-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Add a cogl-version headerNeil Roberts2012-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a version header which contains macros to define which version of Cogl the application is being compiled against. This helps applications that want to support multiple incompatible versions of Cogl at compile time. The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but I think the former is nicer and it at least matches Cairo and Pango. The values of the macro are defined to COGL_VERSION_*_INTERNAL which is generated by the configure script into cogl-defines.h. There is also a macro for the entire version as a string called COGL_VERSION_STRING. The internal utility macros for encoding a 3 part version number into a single integer have been moved into the new header so they can be used publicly as a convenient way to check if the version is within a particular range. There is also a COGL_VERSION_CHECK macro for the very common case that a feature will be used since a particular version of Cogl. There is a macro called COGL_VERSION which contains the pre-encoded version of Cogl being compiled against for convenience. Unlike in Clutter this patch does not add any runtime version identification mechanism. A test case is also added which just contains static asserts to sanity check the macros. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
* Rework sdl integration apiRobert Bragg2012-04-121-0/+3
| | | | | | | | | This re-works the SDL integration api to simplify the integration for application developers and also allow Cogl to know when the application is about to go idle waiting for events so it can perform idle book-keeping work. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* kms: defer setting crtc modes until first swap buffersRobert Bragg2012-04-111-0/+1
| | | | | | | | | | | | | | Instead of creating a dummy framebuffer allocation just so we can setup crtc modes during display_setup we now wait until the first swap_buffers request before setting up the crtc modes. This patch also adds a cogl_kms_display_queue_modes_reset() function that allows developers to explicitly queue a reset of the crtc modes. The idea is that applications that handle VT switching can use this for VT enter events to explicitly ensure their mode is restored since modes are often not automatically restored correctly. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add a CoglPrimitiveTexture interfaceNeil Roberts2012-04-041-0/+1
| | | | | | | | | | | | | | | | | | | | | This interface represents any textures that are backed by a single texture in GL and that can be used directly with the cogl_framebuffer_draw_attributes family of functions. This currently equates to CoglTexture2D, CoglTexture3D and CoglTextureRectangle. The interface currently has only one method called cogl_primitive_set_auto_mipmap. This replaces the COGL_TEXTURE_NO_AUTO_MIPMAP flag from the CoglTextureFlags parameter in the constructors. None of the other flags in CoglTextureFlags make sense for primitive textures so it doesn't seem like a good idea to need them for primitive constructors. There is a boolean in the vtable to mark whether a texture type is primitive which the new cogl_is_primitive function uses. There is also a new texture virtual called set_auto_mipmap which is only required to be implemented for primitive textures. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Create standalone public wayland client/server headersRobert Bragg2012-03-201-3/+0
| | | | | | | | | | | Because the wayland-client-protocol.h header defines symbols that collide with the wayland-server-protocol.h header we allow applications to explicitly ensure that they are only including one at a time by exposing corresponding <cogl/cogl-wayland-client.h> and <cogl/cogl-wayland-server.h> headers. This also adds a missing guard to cogl-texture-2d.h that it isn't included directly. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add compatibility API for functions removed after 1.9.8Neil Roberts2012-03-091-0/+2
| | | | | | | | | | | | | | The cleanup in 185630085 removed some symbols that were previously exported as public experimental API in Cogl 1.9.8. That release is already well after the point where we were meant to freeze the ABI so we probably shouldn't be breaking it again. This patch adds the removed functions back in so that for 1.9.10 we won't have to bump the soname. The symbols are bundled together in a new file called cogl2-compatibility.c so that they will be easy to remove again after we can break ABI. It is expected that we will revert this patch immediately after branching for Cogl 1.10. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add -Wmissing-declarations to maintainer flags and fix problemsNeil Roberts2012-03-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This option to GCC makes it give a warning whenever a global function is defined without a declaration. This should catch cases were we've defined a function but forgot to put it in a header. In that case it is either only used within one file so we should make it static or we should declare it in a header. The following changes where made to fix problems: • Some functions were made static • cogl-path.h (the one containing the 1.0 API) was split into two files, one defining the functions and one defining the enums so that cogl-path.c can include the enum and function declarations from the 2.0 API as well as the function declarations from the 1.0 API. • cogl2-clip-state has been removed. This only had one experimental function called cogl_clip_push_from_path but as this is unstable we might as well remove it favour of the equivalent cogl_framebuffer_* API. • The GLX, SDL and WGL winsys's now have a private header to define their get_vtable function instead of directly declaring in the C file where it is called. • All places that were calling COGL_OBJECT_DEFINE need to have the cogl_is_whatever function declared so these have been added either as a public function or in a private header. • Some files that were not including the header containing their function declarations have been fixed to do so. • Any unused error quark functions have been removed. If we later want them we should add them back one by one and add a declaration for them in a header. • _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and made a public function with a declaration in cogl-framebuffer.h • Similarly for CoglOnscreen. • cogl_vdraw_indexed_attributes is called cogl_framebuffer_vdraw_indexed_attributes in the header. The definition has been changed to match the header. • cogl_index_buffer_allocate has been removed. This had no declaration and I'm not sure what it's supposed to do. • CoglJournal has been changed to use the internal CoglObject macro so that it won't define an exported cogl_is_journal symbol. • The _cogl_blah_pointer_from_handle functions have been removed. CoglHandle isn't used much anymore anyway and in the few places where it is used I think it's safe to just use the implicit cast from void* to the right type. • The test-utils.h header for the conformance tests explicitly disables the -Wmissing-declaration option using a pragma because all of the tests declare their main function without a header. Any mistakes relating to missing declarations aren't really important for the tests. • cogl_quaternion_init_from_quaternion and init_from_matrix have been given declarations in cogl-quaternion.h Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl.h: Exclude 1.x headers if 2.0 api requestedRobert Bragg2012-02-211-13/+31
| | | | | | | | | | | | | | | | | | Now if COGL_ENABLE_EXPERIMENTAL_2_0_API has been defined when including cogl.h then headers that correspond to 1.x only apis that we plan to drop won't be included any more. If COGL_ENABLE_EXPERIMENTAL_API is defined then you can still mix and match 2.0 api with 1.x api in a single compilation unit. Note: it's still possible that some 1.x symbols will still be available when COGL_ENABLE_EXPERIMENTAL_2_0_API is defined since this patch doesn't go through the shared headers adding guards around deprecated functions. This only affects people playing with the experimental api. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Move all types/prototypes from cogl.h -> cogl[1]-context.hRobert Bragg2012-02-201-1309/+1
| | | | | | | | | | | | So we can get to the point where cogl.h is merely an aggregation of header includes for the 1.x api this moves all the function prototypes and type definitions into a cogl-context.h and a new cogl1-context.h. Ideally no code internally should ever need to include cogl.h as it just represents the public facing header for accessing the 1.x api which should only be used by Clutter. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* kms: Adds api to get at the kms file descriptorRobert Bragg2012-02-081-0/+3
| | | | | | | | This adds a cogl_kms_renderer_get_kms_fd() function that lets developers access the kms file descriptor being used for controlling the kernel mode setting. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl.h: Remove _EXP symbol mangling and add gtk-docRobert Bragg2012-01-161-4/+0
| | | | | | | We are in the process of removing all _EXP suffix mangling for experimental APIs (Ref: c6528c4b6c3c34) and adding missing gtk-doc comments so that we can instead rely on the "Stability: unstable" markers in the gtk-doc comments. This patch tackles the cogl.h symbols.
* Add a feature ID for the swap event notificationNeil Roberts2012-01-091-1/+4
| | | | | | | | | Previously the swap event notification feature was only accessible as a winsys feature using the semi-internal cogl_clutter_winsys_has_feature. This just adds a feature ID for it so it can also be accessed via cogl_has_feature. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add a utility to make a GSource out of a CoglContextNeil Roberts2012-01-051-0/+3
| | | | | | | | | | | | | The GSource is created using cogl_glib_source_new which takes a pointer to a CoglContext. The source calls cogl_poll_get_info() in its prepare function and cogl_poll_dispatch() in its dispatch function. The poll FDs on the source are updated according to what Cogl reports. The header is only included and the source only compiled if Cogl is configured with GLib support. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add support for main loop integrationNeil Roberts2012-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds two new functions: void cogl_poll_get_info (CoglContext *context, CoglPollFD **poll_fds, int *n_poll_fds, gint64 *timeout); void cogl_poll_dispatch (CoglContext *context, const CoglPollFD *poll_fds, int n_poll_fds); The application is expected to call the first function whenever it is about to block to go idle, and the second function whenever it comes out of idle. This gives Cogl winsys's the ability poll file descriptors for events. For example when handing swap complete notifications, it can report that it needs to block on a file descriptor. The two functions are backed by winsys virtual functions. There are currently no implementations. The default handler for get_info just reports no file descriptors and an infinite timeout. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add a CoglSnippet typeNeil Roberts2011-12-061-0/+1
| | | | | | | | | | | | | | | | 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>
* docs: make cogl.h clip stack docs consistentRobert Bragg2011-12-061-2/+4
| | | | | | | | This updates some of the cogl.h cogl_clip_ API documentation to make it consistent with the documentation for corresponding framebuffer clip stack API in cogl-framebuffer.h Reviewed-by: Neil Roberts <neil@linux.intel.com>
* docs: make cogl.h matrix stack documentation consistentRobert Bragg2011-12-061-11/+21
| | | | | | | | This updates the cogl.h matrix stack documentation consistent with the corresponding documentation in cogl-framebuffer.h for the framebuffer matrix stack methods. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Remove inclusion of Xlib headers in Cogl headersZan Dobersek2011-11-011-4/+0
| | | | | | | | | | | 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>
* texture: Make CoglSubTexture experimental public apiRobert Bragg2011-11-011-0/+1
| | | | | | | | | | | | 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>
* texture: Make CoglTextureRectangle experimentally publicRobert Bragg2011-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* framebuffer: split out CoglOnscreen codeRobert Bragg2011-11-011-0/+1
| | | | | | | | | | 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>
* Adds support for a mirrored repeat wrap modeRobert Bragg2011-11-011-0/+3
| | | | | | | | | This adds COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT enum so that mirrored texture repeating can be used. This also adds support for emulating the MIRRORED_REPEAT mode via the cogl-spans API so it can also be used with meta textures such as sliced and atlas textures. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* meta-texture: This publicly exposes CoglMetaTextureRobert Bragg2011-11-011-0/+1
| | | | | | | | | | | | | | | | | 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>
* features: Support more than 32 features!Robert Bragg2011-11-011-0/+150
| | | | | | | | | | | | | | | | | | | | | | | | Currently features are represented as bits in a 32bit mask so we obviously can't have more than 32 features with that approach. The new approach is to use the COGL_FLAGS_ macros which lets us handle bitmasks without a size limit and we change the public api to accept individual feature enums instead of a mask. This way there is no limit on the number of features we can add to Cogl. Instead of using cogl_features_available() there is a new cogl_has_feature() function and for checking multiple features there is cogl_has_features() which takes a zero terminated vararg list of features. In addition to being able to check for individual features this also adds a way to query all the features currently available via cogl_foreach_feature() which will call a callback for each feature. Since the new functions take an explicit context pointer there is also no longer any ambiguity over when users can first start to query features. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture-2d-sliced: make CoglTexture2DSliced publicRobert Bragg2011-11-011-0/+1
| | | | | | | | 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>
* clip: Adds cogl_clip_push_primitive APIRobert Bragg2011-11-011-0/+38
| | | | | | | | | | | | This adds a new experimental function, cogl_clip_push_primitive, that allows you to push a CoglPrimitive onto the clip stack. The primitive should describe a flat 2D shape and the geometry shouldn't include any self intersections. When pushing a primitive you also need to tell Cogl what the bounding box of that shape is (in shape local coordinates) so that Cogl is able to efficiently update the required region of the stencil buffer. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add a strong CoglTexture type to replace CoglHandleRobert Bragg2011-09-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of the on going, incremental effort to purge the non type safe CoglHandle type from the Cogl API this patch tackles most of the CoglHandle uses relating to textures. We'd postponed making this change for quite a while because we wanted to have a clearer understanding of how we wanted to evolve the texture APIs towards Cogl 2.0 before exposing type safety here which would be difficult to change later since it would imply breaking APIs. The basic idea that we are steering towards now is that CoglTexture can be considered to be the most primitive interface we have for any object representing a texture. The texture interface would provide roughly these methods: cogl_texture_get_width cogl_texture_get_height cogl_texture_can_repeat cogl_texture_can_mipmap cogl_texture_generate_mipmap; cogl_texture_get_format cogl_texture_set_region cogl_texture_get_region Besides the texture interface we will then start to expose types corresponding to specific texture types: CoglTexture2D, CoglTexture3D, CoglTexture2DSliced, CoglSubTexture, CoglAtlasTexture and CoglTexturePixmapX11. We will then also expose an interface for the high-level texture types we have (such as CoglTexture2DSlice, CoglSubTexture and CoglAtlasTexture) called CoglMetaTexture. CoglMetaTexture is an additional interface that lets you iterate a virtual region of a meta texture and get mappings of primitive textures to sub-regions of that virtual region. Internally we already have this kind of abstraction for dealing with sliced texture, sub-textures and atlas textures in a consistent way, so this will just make that abstraction public. The aim here is to clarify that there is a difference between primitive textures (CoglTexture2D/3D) and some of the other high-level textures, and also enable developers to implement primitives that can support meta textures since they can only be used with the cogl_rectangle API currently. The thing that's not so clean-cut with this are the texture constructors we have currently; such as cogl_texture_new_from_file which no longer make sense when CoglTexture is considered to be an interface. These will basically just become convenient factory functions and it's just a bit unusual that they are within the cogl_texture namespace. It's worth noting here that all the texture type APIs will also have their own type specific constructors so these functions will only be used for the convenience of being able to create a texture without really wanting to know the details of what type of texture you need. Longer term for 2.0 we may come up with replacement names for these factory functions or the other thing we are considering is designing some asynchronous factory functions instead since it's so often detrimental to application performance to be blocked waiting for a texture to be uploaded to the GPU. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* pipeline: split out all layer state apisRobert Bragg2011-09-191-0/+1
| | | | | | | | | | | | 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>
* pipeline: split out all core state apisRobert Bragg2011-09-191-0/+1
| | | | | | | | | | | | | | | | 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>
* Include cogl-win32-renderer.h in cogl.h on WindowsChun-wei Fan2011-07-311-0/+3
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Fix testing of undefined macro constants to check for definedness insteadPhilip Withnall2011-07-271-1/+1
| | | | Reviewed-By: Robert Bragg <robert@linux.intel.com>
* framebuffer: Add _get_XYZ_bits() functionsRobert Bragg2011-07-041-52/+0
| | | | | | | | This exposes the previously internal only _cogl_framebuffer_get_red/green/blue/alpha_bits() functions as 2.0 experimental API. Signed-off-by: Neil Roberts <neil@linux.intel.com>
* Updates wayland symbol names to be consistentRobert Bragg2011-06-301-0/+3
| | | | | | | 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>
* work towards consistent platform file/symbol namingRobert Bragg2011-06-301-0/+1
| | | | | | | | | | | | | 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>
* Make CoglTexture2D public as experimental APIRobert Bragg2011-06-011-0/+1
| | | | | | | | | | | | | | | | | 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.
* Add CoglDepthState APIRobert Bragg2011-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
* Rename CoglIndexArray to CoglIndexBufferRobert Bragg2011-05-161-1/+1
| | | | | | | | | 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.
* Rename CoglPixelArray to CoglPixelBufferRobert Bragg2011-05-161-1/+1
| | | | | | | | | 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.
* Rename CoglVertexArray to CoglAttributeBufferRobert Bragg2011-05-161-1/+1
| | | | | | | | 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.
* math: Adds an experimental euler APIRobert Bragg2011-05-161-0/+1
| | | | | | | | | | | | | | | | 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
* math: Adds an experimental quaternion APIRobert Bragg2011-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* win32: Use the right macro name for COGL_HAS_WIN32_SUPPORTNeil Roberts2011-05-111-3/+0
| | | | | | | | | | | Some places were using COGL_HAS_WIN32 but the only macro defined is COGL_HAS_WIN32_SUPPORT. The similar macros such as COGL_HAS_XLIB are only defined for compatibility with existing code but COGL_HAS_WIN32 was never defined so there's no need to support it. One of the places was including the non-existant cogl-win32.h. This has been removed because the file only temporarily existed during development of the backend.
* Add a WGL winsysNeil Roberts2011-05-101-0/+3
| | | | This adds a full winsys to handle WGL and Win32.