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.
This commit is contained in:
Robert Bragg 2009-07-28 02:02:02 +01:00
parent b85af722f4
commit 0bce7eac53
99 changed files with 687 additions and 324 deletions

View File

@ -1,88 +1 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent SUBDIRS = cogl
NULL =
SUBDIRS = common $(CLUTTER_COGL)
BUILT_SOURCES = cogl.h
EXTRA_DIST = cogl.h.in cogl.pc.in
DIST_SUBDIRS = common gl gles
pc_files = \
cogl-$(CLUTTER_COGL)-$(CLUTTER_API_VERSION).pc \
cogl-$(CLUTTER_API_VERSION).pc
cogl-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
cogl-$(CLUTTER_COGL)-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
CLEANFILES = $(pc_files)
AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS)
# COGL installed headers
cogl_headers = \
$(top_srcdir)/clutter/cogl/cogl-bitmap.h \
$(top_srcdir)/clutter/cogl/cogl-color.h \
$(top_srcdir)/clutter/cogl/cogl-debug.h \
$(top_srcdir)/clutter/cogl/cogl-deprecated.h \
$(top_srcdir)/clutter/cogl/cogl-fixed.h \
$(top_srcdir)/clutter/cogl/cogl-material.h \
$(top_srcdir)/clutter/cogl/cogl-matrix.h \
$(top_srcdir)/clutter/cogl/cogl-offscreen.h \
$(top_srcdir)/clutter/cogl/cogl-path.h \
$(top_srcdir)/clutter/cogl/cogl-shader.h \
$(top_srcdir)/clutter/cogl/cogl-texture.h \
$(top_srcdir)/clutter/cogl/cogl-types.h \
$(top_srcdir)/clutter/cogl/cogl-vertex-buffer.h \
$(top_builddir)/clutter/cogl/cogl-defines-@CLUTTER_COGL@.h \
$(top_builddir)/clutter/cogl/cogl-enum-types.h \
$(top_builddir)/clutter/cogl/cogl.h \
$(NULL)
# this is copied in from common/ to make cogl.h work, but we
# need to clean it up ourselves once we're done
DISTCLEANFILES = cogl-enum-types.h
# HACK - gobject-introspection can't scan a library in another directory
# so we create a libclutter-cogl.la that's just identical to the one
# in the subdir
noinst_LTLIBRARIES = libclutter-cogl.la
libclutter_cogl_la_LIBADD = $(CLUTTER_COGL)/libclutter-cogl-$(CLUTTER_COGL).la
libclutter_cogl_la_SOURCES = $(cogl_headers)
coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
coglinclude_HEADERS = $(cogl_headers)
if HAVE_INTROSPECTION
Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
-I$(top_srcdir)/clutter/cogl \
-I$(top_srcdir)/clutter/cogl/common \
-I$(top_srcdir)/clutter/cogl/@CLUTTER_COGL@ \
-I$(top_builddir)/clutter \
-DCLUTTER_COMPILATION \
--c-include='cogl/cogl.h' \
--include=GL-1.0 \
--include=GObject-2.0 \
--library=libclutter-cogl.la \
--libtool="$(top_builddir)/libtool" \
--pkg gobject-2.0 \
--output $@ \
$(cogl_headers)
BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
CLEANFILES += $(BUILT_GIRSOURCES)
endif

25
TODO
View File

@ -1,25 +0,0 @@
============================
Cogl overhaul related tasks:
============================
MISC
- implemenent a 1 to 1 mapping of COGL_FEATURE flags
into CLUTTER_FEATURE flags before combining them
into final clutter flags value (clutter-feature.c)
TEXTURE
- cogl_texture_get_data, cogl_texture_set_region in GLES
- YUV texture format support (multitexturing + shader)
FBO
- add stencil, depth and other renderbuffers to fbos
- cogl_offscreen_new_multisample
- test cogl_offscreen_blit
- add "filter" argument to cogl_offscreen_blit

View File

@ -1,15 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
apiversion=@CLUTTER_API_VERSION@
requires=@CLUTTER_REQUIRES@
backend=@clutterbackend@
cogl=@CLUTTER_COGL@
Name: COGL
Description: Clutter GL abstraction library (${cogl} backend)
Version: @VERSION@
Libs: -L${libdir} -lclutter-${backend}-${apiversion}
Cflags: -I${includedir}/clutter-${apiversion}
Requires: ${requires}

161
cogl/Makefile.am Normal file
View File

@ -0,0 +1,161 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
SUBDIRS = winsys driver
BUILT_SOURCES = cogl.h
EXTRA_DIST = cogl.h.in cogl.pc.in
pc_files = \
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc \
cogl-$(CLUTTER_API_VERSION).pc
cogl-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
CLEANFILES = $(pc_files)
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/.. \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/$(COGL_DRIVER) \
-I. \
-I.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Core\" \
-DCLUTTER_COMPILATION
cogl_public_h = \
$(srcdir)/cogl-bitmap.h \
$(srcdir)/cogl-color.h \
$(srcdir)/cogl-debug.h \
$(srcdir)/cogl-fixed.h \
$(srcdir)/cogl-material.h \
$(srcdir)/cogl-matrix.h \
$(srcdir)/cogl-offscreen.h \
$(srcdir)/cogl-path.h \
$(srcdir)/cogl-shader.h \
$(srcdir)/cogl-texture.h \
$(srcdir)/cogl-types.h \
$(srcdir)/cogl-vertex-buffer.h \
cogl.h \
$(NULL)
cogl-enum-types.h: stamp-cogl-enum-types.h
@true
stamp-cogl-enum-types.h: $(cogl_public_h) Makefile
$(QUIET_GEN)( $(GLIB_MKENUMS) \
--template $(srcdir)/cogl-enum-types.h.in \
$(cogl_public_h) ) > xgen-ceth \
&& (cmp -s xgen-ceth cogl-enum-types.h || cp -f xgen-ceth cogl-enum-types.h) \
&& rm -f xgen-ceth \
&& echo timestamp > $(@F)
cogl-enum-types.c: cogl-enum-types.h
$(QUIET_GEN)( $(GLIB_MKENUMS) \
--template $(srcdir)/cogl-enum-types.c.in \
$(cogl_public_h) ) > xgen-cetc \
&& cp -f xgen-cetc cogl-enum-types.c \
&& rm -f xgen-cetc
BUILT_SOURCES += cogl-enum-types.h cogl-enum-types.c
noinst_LTLIBRARIES = libclutter-cogl.la
libclutter_cogl_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_la_LIBADD = \
-lm $(CLUTTER_LIBS) \
winsys/libclutter-cogl-winsys.la \
driver/$(COGL_DRIVER)/libclutter-cogl-driver.la
# os/$(COGL_DRIVER)/libclutter-cogl-os.la
libclutter_cogl_la_SOURCES = \
cogl-enum-types.h \
cogl-enum-types.c \
cogl-handle.h \
cogl-context.h \
cogl-context.c \
cogl-internal.h \
cogl.c \
cogl-util.h \
cogl-util.c \
cogl-bitmap-private.h \
cogl-bitmap.c \
cogl-bitmap-fallback.c \
cogl-current-matrix.c \
cogl-current-matrix.h \
cogl-primitives.h \
cogl-primitives.c \
cogl-bitmap-pixbuf.c \
cogl-clip-stack.h \
cogl-clip-stack.c \
cogl-fixed.c \
cogl-color.c \
cogl-vertex-buffer-private.h \
cogl-vertex-buffer.c \
cogl-matrix.c \
cogl-matrix-stack.c \
cogl-matrix-stack.h \
cogl-material.c \
cogl-material-private.h \
cogl-blend-string.c \
cogl-blend-string.h \
cogl-debug.c \
cogl-texture-private.h \
cogl-texture-driver.h \
cogl-texture.c \
$(NULL)
EXTRA_DIST += stb_image.c cogl-enum-types.h.in cogl-enum-types.c.in
CLEANFILES += stamp-cogl-enum-types.h
DISTCLEANFILES = cogl-enum-types.h cogl-enum-types.c
# COGL installed headers
cogl_headers = \
$(cogl_public_h) \
cogl-deprecated.h \
cogl-defines-@COGL_DRIVER@.h \
cogl-enum-types.h \
$(NULL)
coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
coglinclude_HEADERS = $(cogl_headers)
if HAVE_INTROSPECTION
Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
-I$(srcdir) \
-I$(srcdir)/.. \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/@COGL_DRIVER@ \
-DCLUTTER_COMPILATION \
--c-include='cogl/cogl.h' \
--include=GL-1.0 \
--include=GObject-2.0 \
--library=libclutter-cogl.la \
--libtool="$(top_builddir)/libtool" \
--pkg gobject-2.0 \
--output $@ \
$(cogl_headers)
BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
CLEANFILES += $(BUILT_GIRSOURCES)
endif

View File

@ -27,7 +27,8 @@
#ifndef __COGL_MATRIX_STACK_H #ifndef __COGL_MATRIX_STACK_H
#define __COGL_MATRIX_STACK_H #define __COGL_MATRIX_STACK_H
#include <cogl/cogl-matrix.h> #include "cogl-matrix.h"
#include "cogl.h" /* needed for GLenum */
typedef struct _CoglMatrixStack CoglMatrixStack; typedef struct _CoglMatrixStack CoglMatrixStack;

View File

@ -37,8 +37,8 @@ struct _floatVec2
struct _CoglPathNode struct _CoglPathNode
{ {
GLfloat x; float x;
GLfloat y; float y;
guint path_size; guint path_size;
}; };

View File

@ -30,19 +30,14 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <gmodule.h>
#ifdef HAVE_CLUTTER_GLX
#include <dlfcn.h>
#include <GL/glx.h>
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
#endif
#include "cogl-debug.h" #include "cogl-debug.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-util.h" #include "cogl-util.h"
#include "cogl-context.h" #include "cogl-context.h"
#include "cogl-material-private.h" #include "cogl-material-private.h"
#include "cogl-winsys.h"
#if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GLES) #if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GLES)
#include "cogl-gles2-wrapper.h" #include "cogl-gles2-wrapper.h"
@ -88,6 +83,32 @@ cogl_gl_error_to_string (GLenum error_code)
} }
#endif /* COGL_GL_DEBUG */ #endif /* COGL_GL_DEBUG */
CoglFuncPtr
cogl_get_proc_address (const gchar* name)
{
void *address;
static GModule *module = NULL;
address = _cogl_winsys_get_proc_address (name);
if (address)
return address;
/* this should find the right function if the program is linked against a
* library providing it */
if (module == NULL)
module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
if (module)
{
gpointer symbol;
if (g_module_symbol (module, name, &symbol))
return symbol;
}
return NULL;
}
void void
cogl_clear (const CoglColor *color, gulong buffers) cogl_clear (const CoglColor *color, gulong buffers)
{ {

View File

@ -29,7 +29,7 @@
#define __COGL_H_INSIDE__ #define __COGL_H_INSIDE__
#include <cogl/cogl-defines-@CLUTTER_COGL@.h> #include <cogl/cogl-defines-@COGL_DRIVER@.h>
#include <cogl/cogl-vertex-buffer.h> #include <cogl/cogl-vertex-buffer.h>
#include <cogl/cogl-matrix.h> #include <cogl/cogl-matrix.h>

17
cogl/cogl.pc.in Normal file
View File

@ -0,0 +1,17 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
apiversion=@CLUTTER_API_VERSION@
requires=@CLUTTER_REQUIRES@
backend=@COGL_WINSYS@ #only kept for backward compatability
winsys=@COGL_WINSYS@
cogl=@COGL_DRIVER@ #only kept for backward compatability
driver=@COGL_DRIVER@
Name: COGL
Description: Clutter GL abstraction library (${winsys}/${driver} backend)
Version: @VERSION@
Libs: -L${libdir} -lclutter-${winsys}-${apiversion}
Cflags: -I${includedir}/clutter-${apiversion}
Requires: ${requires}

7
cogl/driver/Makefile.am Normal file
View File

@ -0,0 +1,7 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
SUBDIRS = $(COGL_DRIVER)
DIST_SUBDIRS = gl gles

View File

@ -0,0 +1,39 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/../.. \
-I$(srcdir)/../../.. \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/$(COGL_DRIVER) \
-I../.. \
-I../../.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Driver\" \
-DCLUTTER_COMPILATION
noinst_LTLIBRARIES = libclutter-cogl-driver.la
libclutter_cogl_driver_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_driver_la_SOURCES = \
cogl.c \
cogl-primitives.c \
cogl-texture-driver.c \
cogl-fbo.h \
cogl-fbo.c \
cogl-shader-private.h \
cogl-shader.c \
cogl-program.h \
cogl-program.c \
cogl-context-driver.h \
cogl-context-driver.c \
$(NULL)
EXTRA_DIST = cogl-defines.h.in

View File

@ -26,84 +26,12 @@
#endif #endif
#include <string.h> #include <string.h>
#include <gmodule.h>
#include "cogl.h" #include "cogl.h"
#ifdef HAVE_CLUTTER_GLX
#include <dlfcn.h>
#include <GL/glx.h>
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
#endif
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-context.h" #include "cogl-context.h"
CoglFuncPtr
cogl_get_proc_address (const gchar* name)
{
/* Sucks to ifdef here but not other option..? would be nice to
* split the code up for more reuse (once more backends use this
*/
#if defined(HAVE_CLUTTER_GLX)
static GLXGetProcAddressProc get_proc_func = NULL;
static void *dlhand = NULL;
if (get_proc_func == NULL && dlhand == NULL)
{
dlhand = dlopen (NULL, RTLD_LAZY);
if (dlhand)
{
dlerror ();
get_proc_func =
(GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddress");
if (dlerror () != NULL)
{
get_proc_func =
(GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddressARB");
}
if (dlerror () != NULL)
{
get_proc_func = NULL;
g_warning ("failed to bind GLXGetProcAddress "
"or GLXGetProcAddressARB");
}
}
}
if (get_proc_func)
return get_proc_func ((unsigned char*) name);
#elif defined(HAVE_CLUTTER_WIN32)
return (CoglFuncPtr) wglGetProcAddress ((LPCSTR) name);
#else /* HAVE_CLUTTER_WIN32 */
/* this should find the right function if the program is linked against a
* library providing it */
static GModule *module = NULL;
if (module == NULL)
module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
if (module)
{
gpointer symbol;
if (g_module_symbol (module, name, &symbol))
return symbol;
}
#endif /* HAVE_CLUTTER_WIN32 */
return NULL;
}
gboolean gboolean
cogl_check_extension (const gchar *name, const gchar *ext) cogl_check_extension (const gchar *name, const gchar *ext)
{ {

View File

@ -0,0 +1,62 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/../.. \
-I$(srcdir)/../../.. \
-I$(srcdir)/winsys \
-I$(srcdir)/driver/$(COGL_DRIVER) \
-I../.. \
-I../../.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Driver\" \
-DCLUTTER_COMPILATION
noinst_LTLIBRARIES = libclutter-cogl-driver.la
libclutter_cogl_driver_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_driver_la_SOURCES = \
cogl-fbo.h \
cogl.c \
cogl-primitives.c \
cogl-texture-driver.c \
cogl-fbo.c \
cogl-context-driver.c \
cogl-gles2-wrapper.h \
cogl-program.h \
cogl-program.c \
cogl-shader-private.h \
cogl-shader.c
if USE_GLES2_WRAPPER
libclutter_cogl_driver_la_SOURCES += \
cogl-gles2-wrapper.c \
cogl-fixed-vertex-shader.h \
cogl-fixed-vertex-shader.c \
cogl-fixed-fragment-shader.h \
cogl-fixed-fragment-shader.c
endif
EXTRA_DIST = \
cogl-defines.h.in \
stringify.sh \
cogl-fixed-vertex-shader.glsl \
cogl-fixed-fragment-shader.glsl
BUILT_SOURCES = \
cogl-fixed-vertex-shader.h \
cogl-fixed-vertex-shader.c \
cogl-fixed-fragment-shader.h \
cogl-fixed-fragment-shader.c
%.h: $(srcdir)/%.glsl
/bin/sh $(srcdir)/stringify.sh -h $< > $@
%.c: $(srcdir)/%.glsl
/bin/sh $(srcdir)/stringify.sh $< > $@

View File

@ -31,17 +31,7 @@
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-context.h" #include "cogl-context.h"
CoglFuncPtr
cogl_get_proc_address (const gchar* name)
{
return NULL;
}
gboolean
cogl_check_extension (const gchar *name, const gchar *ext)
{
return FALSE;
}
void void
_cogl_features_init (void) _cogl_features_init (void)

43
cogl/winsys/Makefile.am Normal file
View File

@ -0,0 +1,43 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/.. \
-I$(srcdir)/../driver/$(COGL_DRIVER) \
-I$(srcdir)/../.. \
-I.. \
-I../.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Winsys\" \
-DCLUTTER_COMPILATION
noinst_LTLIBRARIES = libclutter-cogl-winsys.la
# Automake can't determine the full list if we are using autoconf substitutions
# to specify the files required for libclutter-cogl-winsys
all_winsys_sources = \
cogl-glx.c \
cogl-eglx.c \
cogl-eglnative.c \
cogl-sdl.c \
cogl-win32.c \
cogl-osx.c \
cogl-winsys.h
$(NULL)
libclutter_cogl_winsys_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_winsys_la_LIBADD = -lm $(CLUTTER_LIBS)
libclutter_cogl_winsys_la_SOURCES = \
cogl-@COGL_WINSYS@.h \
cogl-@COGL_WINSYS@.c \
$(NULL)
EXTRA_DIST=$(all_winsys_sources)

View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return NULL;
}

35
cogl/winsys/cogl-eglx.c Normal file
View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return NULL;
}

35
cogl/winsys/cogl-fruity.c Normal file
View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return NULL;
}

78
cogl/winsys/cogl-glx.c Normal file
View File

@ -0,0 +1,78 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
#ifdef HAVE_CLUTTER_GLX
#include <dlfcn.h>
#include <GL/glx.h>
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
#endif
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
static GLXGetProcAddressProc get_proc_func = NULL;
static void *dlhand = NULL;
if (get_proc_func == NULL && dlhand == NULL)
{
dlhand = dlopen (NULL, RTLD_LAZY);
if (!dlhand)
{
g_warning ("Failed to dlopen (NULL, RTDL_LAZY): %s", dlerror ());
return NULL;
}
dlerror ();
get_proc_func =
(GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddress");
if (dlerror () != NULL)
{
get_proc_func =
(GLXGetProcAddressProc) dlsym (dlhand, "glXGetProcAddressARB");
}
if (dlerror () != NULL)
{
get_proc_func = NULL;
g_warning ("failed to bind GLXGetProcAddress "
"or GLXGetProcAddressARB");
}
}
if (get_proc_func)
return get_proc_func ((GLubyte *) name);
return NULL;
}

35
cogl/winsys/cogl-osx.c Normal file
View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return NULL;
}

35
cogl/winsys/cogl-sdl.c Normal file
View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return NULL;
}

35
cogl/winsys/cogl-win32.c Normal file
View File

@ -0,0 +1,35 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl.h"
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name)
{
return (CoglFuncPtr) wglGetProcAddress ((LPCSTR) name);
}

30
cogl/winsys/cogl-winsys.h Normal file
View File

@ -0,0 +1,30 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __COGL_WINSYS_H
#define __COGL_WINSYS_H
CoglFuncPtr
_cogl_winsys_get_proc_address (const char *name);
#endif /* __COGL_WINSYS_H */

View File

@ -1,96 +0,0 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter \
-I$(top_srcdir)/clutter/cogl \
-I$(top_srcdir)/clutter/cogl/common \
-I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \
-I$(top_builddir)/clutter \
-I$(top_builddir)/clutter/cogl \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Common\" \
-DCLUTTER_COMPILATION
cogl_public_h = \
$(top_srcdir)/clutter/cogl/cogl-bitmap.h \
$(top_srcdir)/clutter/cogl/cogl-color.h \
$(top_srcdir)/clutter/cogl/cogl-debug.h \
$(top_srcdir)/clutter/cogl/cogl-fixed.h \
$(top_srcdir)/clutter/cogl/cogl-material.h \
$(top_srcdir)/clutter/cogl/cogl-matrix.h \
$(top_srcdir)/clutter/cogl/cogl-offscreen.h \
$(top_srcdir)/clutter/cogl/cogl-path.h \
$(top_srcdir)/clutter/cogl/cogl-shader.h \
$(top_srcdir)/clutter/cogl/cogl-texture.h \
$(top_srcdir)/clutter/cogl/cogl-types.h \
$(top_srcdir)/clutter/cogl/cogl-vertex-buffer.h \
$(top_builddir)/clutter/cogl/cogl.h \
$(NULL)
noinst_LTLIBRARIES = libclutter-cogl-common.la
cogl-enum-types.h: stamp-cogl-enum-types.h
@true
stamp-cogl-enum-types.h: $(cogl_public_h) Makefile
$(QUIET_GEN)( $(GLIB_MKENUMS) \
--template $(srcdir)/cogl-enum-types.h.in \
$(cogl_public_h) ) > xgen-ceth \
&& (cmp -s xgen-ceth cogl-enum-types.h || cp -f xgen-ceth cogl-enum-types.h) \
&& cp -f cogl-enum-types.h $(top_builddir)/clutter/cogl/cogl-enum-types.h \
&& rm -f xgen-ceth \
&& echo timestamp > $(@F)
cogl-enum-types.c: cogl-enum-types.h
$(QUIET_GEN)( $(GLIB_MKENUMS) \
--template $(srcdir)/cogl-enum-types.c.in \
$(cogl_public_h) ) > xgen-cetc \
&& cp -f xgen-cetc cogl-enum-types.c \
&& rm -f xgen-cetc
BUILT_SOURCES = cogl-enum-types.h cogl-enum-types.c
libclutter_cogl_common_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(COGL_DEBUG_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS)
libclutter_cogl_common_la_LIBADD = -lm $(CLUTTER_LIBS)
libclutter_cogl_common_la_SOURCES = \
$(top_builddir)/clutter/cogl/common/cogl-enum-types.h \
$(top_builddir)/clutter/cogl/common/cogl-enum-types.c \
cogl-handle.h \
cogl-context.h \
cogl-context.c \
cogl-internal.h \
cogl.c \
cogl-util.h \
cogl-util.c \
cogl-bitmap-private.h \
cogl-bitmap.c \
cogl-bitmap-fallback.c \
cogl-current-matrix.c \
cogl-current-matrix.h \
cogl-primitives.h \
cogl-primitives.c \
cogl-bitmap-pixbuf.c \
cogl-clip-stack.h \
cogl-clip-stack.c \
cogl-fixed.c \
cogl-color.c \
cogl-vertex-buffer-private.h \
cogl-vertex-buffer.c \
cogl-matrix.c \
cogl-matrix-stack.c \
cogl-matrix-stack.h \
cogl-material.c \
cogl-material-private.h \
cogl-blend-string.c \
cogl-blend-string.h \
cogl-debug.c \
cogl-texture-private.h \
cogl-texture-driver.h \
cogl-texture.c \
$(NULL)
EXTRA_DIST = stb_image.c cogl-enum-types.h.in cogl-enum-types.c.in
CLEANFILES = stamp-cogl-enum-types.h
DISTCLEANFILES = cogl-enum-types.h cogl-enum-types.c

View File

@ -18,7 +18,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
# gtk-doc will search all .c & .h files beneath here for inline comments # gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros. # documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk # e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../clutter/cogl DOC_SOURCE_DIR=../../../clutter/cogl/cogl
# Extra options to pass to gtkdoc-scangobj. Not normally needed. # Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=--type-init-func="g_type_init()" SCANGOBJ_OPTIONS=--type-init-func="g_type_init()"
@ -46,10 +46,9 @@ FIXXREF_OPTIONS=\
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=\ HFILE_GLOB=\
$(top_srcdir)/clutter/cogl/*.h \ $(top_srcdir)/clutter/cogl/cogl/*.h
$(top_srcdir)/clutter/cogl/common/*.h
CFILE_GLOB=\ CFILE_GLOB=\
$(top_srcdir)/clutter/cogl/common/*.c $(top_srcdir)/clutter/cogl/cogl/*.c
# Header files to ignore when scanning. # Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
@ -90,8 +89,8 @@ expand_content_files = \
# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter $(CLUTTER_CFLAGS) INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter -I$(top_srcdir)/clutter/cogl $(CLUTTER_CFLAGS)
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize. # This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make include $(top_srcdir)/gtk-doc.make