1
0
Fork 0
Commit graph

12 commits

Author SHA1 Message Date
Robert Bragg
0bce7eac53 Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.

Currently this is the structure I'm aiming for:
cogl/
    cogl/
	<put common source here>
	winsys/
	   cogl-glx.c
	   cogl-wgl.c
	driver/
	    gl/
	    gles/
	os/ ?
    utils/
	cogl-fixed
	cogl-matrix-stack?
        cogl-journal?
        cogl-primitives?
    pango/

The new winsys component is a starting point for migrating window system
code (i.e.  x11,glx,wgl,osx,egl etc) from Clutter to Cogl.

The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.

Overview of the planned structure:

* The winsys/ API is the API that binds OpenGL to a specific window system,
  be that X11 or win32 etc.  Example are glx, wgl and egl. Much of the logic
  under clutter/{glx,osx,win32 etc} should migrate here.

* Note there is also the idea of a winsys-base that may represent a window
  system for which there are multiple winsys APIs.  An example of this is
  x11, since glx and egl may both be used with x11.  (currently only Clutter
  has the idea of a winsys-base)

* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
  representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
  GLES 1.1 (fixed funciton) and 2.0 (fully shader based)

* Everything under cogl/ should fundamentally be supporting access to the
  GPU.  Essentially Cogl's most basic requirement is to provide a nice GPU
  Graphics API and drawing a line between this and the utility functionality
  we add to support Clutter should help keep this lean and maintainable.

* Code under utils/ as suggested builds on cogl/ adding more convenient
  APIs or mechanism to optimize special cases. Broadly speaking you can
  compare cogl/ to OpenGL and utils/ to GLU.

* clutter/pango will be moved to clutter/cogl/pango

How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"

Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps

As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
2009-10-16 18:58:50 +01:00
Robert Bragg
492f0e5d14 [material] Reduce the material API in preperation for releasing Clutter 1.0
There were a number of functions intended to support creating of new
primitives using materials, but at this point they aren't used outside of
Cogl so until someone has a usecase and we can get feedback on this
API, it's being removed before we release Clutter 1.0.
2009-05-28 02:43:34 +01:00
Emmanuele Bassi
2fdc7e6a1b [cogl] Move debugging to a configure-time switch
Currently, COGL depends on defining debug symbols by manually
modifying the source code. When it's done, it will forcefully
print stuff to the console.

Since COGL has also a pretty, runtime selectable debugging API
we might as well switch everything to it.

In order for this to happen, configure needs a new:

        --enable-cogl-debug

command line switch; this will enable COGL debugging, the
CoglHandle debugging and will also turn on the error checking
for each GL operation.

The default setting for the COGL debug defines is off, since
it slows down the GL operations; enabling it for a particular
debug build is trivial, though.
2009-05-19 16:00:18 +01:00
Emmanuele Bassi
cf4a49061a [cogl] Rework the debug messages
COGL has a debug message system like Clutter's own. In parallel,
it also uses a coupld of #defines. Spread around there are also
calls to printf() instead to the more correct g_log* wrappers.

This commit tries to unify and clean up the macros and the
debug message handling inside COGL to be more consistent.
2009-05-19 14:44:29 +01:00
Robert Bragg
7e9685294e [cogl] Updates all file headers and removes lots of trailing white space
Adds missing notices, and ensures all the notices are consistent. The Cogl
blurb also now reads:

 * Cogl
 *
 * An object oriented GL/GLES Abstraction/Utility Layer
2009-05-02 04:12:25 +01:00
Neil Roberts
458e6e0356 [cogl-handle] Fix the broken debug macros
The debug macros for tracking reference counting of CoglHandles had
some typos introduced in c3d9f0 which meant it failed to compile when
COGL_DEBUG is 1.
2009-04-06 12:44:15 +01:00
Robert Bragg
6a3588101b [cogl] cogl_is_*(): Don't dereference an invalid handle; just return FALSE
An invalid handle is implicitly not of any type.
2009-04-06 11:35:10 +01:00
Robert Bragg
ed272213f0 [cogl-handle] Optimize how we define cogl handles
The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.

This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.

Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.

Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.
2009-04-02 11:58:43 +01:00
Emmanuele Bassi
31e4ca5733 Fallout from cogl-material merge
When enabling the maintainer CFLAGS the compiler got very angry
at the code that has been merged.
2009-01-27 16:02:04 +00:00
Robert Bragg
509928cc76 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
Multitexturing allows blending multiple layers of texture data when texturing
some geometry. A common use is for pre-baked light maps which can give nice
lighting effects relativly cheaply. Another is for dot-3 bump mapping, and
another is applying alpha channel masks.

The dot-3 bump mapping would be really nice one day, but currently cogl doesn't
support lighting so that's not dealt with in this patch.

notable limitations:
- It can only texture rectangles a.t.m - and like cogl_texture_rectangle there
is no support for rotated texturing.
- Sliced textures are not supported. I think I've figured out how to handle
layers with different slice sizes at least for rectangular geometry, but I'm
not sure how complex it becomes once rotations are possible and texturing
arbitrary cogl_polygons.
- Except for this new API, cogl still doesn't know about more than one texture
unit, and so has no way of caching any enables related to other units. So that
things don't break it's currently necessary to disable anything to do with
additional units as soon as we are done with them which isn't ideal.
- No clutter API yet.
2008-12-22 16:35:51 +00:00
Emmanuele Bassi
76b5a93afa 2008-06-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug 982 - __COGL_GET_CONTEXT MS compiler issue (Haakon Sporsheim)

	* clutter/cogl/common/cogl-handle.h:
	* clutter/cogl/common/cogl-primitives.c: Remove C99-isms.

	* clutter/cogl/gl/cogl-fbo.c:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c: Ditto as above.

	* clutter/cogl/gles/cogl-fbo.c:
	* clutter/cogl/gles/cogl-primitives.c:
	* clutter/cogl/gles/cogl-texture.c: Ditto as above.
2008-06-23 11:01:30 +00:00
Neil Roberts
0e0890a2e9 Removed COGLhandle and changed shader and program functions to be
wrapped in reference-counted CoglHandles instead.

	* clutter/cogl/gl/cogl-shader.c: 
	* clutter/cogl/gl/cogl-shader.h: 
	* clutter/cogl/gl/cogl-program.c: 
	* clutter/cogl/gl/cogl-program.h: 
	New files to hold the shader and program functions.

	* clutter/cogl/gl/cogl.c: Removed shader and program functions.

	* clutter/cogl/common/cogl-handle.h: New header to define
	COGL_HANDLE_DEFINE which helps build functions to create
	reference-counted handles. This reduces the amount of duplicated
	code.

	* clutter/cogl/gl/cogl-texture.c: 
	* clutter/cogl/gles/cogl-texture.c: 
	* clutter/cogl/gl/cogl-fbo.c: Converted to use COGL_HANDLE_DEFINE
	from cogl-handle.h to avoid duplicating some of the common code.

	* clutter/cogl/gles/cogl-defines.h.in: 
	* clutter/cogl/gl/cogl-defines.h.in: Removed COGLhandle

	* clutter/cogl/gl/cogl-context.h: Added handle arrays for programs
	and shaders.

	* clutter/cogl/gl/cogl-context.c (cogl_create_context): Added
	initialisers for shader_handles and program_handles.
	(cogl_destroy_context): Added calls to g_array_free for all handle
	arrays.

	* clutter/cogl/gl/Makefile.am (libclutter_cogl_la_SOURCES): Added
	cogl-{program,shader}.{c,h}

	* clutter/cogl/common/Makefile.am
	(libclutter_cogl_common_la_SOURCES): Added cogl-handle.h

	* clutter/cogl/gles/cogl.c:
	* clutter/cogl/cogl.h.in: Programs and shaders are now wrapped in
	CoglHandles instead of COGLhandles. cogl_program_destroy and
	cogl_shader_destroy is now replaced with cogl_program_unref and
	cogl_shader_unref. cogl_program_ref and cogl_shader_ref are also
	added.

	* clutter/clutter-shader.c: Converted to use CoglHandles for the
	programs and shaders instead of COGLhandles.

	* cogl/cogl-sections.txt: Added cogl_shader_ref,
	cogl_shader_unref, cogl_is_shader, cogl_program_ref,
	cogl_program_unref, cogl_is_program and cogl_is_offscreen.
2008-04-29 16:10:37 +00:00