Merge commit 'origin/master' into 1.0-integration
Conflicts: clutter/clutter-texture.c clutter/cogl/gl/cogl-fbo.c
This commit is contained in:
commit
b9cde2c6f4
50
Makefile.am
50
Makefile.am
@ -20,3 +20,53 @@ pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = $(pc_files)
|
||||
|
||||
CLEANFILES = $(pc_files)
|
||||
|
||||
AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS)
|
||||
|
||||
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-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
|
||||
|
||||
# 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.la
|
||||
libclutter_cogl_la_SOURCES = $(cogl_headers)
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) $(CLUTTER_COGL)/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 \
|
||||
--include=GL-1.0 \
|
||||
--include=GObject-2.0 \
|
||||
--library=clutter-cogl \
|
||||
--libtool="$(top_builddir)/doltlibtool" \
|
||||
--pkg gobject-2.0 \
|
||||
--output $@ \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-@CLUTTER_COGL@.h \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(cogl_headers)
|
||||
|
||||
BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir
|
||||
|
||||
girdir = $(datadir)/gir-1.0
|
||||
gir_DATA = $(BUILT_GIRSOURCES)
|
||||
|
||||
CLEANFILES += $(BUILT_GIRSOURCES)
|
||||
endif
|
||||
|
78
cogl-bitmap.h
Normal file
78
cogl-bitmap.h
Normal 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.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __COGL_BITMAP_H__
|
||||
#define __COGL_BITMAP_H__
|
||||
|
||||
#include <cogl/cogl-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-bitmap
|
||||
* @short_description: Fuctions for loading images but not directly
|
||||
* into textures
|
||||
*
|
||||
* Cogl allows loading image data into memory as CoglBitmaps without
|
||||
* loading them immediately into GPU textures.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* cogl_bitmap_new_from_file:
|
||||
* @filename: the file to load.
|
||||
* @error: a #GError or %NULL.
|
||||
*
|
||||
* Load an image file from disk. This function can be safely called from
|
||||
* within a thread.
|
||||
*
|
||||
* Returns: A CoglBitmap to the new loaded image data, or %NULL if loading
|
||||
* the image failed.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglHandle cogl_bitmap_new_from_file (const gchar *filename,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_bitmap_get_size_from_file:
|
||||
* @filename: the file to check
|
||||
* @width: return location for the bitmap width
|
||||
* @height: return location for the bitmap height
|
||||
*
|
||||
* Parses an image file enough to extract the width and height
|
||||
* of the bitmap.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean cogl_bitmap_get_size_from_file (const gchar *filename,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_BITMAP_H__ */
|
12
cogl-color.h
12
cogl-color.h
@ -1,7 +1,9 @@
|
||||
/* cogl-color.h: Color type for COGL
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
|
26
cogl-debug.h
26
cogl-debug.h
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* 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_DEBUG_H__
|
||||
#define __COGL_DEBUG_H__
|
||||
|
||||
@ -13,7 +36,8 @@ typedef enum {
|
||||
COGL_DEBUG_OFFSCREEN = 1 << 4,
|
||||
COGL_DEBUG_DRAW = 1 << 5,
|
||||
COGL_DEBUG_PANGO = 1 << 6,
|
||||
COGL_DEBUG_RECTANGLES = 1 << 7
|
||||
COGL_DEBUG_RECTANGLES = 1 << 7,
|
||||
COGL_DEBUG_HANDLE = 1 << 8
|
||||
} CoglDebugFlags;
|
||||
|
||||
#ifdef COGL_ENABLE_DEBUG
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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_DEPRECATED_H
|
||||
|
||||
#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color
|
||||
|
12
cogl-fixed.h
12
cogl-fixed.h
@ -1,7 +1,9 @@
|
||||
/* cogl-fixed.h: Fixed point API
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
@ -86,7 +109,7 @@ void cogl_material_set_color (CoglHandle material, const CoglColor *color);
|
||||
*
|
||||
* This is the basic color of the material, used when no lighting is enabled.
|
||||
*
|
||||
* The default value is (1.0, 1.0, 1.0, 1.0)
|
||||
* The default value is (0xff, 0xff, 0xff, 0xff)
|
||||
*
|
||||
* Since 1.0
|
||||
*/
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_MATRIX_H
|
||||
#define __COGL_MATRIX_H
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
/* cogl-offscreen.h: Offscreen objects
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
@ -33,41 +37,45 @@ G_BEGIN_DECLS
|
||||
* @short_description: Fuctions for creating and manipulating offscreen
|
||||
* frame buffer objects
|
||||
*
|
||||
* COGL allows creating and operating on FBOs (Framebuffer Objects).
|
||||
* Cogl allows creating and operating on offscreen render targets.
|
||||
*/
|
||||
|
||||
/* Offscreen api */
|
||||
|
||||
/**
|
||||
* cogl_offscreen_new_to_texture:
|
||||
* @texhandle:
|
||||
* @handle: A CoglHandle for a Cogl texture
|
||||
*
|
||||
* Returns:
|
||||
* This creates an offscreen buffer object using the given texture as the
|
||||
* primary color buffer. It doesn't just initialize the contents of the
|
||||
* offscreen buffer with the texture; they are tightly bound so that
|
||||
* drawing to the offscreen buffer effectivly updates the contents of the
|
||||
* given texture. You don't need to destroy the offscreen buffer before
|
||||
* you can use the texture again.
|
||||
*
|
||||
* Note: This does not work with sliced Cogl textures.
|
||||
*
|
||||
* Returns: a CoglHandle for the new offscreen buffer or COGL_INVALID_HANDLE
|
||||
* if it wasn't possible to create the buffer.
|
||||
*/
|
||||
CoglHandle cogl_offscreen_new_to_texture (CoglHandle texhandle);
|
||||
|
||||
/**
|
||||
* cogl_offscreen_new_multisample:
|
||||
*
|
||||
*
|
||||
* Returns:
|
||||
*/
|
||||
CoglHandle cogl_offscreen_new_multisample (void);
|
||||
|
||||
/**
|
||||
* cogl_offscreen_ref:
|
||||
* @handle:
|
||||
* @handle: A CoglHandle for an offscreen buffer
|
||||
*
|
||||
* Returns:
|
||||
* Increments the reference count on the offscreen buffer.
|
||||
*
|
||||
* Returns: For convenience it returns the given CoglHandle
|
||||
*/
|
||||
CoglHandle cogl_offscreen_ref (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_is_offscreen:
|
||||
* @handle: A CoglHandle
|
||||
* @handle: A CoglHandle for an offscreen buffer
|
||||
*
|
||||
* Gets whether the given handle references an existing offscreen
|
||||
* buffer object.
|
||||
* Gets whether the given handle references an existing offscreen buffer
|
||||
* object.
|
||||
*
|
||||
* Returns: %TRUE if the handle references an offscreen buffer,
|
||||
* %FALSE otherwise
|
||||
@ -76,54 +84,13 @@ gboolean cogl_is_offscreen (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_offscreen_unref:
|
||||
* @handle:
|
||||
* @handle: A CoglHandle for an offscreen buffer
|
||||
*
|
||||
* Decreases the reference count for the offscreen buffer and frees it when
|
||||
* the count reaches 0.
|
||||
*/
|
||||
void cogl_offscreen_unref (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_offscreen_blit:
|
||||
* @src_buffer:
|
||||
* @dst_buffer:
|
||||
*
|
||||
*/
|
||||
void cogl_offscreen_blit (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer);
|
||||
|
||||
/**
|
||||
* cogl_offscreen_blit_region:
|
||||
* @src_buffer:
|
||||
* @dst_buffer:
|
||||
* @src_x:
|
||||
* @src_y:
|
||||
* @src_w:
|
||||
* @src_h:
|
||||
* @dst_x:
|
||||
* @dst_y:
|
||||
* @dst_w:
|
||||
* @dst_h:
|
||||
*
|
||||
*/
|
||||
void cogl_offscreen_blit_region (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint src_w,
|
||||
gint src_h,
|
||||
gint dst_x,
|
||||
gint dst_y,
|
||||
gint dst_w,
|
||||
gint dst_h);
|
||||
|
||||
/**
|
||||
* cogl_draw_buffer:
|
||||
* @target:
|
||||
* @offscreen:
|
||||
*
|
||||
*/
|
||||
void cogl_draw_buffer (CoglBufferTarget target,
|
||||
CoglHandle offscreen);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_OFFSCREEN_H__ */
|
||||
|
12
cogl-path.h
12
cogl-path.h
@ -1,7 +1,9 @@
|
||||
/* cogl-path.h: Path primitives
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
|
@ -1,7 +1,9 @@
|
||||
/* cogl-shader.h: Shaders and programmable pipeline
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
@ -24,7 +28,7 @@
|
||||
#ifndef __COGL_SHADER_H__
|
||||
#define __COGL_SHADER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -38,6 +42,17 @@ G_BEGIN_DECLS
|
||||
* The only supported format is GLSL shaders.
|
||||
*/
|
||||
|
||||
/**
|
||||
* CoglShaderType:
|
||||
* @COGL_SHADER_TYPE_VERTEX: A program for proccessing vertices
|
||||
* @COGL_SHADER_TYPE_FRAGMENT: A program for processing fragments
|
||||
*/
|
||||
typedef enum _CoglShaderType
|
||||
{
|
||||
COGL_SHADER_TYPE_VERTEX,
|
||||
COGL_SHADER_TYPE_FRAGMENT
|
||||
} CoglShaderType;
|
||||
|
||||
/**
|
||||
* cogl_create_shader:
|
||||
* @shader_type: CGL_VERTEX_SHADER or CGL_FRAGMENT_SHADER.
|
||||
@ -47,7 +62,7 @@ G_BEGIN_DECLS
|
||||
*
|
||||
* Returns: a new shader handle.
|
||||
*/
|
||||
CoglHandle cogl_create_shader (COGLenum shader_type);
|
||||
CoglHandle cogl_create_shader (CoglShaderType shader_type);
|
||||
|
||||
/**
|
||||
* cogl_shader_ref:
|
||||
@ -88,7 +103,7 @@ gboolean cogl_is_shader (CoglHandle handle);
|
||||
* one.
|
||||
*/
|
||||
void cogl_shader_source (CoglHandle shader,
|
||||
const gchar *source);
|
||||
const char *source);
|
||||
/**
|
||||
* cogl_shader_compile:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
@ -110,21 +125,25 @@ void cogl_shader_compile (CoglHandle handle);
|
||||
* debugging purposes.
|
||||
*/
|
||||
void cogl_shader_get_info_log (CoglHandle handle,
|
||||
guint size,
|
||||
gchar *buffer);
|
||||
size_t size,
|
||||
char *buffer);
|
||||
|
||||
/**
|
||||
* cogl_shader_get_parameteriv:
|
||||
* cogl_shader_get_type:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
* @pname: the named COGL parameter to retrieve.
|
||||
* @dest: storage location for COGLint return value.
|
||||
*
|
||||
* Retrieve a named parameter from a shader can be used to query to compile
|
||||
* satus of a shader by passing in CGL_OBJECT_COMPILE_STATUS for @pname.
|
||||
* Returns: COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
|
||||
* or COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
|
||||
*/
|
||||
void cogl_shader_get_parameteriv (CoglHandle handle,
|
||||
COGLenum pname,
|
||||
COGLint *dest);
|
||||
CoglShaderType cogl_shader_get_type (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_shader_is_compiled:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
*
|
||||
* Returns: TRUE if the shader object has sucessfully be compiled else FALSE
|
||||
*/
|
||||
gboolean cogl_shader_is_compiled (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_create_program:
|
||||
@ -209,9 +228,9 @@ void cogl_program_use (CoglHandle handle);
|
||||
* This uniform can be set using cogl_program_uniform_1f() when the
|
||||
* program is in use.
|
||||
*/
|
||||
COGLint cogl_program_get_uniform_location
|
||||
int cogl_program_get_uniform_location
|
||||
(CoglHandle handle,
|
||||
const gchar *uniform_name);
|
||||
const char *uniform_name);
|
||||
|
||||
/**
|
||||
* cogl_program_uniform_1f:
|
||||
@ -221,8 +240,8 @@ COGLint cogl_program_get_uniform_location
|
||||
* Changes the value of a floating point uniform in the currently
|
||||
* used (see cogl_program_use()) shader program.
|
||||
*/
|
||||
void cogl_program_uniform_1f (COGLint uniform_no,
|
||||
gfloat value);
|
||||
void cogl_program_uniform_1f (int uniform_no,
|
||||
float value);
|
||||
|
||||
/**
|
||||
* cogl_program_uniform_1i:
|
||||
@ -232,8 +251,8 @@ void cogl_program_uniform_1f (COGLint uniform_no,
|
||||
* Changes the value of an integer uniform in the currently
|
||||
* used (see cogl_program_use()) shader program.
|
||||
*/
|
||||
void cogl_program_uniform_1i (COGLint uniform_no,
|
||||
gint value);
|
||||
void cogl_program_uniform_1i (int uniform_no,
|
||||
int value);
|
||||
|
||||
/**
|
||||
* cogl_program_uniform_float:
|
||||
@ -245,9 +264,9 @@ void cogl_program_uniform_1i (COGLint uniform_no,
|
||||
* Changes the value of a float vector uniform, or uniform array in the
|
||||
* currently used (see #cogl_program_use) shader program.
|
||||
*/
|
||||
void cogl_program_uniform_float (COGLint uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
void cogl_program_uniform_float (int uniform_no,
|
||||
int size,
|
||||
int count,
|
||||
const GLfloat *value);
|
||||
|
||||
/**
|
||||
@ -260,10 +279,10 @@ void cogl_program_uniform_float (COGLint uniform_no,
|
||||
* Changes the value of a int vector uniform, or uniform array in the
|
||||
* currently used (see cogl_program_use()) shader program.
|
||||
*/
|
||||
void cogl_program_uniform_int (COGLint uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const COGLint *value);
|
||||
void cogl_program_uniform_int (int uniform_no,
|
||||
int size,
|
||||
int count,
|
||||
const int *value);
|
||||
|
||||
/**
|
||||
* cogl_program_uniform_matrix:
|
||||
@ -277,11 +296,11 @@ void cogl_program_uniform_int (COGLint uniform_no,
|
||||
* currently used (see cogl_program_use()) shader program. The @size
|
||||
* parameter is used to determine the square size of the matrix.
|
||||
*/
|
||||
void cogl_program_uniform_matrix (COGLint uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
void cogl_program_uniform_matrix (int uniform_no,
|
||||
int size,
|
||||
int count,
|
||||
gboolean transpose,
|
||||
const GLfloat *value);
|
||||
const float *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
115
cogl-texture.h
115
cogl-texture.h
@ -1,7 +1,9 @@
|
||||
/* cogl-texture.h: Texture objects
|
||||
* This file is part of Clutter
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* 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
|
||||
@ -14,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
@ -24,10 +28,10 @@
|
||||
#ifndef __COGL_TEXTURE_H__
|
||||
#define __COGL_TEXTURE_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <cogl/cogl-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-texture
|
||||
* @short_description: Fuctions for creating and manipulating textures
|
||||
@ -142,21 +146,21 @@ CoglHandle cogl_texture_new_from_foreign (GLuint gl_handle,
|
||||
|
||||
/**
|
||||
* cogl_texture_new_from_bitmap:
|
||||
* @bitmap: a #CoglBitmap
|
||||
* @bmp_handle: A CoglBitmap handle
|
||||
* @max_waste: maximum extra horizontal and|or vertical margin pixels
|
||||
* to make the texture fit GPU limitations
|
||||
* @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
|
||||
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
|
||||
* texture
|
||||
*
|
||||
* Creates a COGL texture from a #CoglBitmap.
|
||||
* Creates a COGL texture from a CoglBitmap.
|
||||
*
|
||||
* Return value: a #CoglHandle to the newly created texture or
|
||||
* %COGL_INVALID_HANDLE on failure
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglHandle cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
||||
CoglHandle cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
||||
gint max_waste,
|
||||
CoglTextureFlags flags,
|
||||
CoglPixelFormat internal_format);
|
||||
@ -224,6 +228,52 @@ guint cogl_texture_get_rowstride (CoglHandle handle);
|
||||
*/
|
||||
gint cogl_texture_get_max_waste (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* CoglTextureFilter:
|
||||
* @COGL_TEXTURE_FILTER_NEAREST: Measuring in manhatten distance from the,
|
||||
* current pixel center, use the nearest texture
|
||||
* texel.
|
||||
* @COGL_TEXTURE_FILTER_LINEAR: Use the weighted average of the 4 texels
|
||||
* nearest the current pixel center.
|
||||
* @COGL_TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST: Select the mimap level whose
|
||||
* texel size most closely matches
|
||||
* the current pixel, and use the
|
||||
* COGL_TEXTURE_FILTER_NEAREST
|
||||
* criterion.
|
||||
* @COGL_TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST: Select the mimap level whose
|
||||
* texel size most closely matches
|
||||
* the current pixel, and use the
|
||||
* COGL_TEXTURE_FILTER_LINEAR
|
||||
* criterion.
|
||||
* @COGL_TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR: Select the two mimap levels
|
||||
* whose texel size most closely
|
||||
* matches the current pixel, use
|
||||
* the COGL_TEXTURE_FILTER_NEAREST
|
||||
* criterion on each one and take
|
||||
* their weighted average.
|
||||
* @COGL_TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR: Select the two mimap levels
|
||||
* whose texel size most closely
|
||||
* matches the current pixel, use
|
||||
* the COGL_TEXTURE_FILTER_LINEAR
|
||||
* criterion on each one and take
|
||||
* their weighted average.
|
||||
*
|
||||
* Texture filtering is used whenever the current pixel maps either to more
|
||||
* than one texture element (texel) or less than one. These filter enums
|
||||
* correspond to different strategies used to come up with a pixel color, by
|
||||
* possibly referring to multiple neighbouring texels and taking a weighted
|
||||
* average or simply using the nearest texel.
|
||||
*/
|
||||
typedef enum _CoglTextureFilter
|
||||
{
|
||||
COGL_TEXTURE_FILTER_NEAREST = GL_NEAREST,
|
||||
COGL_TEXTURE_FILTER_LINEAR = GL_LINEAR,
|
||||
COGL_TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST,
|
||||
COGL_TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST,
|
||||
COGL_TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR,
|
||||
COGL_TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR
|
||||
} CoglTextureFilter;
|
||||
|
||||
/**
|
||||
* cogl_texture_get_min_filter:
|
||||
* @handle: a #CoglHandle for a texture.
|
||||
@ -232,7 +282,7 @@ gint cogl_texture_get_max_waste (CoglHandle handle);
|
||||
*
|
||||
* Returns: the current downscaling filter for a cogl texture.
|
||||
*/
|
||||
COGLenum cogl_texture_get_min_filter (CoglHandle handle);
|
||||
CoglTextureFilter cogl_texture_get_min_filter (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_texture_get_mag_filter:
|
||||
@ -242,7 +292,7 @@ COGLenum cogl_texture_get_min_filter (CoglHandle handle);
|
||||
*
|
||||
* Returns: the current downscaling filter for a cogl texture.
|
||||
*/
|
||||
COGLenum cogl_texture_get_mag_filter (CoglHandle handle);
|
||||
CoglTextureFilter cogl_texture_get_mag_filter (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_texture_is_sliced:
|
||||
@ -303,8 +353,8 @@ gint cogl_texture_get_data (CoglHandle handle,
|
||||
* drawn at other scales than 100%.
|
||||
*/
|
||||
void cogl_texture_set_filters (CoglHandle handle,
|
||||
COGLenum min_filter,
|
||||
COGLenum mag_filter);
|
||||
CoglTextureFilter min_filter,
|
||||
CoglTextureFilter mag_filter);
|
||||
|
||||
|
||||
/**
|
||||
@ -359,45 +409,6 @@ CoglHandle cogl_texture_ref (CoglHandle handle);
|
||||
*/
|
||||
void cogl_texture_unref (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_bitmap_new_from_file:
|
||||
* @filename: the file to load.
|
||||
* @error: a #GError or %NULL.
|
||||
*
|
||||
* Load an image file from disk. This function can be safely called from
|
||||
* within a thread.
|
||||
*
|
||||
* Returns: A #CoglBitmap to the new loaded image data, or %NULL if loading
|
||||
* the image failed.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglBitmap * cogl_bitmap_new_from_file (const gchar *filename,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_bitmap_get_size_from_file:
|
||||
* @filename: the file to check
|
||||
* @width: return location for the bitmap width
|
||||
* @height: return location for the bitmap height
|
||||
*
|
||||
* Parses an image file enough to extract the width and height
|
||||
* of the bitmap.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean cogl_bitmap_get_size_from_file (const gchar *filename,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
/**
|
||||
* cogl_bitmap_free:
|
||||
* @bmp: a #CoglBitmap.
|
||||
*
|
||||
* Frees a #CoglBitmap.
|
||||
*/
|
||||
void cogl_bitmap_free (CoglBitmap *bmp);
|
||||
|
||||
/**
|
||||
* cogl_rectangle_with_texture_coords:
|
||||
* @x1: x coordinate upper left on screen.
|
||||
|
24
cogl-types.h
24
cogl-types.h
@ -1,13 +1,14 @@
|
||||
/* cogl-types.h: Shared COGL types
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* This file is part of Clutter
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
* Copyright (C) 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.1 of the License, or (at your option) any later version.
|
||||
* 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
|
||||
@ -15,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
@ -29,13 +32,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* CoglBitmap:
|
||||
*
|
||||
* Type used for storing image data.
|
||||
*/
|
||||
typedef struct _CoglBitmap CoglBitmap;
|
||||
|
||||
/**
|
||||
* CoglHandle:
|
||||
*
|
||||
@ -232,7 +228,6 @@ GType cogl_feature_flags_get_type (void) G_GNUC_CONST;
|
||||
/**
|
||||
* CoglBufferTarget:
|
||||
* @COGL_WINDOW_BUFFER: FIXME
|
||||
* @COGL_MASK_BUFFER: FIXME
|
||||
* @COGL_OFFSCREEN_BUFFER: FIXME
|
||||
*
|
||||
* Target flags for FBOs.
|
||||
@ -242,8 +237,7 @@ GType cogl_feature_flags_get_type (void) G_GNUC_CONST;
|
||||
typedef enum
|
||||
{
|
||||
COGL_WINDOW_BUFFER = (1 << 1),
|
||||
COGL_MASK_BUFFER = (1 << 2),
|
||||
COGL_OFFSCREEN_BUFFER = (1 << 3)
|
||||
COGL_OFFSCREEN_BUFFER = (1 << 2)
|
||||
} CoglBufferTarget;
|
||||
|
||||
#define COGL_TYPE_BUFFER_TARGET (cogl_buffer_target_get_type ())
|
||||
|
@ -1,13 +1,9 @@
|
||||
/*
|
||||
* Cogl.
|
||||
* Cogl
|
||||
*
|
||||
* An OpenGL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Vertex Buffer API: Handle extensible arrays of vertex attributes
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
*
|
||||
* Authored by: Robert Bragg <robert@linux.intel.com>
|
||||
* Copyright (C) 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
|
||||
@ -20,7 +16,12 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
|
81
cogl.h.in
81
cogl.h.in
@ -1,13 +1,12 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* Copyright (C) 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.
|
||||
@ -41,6 +40,7 @@
|
||||
#include <cogl/cogl-material.h>
|
||||
#include <cogl/cogl-path.h>
|
||||
#include <cogl/cogl-shader.h>
|
||||
#include <cogl/cogl-bitmap.h>
|
||||
#include <cogl/cogl-texture.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
#include <cogl/cogl-debug.h>
|
||||
@ -363,14 +363,29 @@ void cogl_set_fog (const CoglColor *fog_color,
|
||||
*/
|
||||
void cogl_disable_fog (void);
|
||||
|
||||
/**
|
||||
* CoglBufferBit:
|
||||
* @COGL_BUFFER_BIT_COLOR: Selects the primary color buffer
|
||||
* @COGL_BUFFER_BIT_DEPTH: Selects the depth buffer
|
||||
* @COGL_BUFFER_BIT_STENCIL: Selects the stencil buffer
|
||||
*/
|
||||
typedef enum _CoglBufferBit
|
||||
{
|
||||
COGL_BUFFER_BIT_COLOR = 1L<<0,
|
||||
COGL_BUFFER_BIT_DEPTH = 1L<<1,
|
||||
COGL_BUFFER_BIT_STENCIL = 1L<<2
|
||||
} CoglBufferBit;
|
||||
|
||||
/**
|
||||
* cogl_clear:
|
||||
* @color: Background color to clear to
|
||||
* @buffers: A mask of @CoglBufferBit<!-- -->'s identifying which auxiliary
|
||||
* buffers to clear
|
||||
*
|
||||
* Clears the color buffer to @color. The depth buffer and stencil
|
||||
* buffers are also cleared.
|
||||
* Clears all the auxiliary buffers identified in the @buffers mask, and if
|
||||
* that includes the color buffer then the specified @color is used.
|
||||
*/
|
||||
void cogl_clear (const CoglColor *color);
|
||||
void cogl_clear (const CoglColor *color, gulong buffers);
|
||||
|
||||
/**
|
||||
* cogl_set_source:
|
||||
@ -475,6 +490,27 @@ void cogl_set_source_texture (CoglHandle texture_handle);
|
||||
* intersected with the previous region.
|
||||
*/
|
||||
|
||||
/**
|
||||
* cogl_clip_push_window_rect:
|
||||
* @x_offset: left edge of the clip rectangle in window coordinates
|
||||
* @y_offset: top edge of the clip rectangle in window coordinates
|
||||
* @width: width of the clip rectangle
|
||||
* @height: height of the clip rectangle
|
||||
*
|
||||
* Specifies a rectangular clipping area for all subsequent drawing
|
||||
* operations. Any drawing commands that extend outside the rectangle
|
||||
* will be clipped so that only the portion inside the rectangle will
|
||||
* be displayed. The rectangle dimensions are not transformed by the
|
||||
* current model-view matrix.
|
||||
*
|
||||
* The rectangle is intersected with the current clip region. To undo
|
||||
* the effect of this function, call cogl_clip_pop().
|
||||
*/
|
||||
void cogl_clip_push_window_rect (float x_offset,
|
||||
float y_offset,
|
||||
float width,
|
||||
float height);
|
||||
|
||||
/**
|
||||
* cogl_clip_push:
|
||||
* @x_offset: left edge of the clip rectangle
|
||||
@ -563,6 +599,35 @@ void cogl_clip_stack_save (void);
|
||||
*/
|
||||
void cogl_clip_stack_restore (void);
|
||||
|
||||
/**
|
||||
* cogl_set_draw_buffer:
|
||||
* @target: A #CoglBufferTarget that specifies what kind of draw buffer you
|
||||
* are setting as the render target.
|
||||
* @offscreen: If you are setting a draw buffer of type COGL_OFFSCREEN_BUFFER
|
||||
* then this is a CoglHandle for the offscreen buffer.
|
||||
*
|
||||
* This redirects all subsequent drawing to the specified draw buffer. This
|
||||
* can either be an offscreen buffer created with
|
||||
* cogl_offscreen_new_to_texture () or you can revert to your original
|
||||
* on screen window buffer.
|
||||
*/
|
||||
void cogl_set_draw_buffer (CoglBufferTarget target,
|
||||
CoglHandle offscreen);
|
||||
|
||||
/**
|
||||
* cogl_push_draw_buffer:
|
||||
*
|
||||
* Save cogl_set_draw_buffer() state.
|
||||
*/
|
||||
void cogl_push_draw_buffer (void);
|
||||
|
||||
/**
|
||||
* cogl_pop_draw_buffer:
|
||||
*
|
||||
* Restore cogl_set_draw_buffer() state.
|
||||
*/
|
||||
void cogl_pop_draw_buffer (void);
|
||||
|
||||
/**
|
||||
* cogl_flush_gl_state:
|
||||
* @flags: flags controlling what is flushed; currently unused, pass in 0
|
||||
|
@ -2,27 +2,25 @@ 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_LOG_DOMAIN=\"Cogl-Common\" \
|
||||
-DCLUTTER_COMPILATION \
|
||||
$(CLUTTER_CFLAGS) \
|
||||
$(CLUTTER_DEBUG_CFLAGS) \
|
||||
$(MAINTAINER_CFLAGS) \
|
||||
$(GCC_FLAGS)
|
||||
|
||||
LDADD = $(CLUTTER_LIBS)
|
||||
-DCLUTTER_COMPILATION
|
||||
|
||||
noinst_LTLIBRARIES = libclutter-cogl-common.la
|
||||
EXTRA_DIST = stb_image.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 = \
|
||||
cogl-handle.h \
|
||||
cogl-internal.h \
|
||||
cogl.c \
|
||||
cogl-util.h \
|
||||
cogl-util.c \
|
||||
cogl-bitmap.h \
|
||||
cogl-bitmap-private.h \
|
||||
cogl-bitmap.c \
|
||||
cogl-bitmap-fallback.c \
|
||||
cogl-current-matrix.c \
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -29,7 +27,7 @@
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -29,7 +27,7 @@
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -28,14 +28,17 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct _CoglBitmap
|
||||
#include "cogl-handle.h"
|
||||
|
||||
typedef struct _CoglBitmap
|
||||
{
|
||||
CoglHandleObject _parent;
|
||||
guchar *data;
|
||||
CoglPixelFormat format;
|
||||
gint width;
|
||||
gint height;
|
||||
gint rowstride;
|
||||
};
|
||||
} CoglBitmap;
|
||||
|
||||
gboolean
|
||||
_cogl_bitmap_can_convert (CoglPixelFormat src, CoglPixelFormat dst);
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -29,10 +27,21 @@
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void _cogl_bitmap_free (CoglBitmap *bmp);
|
||||
|
||||
COGL_HANDLE_DEFINE (Bitmap, bitmap);
|
||||
|
||||
static void
|
||||
_cogl_bitmap_free (CoglBitmap *bmp)
|
||||
{
|
||||
g_free (bmp->data);
|
||||
g_free (bmp);
|
||||
}
|
||||
|
||||
gint
|
||||
_cogl_get_format_bpp (CoglPixelFormat format)
|
||||
{
|
||||
@ -157,11 +166,12 @@ cogl_bitmap_get_size_from_file (const gchar *filename,
|
||||
return _cogl_bitmap_get_size_from_file (filename, width, height);
|
||||
}
|
||||
|
||||
CoglBitmap *
|
||||
CoglHandle
|
||||
cogl_bitmap_new_from_file (const gchar *filename,
|
||||
GError **error)
|
||||
{
|
||||
CoglBitmap bmp;
|
||||
CoglBitmap *ret;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
||||
|
||||
@ -178,12 +188,7 @@ cogl_bitmap_new_from_file (const gchar *filename,
|
||||
}
|
||||
}
|
||||
|
||||
return (CoglBitmap *) g_memdup (&bmp, sizeof (CoglBitmap));
|
||||
ret = g_memdup (&bmp, sizeof (CoglBitmap));
|
||||
return _cogl_bitmap_handle_new (ret);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_bitmap_free (CoglBitmap *bmp)
|
||||
{
|
||||
g_free (bmp->data);
|
||||
g_free (bmp);
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* 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
|
||||
@ -28,10 +26,14 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-internal.h"
|
||||
|
||||
/* These are defined in the particular backend (float in GL vs fixed
|
||||
in GL ES) */
|
||||
@ -57,11 +59,13 @@ void _cogl_set_matrix (const CoglMatrix *matrix);
|
||||
typedef struct _CoglClipStack CoglClipStack;
|
||||
|
||||
typedef struct _CoglClipStackEntryRect CoglClipStackEntryRect;
|
||||
typedef struct _CoglClipStackEntryWindowRect CoglClipStackEntryWindowRect;
|
||||
typedef struct _CoglClipStackEntryPath CoglClipStackEntryPath;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COGL_CLIP_STACK_RECT,
|
||||
COGL_CLIP_STACK_WINDOW_RECT,
|
||||
COGL_CLIP_STACK_PATH
|
||||
} CoglClipStackEntryType;
|
||||
|
||||
@ -84,6 +88,17 @@ struct _CoglClipStackEntryRect
|
||||
CoglMatrix matrix;
|
||||
};
|
||||
|
||||
struct _CoglClipStackEntryWindowRect
|
||||
{
|
||||
CoglClipStackEntryType type;
|
||||
|
||||
/* The window space rectangle for this clip */
|
||||
float x0;
|
||||
float y0;
|
||||
float x1;
|
||||
float y1;
|
||||
};
|
||||
|
||||
struct _CoglClipStackEntryPath
|
||||
{
|
||||
CoglClipStackEntryType type;
|
||||
@ -98,6 +113,101 @@ struct _CoglClipStackEntryPath
|
||||
CoglPathNode path[1];
|
||||
};
|
||||
|
||||
void
|
||||
cogl_clip_push_window_rect (float x_offset,
|
||||
float y_offset,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
CoglClipStackEntryWindowRect *entry;
|
||||
CoglClipStack *stack;
|
||||
float v[4];
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
stack = (CoglClipStack *) ctx->clip.stacks->data;
|
||||
|
||||
cogl_get_viewport (v);
|
||||
|
||||
entry = g_slice_new (CoglClipStackEntryWindowRect);
|
||||
|
||||
/* We convert from coords with (0,0) at top left to coords
|
||||
* with (0,0) at bottom left. */
|
||||
entry->type = COGL_CLIP_STACK_WINDOW_RECT;
|
||||
entry->x0 = x_offset;
|
||||
entry->y0 = v[3] - y_offset - height;
|
||||
entry->x1 = x_offset + width;
|
||||
entry->y1 = v[3] - y_offset;
|
||||
|
||||
/* Store it in the stack */
|
||||
stack->stack_top = g_list_prepend (stack->stack_top, entry);
|
||||
|
||||
ctx->clip.stack_dirty = TRUE;
|
||||
}
|
||||
|
||||
/* Scale from OpenGL <-1,1> coordinates system to window coordinates
|
||||
* <0,window-size> with (0,0) being top left. */
|
||||
#define VIEWPORT_SCALE_X(x, w, width, origin) \
|
||||
((((((x) / (w)) + 1.0) / 2) * (width)) + (origin))
|
||||
#define VIEWPORT_SCALE_Y(y, w, height, origin) \
|
||||
((height) - (((((y) / (w)) + 1.0) / 2) * (height)) + (origin))
|
||||
|
||||
static void
|
||||
transform_point (CoglMatrix *matrix_mv,
|
||||
CoglMatrix *matrix_p,
|
||||
float *viewport,
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
float z = 0;
|
||||
float w = 1;
|
||||
|
||||
/* Apply the model view matrix */
|
||||
cogl_matrix_transform_point (matrix_mv, x, y, &z, &w);
|
||||
|
||||
/* Apply the projection matrix */
|
||||
cogl_matrix_transform_point (matrix_p, x, y, &z, &w);
|
||||
/* Apply viewport transform */
|
||||
*x = VIEWPORT_SCALE_X (*x, w, viewport[2], viewport[0]);
|
||||
*y = VIEWPORT_SCALE_Y (*y, w, viewport[3], viewport[1]);
|
||||
}
|
||||
|
||||
#undef VIEWPORT_SCALE_X
|
||||
#undef VIEWPORT_SCALE_Y
|
||||
|
||||
/* Try to push a rectangle given in object coordinates as a rectangle in window
|
||||
* coordinates instead of object coordinates */
|
||||
gboolean
|
||||
try_pushing_rect_as_window_rect (float x_offset,
|
||||
float y_offset,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
CoglMatrix matrix;
|
||||
CoglMatrix matrix_p;
|
||||
float v[4];
|
||||
float _x0 = x_offset;
|
||||
float _y0 = y_offset;
|
||||
float _x1 = x_offset + width;
|
||||
float _y1 = y_offset + height;
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
|
||||
if (matrix.xy != 0 || matrix.xz != 0 ||
|
||||
matrix.yx != 0 || matrix.yz != 0 ||
|
||||
matrix.zx != 0 || matrix.zy != 0)
|
||||
return FALSE;
|
||||
|
||||
cogl_get_projection_matrix (&matrix_p);
|
||||
cogl_get_viewport (v);
|
||||
|
||||
transform_point (&matrix, &matrix_p, v, &_x0, &_y0);
|
||||
transform_point (&matrix, &matrix_p, v, &_x1, &_y1);
|
||||
|
||||
cogl_clip_push_window_rect (_x0, _y0, _x1 - _x0, _y1 - _y0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_clip_push (float x_offset,
|
||||
float y_offset,
|
||||
@ -109,6 +219,11 @@ cogl_clip_push (float x_offset,
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Try and catch window space rectangles so we can redirect to
|
||||
* cogl_clip_push_window_rect which will use scissoring. */
|
||||
if (try_pushing_rect_as_window_rect (x_offset, y_offset, width, height))
|
||||
return;
|
||||
|
||||
stack = (CoglClipStack *) ctx->clip.stacks->data;
|
||||
|
||||
entry = g_slice_new (CoglClipStackEntryRect);
|
||||
@ -169,6 +284,7 @@ cogl_clip_pop (void)
|
||||
{
|
||||
gpointer entry;
|
||||
CoglClipStack *stack;
|
||||
CoglClipStackEntryType type;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -177,10 +293,13 @@ cogl_clip_pop (void)
|
||||
g_return_if_fail (stack->stack_top != NULL);
|
||||
|
||||
entry = stack->stack_top->data;
|
||||
type = *(CoglClipStackEntryType *) entry;
|
||||
|
||||
/* Remove the top entry from the stack */
|
||||
if (*(CoglClipStackEntryType *) entry == COGL_CLIP_STACK_RECT)
|
||||
if (type == COGL_CLIP_STACK_RECT)
|
||||
g_slice_free (CoglClipStackEntryRect, entry);
|
||||
else if (type == COGL_CLIP_STACK_WINDOW_RECT)
|
||||
g_slice_free (CoglClipStackEntryWindowRect, entry);
|
||||
else
|
||||
g_free (entry);
|
||||
|
||||
@ -198,6 +317,10 @@ _cogl_clip_stack_rebuild (void)
|
||||
gboolean using_stencil_buffer = FALSE;
|
||||
GList *node;
|
||||
CoglClipStack *stack;
|
||||
guint scissor_x0 = 0;
|
||||
guint scissor_y0 = 0;
|
||||
guint scissor_x1 = G_MAXUINT;
|
||||
guint scissor_y1 = G_MAXUINT;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -208,6 +331,7 @@ _cogl_clip_stack_rebuild (void)
|
||||
|
||||
_cogl_disable_clip_planes ();
|
||||
_cogl_disable_stencil_buffer ();
|
||||
GE (glDisable (GL_SCISSOR_TEST));
|
||||
|
||||
/* If the stack is empty then there's nothing else to do */
|
||||
if (stack->stack_top == NULL)
|
||||
@ -220,8 +344,9 @@ _cogl_clip_stack_rebuild (void)
|
||||
for (; node; node = node->prev)
|
||||
{
|
||||
gpointer entry = node->data;
|
||||
CoglClipStackEntryType type = *(CoglClipStackEntryType *) entry;
|
||||
|
||||
if (*(CoglClipStackEntryType *) entry == COGL_CLIP_STACK_PATH)
|
||||
if (type == COGL_CLIP_STACK_PATH)
|
||||
{
|
||||
CoglClipStackEntryPath *path = (CoglClipStackEntryPath *) entry;
|
||||
|
||||
@ -241,7 +366,7 @@ _cogl_clip_stack_rebuild (void)
|
||||
/* We can't use clip planes any more */
|
||||
has_clip_planes = FALSE;
|
||||
}
|
||||
else
|
||||
else if (type == COGL_CLIP_STACK_RECT)
|
||||
{
|
||||
CoglClipStackEntryRect *rect = (CoglClipStackEntryRect *) entry;
|
||||
|
||||
@ -272,6 +397,16 @@ _cogl_clip_stack_rebuild (void)
|
||||
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the intersection of all window space rectangles in the clip
|
||||
* stack */
|
||||
CoglClipStackEntryWindowRect *window_rect = entry;
|
||||
scissor_x0 = MAX (scissor_x0, window_rect->x0);
|
||||
scissor_y0 = MAX (scissor_y0, window_rect->y0);
|
||||
scissor_x1 = MIN (scissor_x1, window_rect->x1);
|
||||
scissor_y1 = MIN (scissor_y1, window_rect->y1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Enabling clip planes is delayed to now so that they won't affect
|
||||
@ -279,6 +414,18 @@ _cogl_clip_stack_rebuild (void)
|
||||
if (using_clip_planes)
|
||||
_cogl_enable_clip_planes ();
|
||||
|
||||
if (scissor_x0 >= scissor_x1 || scissor_y0 >= scissor_y1)
|
||||
scissor_x0 = scissor_y0 = scissor_x1 = scissor_y1 = 0;
|
||||
|
||||
if (!(scissor_x0 == 0 && scissor_y0 == 0 &&
|
||||
scissor_x1 == G_MAXUINT && scissor_y1 == G_MAXUINT))
|
||||
{
|
||||
GE (glEnable (GL_SCISSOR_TEST));
|
||||
GE (glScissor (scissor_x0, scissor_y0,
|
||||
scissor_x1 - scissor_x0,
|
||||
scissor_y1 - scissor_y0));
|
||||
}
|
||||
|
||||
ctx->clip.stencil_used = using_stencil_buffer;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* 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
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Havoc Pennington <hp@pobox.com> for litl
|
||||
*
|
||||
* Copyright (C) 2009 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -21,6 +19,9 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Havoc Pennington <hp@pobox.com> for litl
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Havoc Pennington <hp@pobox.com> for litl
|
||||
*
|
||||
* Copyright (C) 2009 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -21,6 +19,9 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Havoc Pennington <hp@pobox.com> for litl
|
||||
*/
|
||||
|
||||
#ifndef __COGL_CURRENT_MATRIX_H
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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
|
||||
@ -15,7 +38,8 @@ static const GDebugKey cogl_debug_keys[] = {
|
||||
{ "offscreen", COGL_DEBUG_OFFSCREEN },
|
||||
{ "draw", COGL_DEBUG_DRAW },
|
||||
{ "pango", COGL_DEBUG_PANGO },
|
||||
{ "rectangles", COGL_DEBUG_RECTANGLES }
|
||||
{ "rectangles", COGL_DEBUG_RECTANGLES },
|
||||
{ "handle", COGL_DEBUG_HANDLE }
|
||||
};
|
||||
|
||||
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
||||
|
@ -1,3 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define G_IMPLEMENT_INLINES
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -48,40 +46,36 @@ typedef struct _CoglHandleObject
|
||||
/* Helper macro to encapsulate the common code for COGL reference
|
||||
counted handles */
|
||||
|
||||
#if COGL_DEBUG
|
||||
#ifdef COGL_HANDLE_DEBUG
|
||||
|
||||
#define _COGL_HANDLE_DEBUG_NEW(type_name, obj) \
|
||||
printf ("COGL " G_STRINGIFY (type_name) " NEW %p %i\n", \
|
||||
COGL_NOTE (HANDLE, "COGL " G_STRINGIFY (type_name) " NEW %p %i\n", \
|
||||
(obj), (obj)->ref_count)
|
||||
|
||||
#define _COGL_HANDLE_DEBUG_REF(type_name, handle) \
|
||||
do { \
|
||||
CoglHandleObject *obj = (CoglHandleObject *)handle; \
|
||||
printf ("COGL %s REF %p %i\n", \
|
||||
g_quark_to_string ((obj)->klass->type), \
|
||||
(obj), (obj)->ref_count); \
|
||||
} while (0)
|
||||
#define _COGL_HANDLE_DEBUG_REF(type_name, handle) G_STMT_START { \
|
||||
CoglHandleObject *__obj = (CoglHandleObject *)handle; \
|
||||
COGL_NOTE (HANDLE, "COGL %s REF %p %i\n", \
|
||||
g_quark_to_string ((__obj)->klass->type), \
|
||||
(__obj), (__obj)->ref_count); } G_STMT_END
|
||||
|
||||
#define _COGL_HANDLE_DEBUG_UNREF(type_name, handle) \
|
||||
do { \
|
||||
CoglHandleObject *obj = (CoglHandleObject *)handle; \
|
||||
printf ("COGL %s UNREF %p %i\n", \
|
||||
g_quark_to_string ((obj)->klass->type), \
|
||||
(obj), (obj)->ref_count - 1); \
|
||||
} while (0)
|
||||
#define _COGL_HANDLE_DEBUG_UNREF(type_name, handle) G_STMT_START { \
|
||||
CoglHandleObject *__obj = (CoglHandleObject *)handle; \
|
||||
COGL_NOTE (HANDLE, "COGL %s UNREF %p %i\n", \
|
||||
g_quark_to_string ((__obj)->klass->type), \
|
||||
(__obj), (__obj)->ref_count - 1); } G_STMT_END
|
||||
|
||||
#define COGL_HANDLE_DEBUG_FREE(obj) \
|
||||
printf ("COGL %s FREE %p\n", \
|
||||
g_quark_to_string ((obj)->klass->type), (obj)) \
|
||||
COGL_NOTE (HANDLE, "COGL %s FREE %p\n", \
|
||||
g_quark_to_string ((obj)->klass->type), (obj))
|
||||
|
||||
#else /* COGL_DEBUG */
|
||||
#else /* !COGL_HANDLE_DEBUG */
|
||||
|
||||
#define _COGL_HANDLE_DEBUG_NEW(type_name, obj)
|
||||
#define _COGL_HANDLE_DEBUG_REF(type_name, obj)
|
||||
#define _COGL_HANDLE_DEBUG_UNREF(type_name, obj)
|
||||
#define COGL_HANDLE_DEBUG_FREE(obj)
|
||||
|
||||
#endif /* COGL_DEBUG */
|
||||
#endif /* COGL_HANDLE_DEBUG */
|
||||
|
||||
#define COGL_HANDLE_DEFINE(TypeName, type_name) \
|
||||
\
|
||||
@ -105,8 +99,7 @@ typedef struct _CoglHandleObject
|
||||
obj->klass = &_cogl_##type_name##_class; \
|
||||
if (!obj->klass->type) \
|
||||
{ \
|
||||
obj->klass->type = \
|
||||
_cogl_##type_name##_get_type (); \
|
||||
obj->klass->type = _cogl_##type_name##_get_type (); \
|
||||
obj->klass->virt_free = _cogl_##type_name##_free; \
|
||||
} \
|
||||
\
|
||||
@ -128,8 +121,7 @@ typedef struct _CoglHandleObject
|
||||
if (handle == COGL_INVALID_HANDLE) \
|
||||
return FALSE; \
|
||||
\
|
||||
return (obj->klass->type == \
|
||||
_cogl_##type_name##_get_type ()); \
|
||||
return (obj->klass->type == _cogl_##type_name##_get_type ()); \
|
||||
} \
|
||||
\
|
||||
CoglHandle G_GNUC_DEPRECATED \
|
||||
@ -152,7 +144,7 @@ typedef struct _CoglHandleObject
|
||||
{ \
|
||||
g_warning (G_STRINGIFY (cogl_##type_name##_unref) \
|
||||
": Ignoring unref of Cogl handle " \
|
||||
"due to type missmatch"); \
|
||||
"due to type mismatch"); \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2007, 2008 OpenedHand
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
* 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
|
||||
@ -25,6 +24,8 @@
|
||||
#ifndef __COGL_INTERNAL_H
|
||||
#define __COGL_INTERNAL_H
|
||||
|
||||
#include "cogl-debug.h"
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
typedef enum {
|
||||
COGL_BOXED_NONE,
|
||||
@ -50,29 +51,25 @@ typedef struct _CoglBoxedValue
|
||||
} CoglBoxedValue;
|
||||
#endif
|
||||
|
||||
#define COGL_DEBUG 0
|
||||
#ifdef COGL_GL_DEBUG
|
||||
|
||||
#if COGL_DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
const char *_cogl_error_string(GLenum errorCode);
|
||||
const gchar *cogl_gl_error_to_string (GLenum error_code);
|
||||
|
||||
#define GE(x...) G_STMT_START { \
|
||||
GLenum err; \
|
||||
GLenum __err; \
|
||||
(x); \
|
||||
while ((err = glGetError()) != GL_NO_ERROR) { \
|
||||
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
||||
(char *)_cogl_error_string(err), \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
while ((__err = glGetError ()) != GL_NO_ERROR) \
|
||||
{ \
|
||||
g_warning ("%s: GL error (%d): %s\n", \
|
||||
G_STRLOC, \
|
||||
cogl_gl_error_to_string (__err)); \
|
||||
} } G_STMT_END
|
||||
|
||||
#else /* COGL_DEBUG */
|
||||
#else /* !COGL_GL_DEBUG */
|
||||
|
||||
#define GE(x) (x)
|
||||
|
||||
#endif /* COGL_DEBUG */
|
||||
#endif /* COGL_GL_DEBUG */
|
||||
|
||||
#define COGL_ENABLE_BLEND (1<<1)
|
||||
#define COGL_ENABLE_ALPHA_TEST (1<<2)
|
||||
@ -80,16 +77,10 @@ const char *_cogl_error_string(GLenum errorCode);
|
||||
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||
|
||||
void
|
||||
_cogl_features_init (void);
|
||||
void _cogl_features_init (void);
|
||||
gint _cogl_get_format_bpp (CoglPixelFormat format);
|
||||
|
||||
gint
|
||||
_cogl_get_format_bpp (CoglPixelFormat format);
|
||||
|
||||
void
|
||||
cogl_enable (gulong flags);
|
||||
|
||||
gulong
|
||||
cogl_get_enable ();
|
||||
void cogl_enable (gulong flags);
|
||||
gulong cogl_get_enable (void);
|
||||
|
||||
#endif /* __COGL_INTERNAL_H */
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_MATERIAL_PRIVATE_H
|
||||
#define __COGL_MATERIAL_PRIVATE_H
|
||||
|
||||
|
@ -1,3 +1,28 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -168,6 +193,18 @@ cogl_material_set_color4ub (CoglHandle handle,
|
||||
cogl_material_set_color (handle, &color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_material_set_color4f (CoglHandle handle,
|
||||
float red,
|
||||
float green,
|
||||
float blue,
|
||||
float alpha)
|
||||
{
|
||||
CoglColor color;
|
||||
cogl_color_set_from_4f (&color, red, green, blue, alpha);
|
||||
cogl_material_set_color (handle, &color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_material_get_ambient (CoglHandle handle,
|
||||
CoglColor *ambient)
|
||||
@ -619,6 +656,7 @@ cogl_material_set_layer_matrix (CoglHandle material_handle,
|
||||
static void
|
||||
_cogl_material_layer_free (CoglMaterialLayer *layer)
|
||||
{
|
||||
if (layer->texture != COGL_INVALID_HANDLE)
|
||||
cogl_handle_unref (layer->texture);
|
||||
g_free (layer);
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Havoc Pennington <hp@pobox.com> for litl
|
||||
*
|
||||
* Copyright (C) 2009 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -21,6 +19,9 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Havoc Pennington <hp@pobox.com> for litl
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Havoc Pennington <hp@pobox.com> for litl
|
||||
*
|
||||
* Copyright (C) 2009 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -21,6 +19,9 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Havoc Pennington <hp@pobox.com> for litl
|
||||
*/
|
||||
|
||||
#ifndef __COGL_MATRIX_STACK_H
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include <cogl-matrix.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -374,9 +372,7 @@ _cogl_texture_sliced_quad (CoglTexture *tex,
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
#if COGL_DEBUG
|
||||
printf("=== Drawing Tex Quad (Sliced Mode) ===\n");
|
||||
#endif
|
||||
COGL_NOTE (DRAW, "Drawing Tex Quad (Sliced Mode)");
|
||||
|
||||
/* We can't use hardware repeat so we need to set clamp to edge
|
||||
otherwise it might pull in edge pixels from the other side */
|
||||
@ -487,17 +483,21 @@ _cogl_texture_sliced_quad (CoglTexture *tex,
|
||||
slice_tx2 /= iter_x.span->size;
|
||||
}
|
||||
|
||||
#if COGL_DEBUG
|
||||
printf("~~~~~ slice (%d,%d)\n", iter_x.index, iter_y.index);
|
||||
printf("qx1: %f\n", (slice_qx1));
|
||||
printf("qy1: %f\n", (slice_qy1));
|
||||
printf("qx2: %f\n", (slice_qx2));
|
||||
printf("qy2: %f\n", (slice_qy2));
|
||||
printf("tx1: %f\n", (slice_tx1));
|
||||
printf("ty1: %f\n", (slice_ty1));
|
||||
printf("tx2: %f\n", (slice_tx2));
|
||||
printf("ty2: %f\n", (slice_ty2));
|
||||
#endif
|
||||
COGL_NOTE (DRAW,
|
||||
"~~~~~ slice (%d, %d)\n"
|
||||
"qx1: %f\t"
|
||||
"qy1: %f\n"
|
||||
"qx2: %f\t"
|
||||
"qy2: %f\n"
|
||||
"tx1: %f\t"
|
||||
"ty1: %f\n"
|
||||
"tx2: %f\t"
|
||||
"ty2: %f\n",
|
||||
iter_x.index, iter_y.index,
|
||||
slice_qx1, slice_qy1,
|
||||
slice_qx2, slice_qy2,
|
||||
slice_tx1, slice_ty1,
|
||||
slice_tx2, slice_ty2);
|
||||
|
||||
/* Pick and bind opengl texture object */
|
||||
gl_handle = g_array_index (tex->slice_gl_handles, GLuint,
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,18 +1,14 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By: Matthew Allum <mallum@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2007, 2008 OpenedHand
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
* 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.1 of the License, or (at your option) any later version.
|
||||
* 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
|
||||
@ -20,7 +16,9 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* 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
|
||||
@ -181,7 +179,6 @@ cogl_buffer_target_get_type (void)
|
||||
{
|
||||
static const GFlagsValue values[] = {
|
||||
{ COGL_WINDOW_BUFFER, "COGL_WINDOW_BUFFER", "window-buffer" },
|
||||
{ COGL_MASK_BUFFER, "COGL_MASK_BUFFER", "mask-buffer" },
|
||||
{ COGL_OFFSCREEN_BUFFER, "COGL_OFFSCREEN_BUFFER", "offscreen-buffer" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Cogl.
|
||||
* Cogl
|
||||
*
|
||||
* An OpenGL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corporation.
|
||||
*
|
||||
* Authored By: Robert Bragg <robert@linux.intel.com>
|
||||
* Copyright (C) 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
|
||||
@ -18,7 +16,12 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_VERTEX_BUFFER_H
|
||||
|
@ -1,14 +1,10 @@
|
||||
/*
|
||||
* Cogl.
|
||||
* Cogl
|
||||
*
|
||||
* An OpenGL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Vertex Buffer API: Handle extensible arrays of vertex attributes
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2008,2009 Intel Corporation.
|
||||
*
|
||||
* Authored by: Robert Bragg <robert@linux.intel.com>
|
||||
*
|
||||
* 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
|
||||
@ -20,7 +16,12 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
/* XXX: For an overview of the functionality implemented here, please
|
||||
@ -126,7 +127,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
@ -1775,4 +1776,3 @@ _cogl_vertex_buffer_free (CoglVertexBuffer *buffer)
|
||||
|
||||
g_slice_free (CoglVertexBuffer, buffer);
|
||||
}
|
||||
|
||||
|
114
common/cogl.c
114
common/cogl.c
@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2007, 2008 OpenedHand
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
* 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
|
||||
@ -39,6 +38,7 @@
|
||||
typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
|
||||
#endif
|
||||
|
||||
#include "cogl-debug.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-util.h"
|
||||
#include "cogl-context.h"
|
||||
@ -47,67 +47,82 @@ typedef CoglFuncPtr (*GLXGetProcAddressProc) (const guint8 *procName);
|
||||
#include "cogl-gles2-wrapper.h"
|
||||
#endif
|
||||
|
||||
#ifdef COGL_GL_DEBUG
|
||||
/* GL error to string conversion */
|
||||
#if COGL_DEBUG
|
||||
struct token_string
|
||||
{
|
||||
GLuint Token;
|
||||
const char *String;
|
||||
};
|
||||
static const struct {
|
||||
GLuint error_code;
|
||||
const gchar *error_string;
|
||||
} gl_errors[] = {
|
||||
{ GL_NO_ERROR, "No error" },
|
||||
{ GL_INVALID_ENUM, "Invalid enumeration value" },
|
||||
{ GL_INVALID_VALUE, "Invalid value" },
|
||||
{ GL_INVALID_OPERATION, "Invalid operation" },
|
||||
{ GL_STACK_OVERFLOW, "Stack overflow" },
|
||||
{ GL_STACK_UNDERFLOW, "Stack underflow" },
|
||||
{ GL_OUT_OF_MEMORY, "Out of memory" },
|
||||
|
||||
static const struct token_string Errors[] = {
|
||||
{ GL_NO_ERROR, "no error" },
|
||||
{ GL_INVALID_ENUM, "invalid enumerant" },
|
||||
{ GL_INVALID_VALUE, "invalid value" },
|
||||
{ GL_INVALID_OPERATION, "invalid operation" },
|
||||
{ GL_STACK_OVERFLOW, "stack overflow" },
|
||||
{ GL_STACK_UNDERFLOW, "stack underflow" },
|
||||
{ GL_OUT_OF_MEMORY, "out of memory" },
|
||||
#ifdef GL_INVALID_FRAMEBUFFER_OPERATION_EXT
|
||||
{ GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "invalid framebuffer operation" },
|
||||
{ GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "Invalid framebuffer operation" }
|
||||
#endif
|
||||
{ ~0, NULL }
|
||||
};
|
||||
|
||||
const char*
|
||||
_cogl_error_string(GLenum errorCode)
|
||||
static const guint n_gl_errors = G_N_ELEMENTS (gl_errors);
|
||||
|
||||
const gchar *
|
||||
cogl_gl_error_to_string (GLenum error_code)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; Errors[i].String; i++) {
|
||||
if (Errors[i].Token == errorCode)
|
||||
return Errors[i].String;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < n_gl_errors; i++)
|
||||
{
|
||||
if (gl_errors[i].error_code == error_code)
|
||||
return gl_errors[i].error_string;
|
||||
}
|
||||
return "unknown";
|
||||
|
||||
return "Unknown GL error";
|
||||
}
|
||||
#endif
|
||||
#endif /* COGL_GL_DEBUG */
|
||||
|
||||
void
|
||||
cogl_clear (const CoglColor *color)
|
||||
cogl_clear (const CoglColor *color, gulong buffers)
|
||||
{
|
||||
#if COGL_DEBUG
|
||||
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
||||
#endif
|
||||
GLbitfield gl_buffers = 0;
|
||||
|
||||
COGL_NOTE (DRAW, "Clear begin");
|
||||
|
||||
cogl_clip_ensure ();
|
||||
|
||||
if (buffers & COGL_BUFFER_BIT_COLOR)
|
||||
{
|
||||
GE( glClearColor (cogl_color_get_red_float (color),
|
||||
cogl_color_get_green_float (color),
|
||||
cogl_color_get_blue_float (color),
|
||||
0.0) );
|
||||
gl_buffers |= GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
if (buffers & COGL_BUFFER_BIT_DEPTH)
|
||||
gl_buffers |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
/*
|
||||
* Disable the depth test for now as has some strange side effects,
|
||||
* mainly on x/y axis rotation with multiple layers at same depth
|
||||
* (eg rotating text on a bg has very strange effect). Seems no clean
|
||||
* 100% effective way to fix without other odd issues.. So for now
|
||||
* move to application to handle and add cogl_enable_depth_test()
|
||||
* as for custom actors (i.e groups) to enable if need be.
|
||||
*
|
||||
* glEnable (GL_DEPTH_TEST);
|
||||
* glEnable (GL_ALPHA_TEST)
|
||||
* glDepthFunc (GL_LEQUAL);
|
||||
* glAlphaFunc (GL_GREATER, 0.1);
|
||||
*/
|
||||
if (buffers & COGL_BUFFER_BIT_STENCIL)
|
||||
gl_buffers |= GL_STENCIL_BUFFER_BIT;
|
||||
|
||||
if (!gl_buffers)
|
||||
{
|
||||
static gboolean shown = FALSE;
|
||||
|
||||
if (!shown)
|
||||
{
|
||||
g_warning ("You should specify at least one auxiliary buffer "
|
||||
"when calling cogl_clear");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
glClear (gl_buffers);
|
||||
|
||||
COGL_NOTE (DRAW, "Clear end");
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@ -556,24 +571,31 @@ cogl_get_viewport (float v[4])
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
||||
cogl_get_bitmasks (gint *red,
|
||||
gint *green,
|
||||
gint *blue,
|
||||
gint *alpha)
|
||||
{
|
||||
GLint value;
|
||||
|
||||
if (red)
|
||||
{
|
||||
GE( glGetIntegerv(GL_RED_BITS, &value) );
|
||||
*red = value;
|
||||
}
|
||||
|
||||
if (green)
|
||||
{
|
||||
GE( glGetIntegerv(GL_GREEN_BITS, &value) );
|
||||
*green = value;
|
||||
}
|
||||
|
||||
if (blue)
|
||||
{
|
||||
GE( glGetIntegerv(GL_BLUE_BITS, &value) );
|
||||
*blue = value;
|
||||
}
|
||||
|
||||
if (alpha)
|
||||
{
|
||||
GE( glGetIntegerv(GL_ALPHA_BITS, &value ) );
|
||||
|
@ -103,6 +103,13 @@ cogl_path_stroke_preserve
|
||||
cogl_color
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>cogl-bitmap</FILE>
|
||||
<TITLE>Bitmaps</TITLE>
|
||||
cogl_bitmap_new_from_file
|
||||
cogl_bitmap_get_size_from_file
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>cogl-texture</FILE>
|
||||
<TITLE>Textures</TITLE>
|
||||
@ -130,12 +137,6 @@ cogl_texture_get_gl_texture
|
||||
cogl_texture_get_data
|
||||
cogl_texture_set_filters
|
||||
cogl_texture_set_region
|
||||
|
||||
<SUBSECTION>
|
||||
CoglBitmap
|
||||
cogl_bitmap_new_from_file
|
||||
cogl_bitmap_free
|
||||
cogl_bitmap_get_size_from_file
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@ -148,7 +149,8 @@ cogl_is_shader
|
||||
cogl_shader_source
|
||||
cogl_shader_compile
|
||||
cogl_shader_get_info_log
|
||||
cogl_shader_get_parameteriv
|
||||
cogl_shader_get_type
|
||||
cogl_shader_is_compiled
|
||||
<SUBSECTION>
|
||||
cogl_create_program
|
||||
cogl_program_ref
|
||||
@ -172,9 +174,7 @@ cogl_offscreen_new_to_texture
|
||||
cogl_offscreen_ref
|
||||
cogl_offscreen_unref
|
||||
cogl_is_offscreen
|
||||
cogl_offscreen_blit
|
||||
cogl_offscreen_blit_region
|
||||
cogl_draw_buffer
|
||||
cogl_set_draw_buffer
|
||||
<SUBSECTION Private>
|
||||
cogl_offscreen_new_multisample
|
||||
</SECTION>
|
||||
|
100
gl/Makefile.am
100
gl/Makefile.am
@ -1,65 +1,65 @@
|
||||
libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
||||
libclutterinclude_HEADERS = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
NULL =
|
||||
|
||||
cogl_headers = \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-shader.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-texture.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-types.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-vertex-buffer.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-material.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-matrix.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-debug.h
|
||||
$(top_srcdir)/clutter/cogl/cogl-color.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-fixed.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-bitmap.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-texture.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-types.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-vertex-buffer.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-material.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-matrix.h \
|
||||
$(top_srcdir)/clutter/cogl/cogl-debug.h \
|
||||
$(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_LOG_DOMAIN=\"Cogl-GL\" \
|
||||
-DCLUTTER_COMPILATION \
|
||||
$(CLUTTER_CFLAGS) \
|
||||
$(CLUTTER_DEBUG_CFLAGS) \
|
||||
$(MAINTAINER_CFLAGS) \
|
||||
$(GCC_FLAGS)
|
||||
|
||||
LDADD = $(CLUTTER_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = libclutter-cogl.la
|
||||
|
||||
libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-shader.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-texture.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-types.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-debug.h \
|
||||
cogl-internal.h \
|
||||
cogl_priv_headers = \
|
||||
cogl-texture-private.h \
|
||||
cogl-fbo.h \
|
||||
cogl-shader-private.h \
|
||||
cogl-program.h \
|
||||
cogl-context.h \
|
||||
$(NULL)
|
||||
|
||||
cogl_sources = \
|
||||
cogl.c \
|
||||
cogl-primitives.c \
|
||||
cogl-texture.c \
|
||||
cogl-fbo.c \
|
||||
cogl-shader.c \
|
||||
cogl-program.c \
|
||||
cogl-context.c
|
||||
cogl-context.c \
|
||||
$(NULL)
|
||||
|
||||
coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
||||
coglinclude_HEADERS = \
|
||||
$(cogl_headers) \
|
||||
$(top_builddir)/clutter/cogl/cogl.h
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/clutter/cogl \
|
||||
-I$(top_srcdir)/clutter/cogl/common \
|
||||
-I$(top_srcdir)/clutter/cogl/$(CLUTTER_COGL) \
|
||||
-I$(top_srcdir)/clutter \
|
||||
-I$(top_builddir)/clutter \
|
||||
-I$(top_builddir)/clutter/cogl \
|
||||
-DG_LOG_DOMAIN=\"Cogl-GL\" \
|
||||
-DCLUTTER_COMPILATION
|
||||
|
||||
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) $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
libclutter_cogl_la_DEPENDENCIES = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(cogl_headers) \
|
||||
$(cogl_priv_headers) \
|
||||
$(cogl_sources) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = cogl-defines.h.in
|
||||
|
||||
libclutter_cogl_la_LIBADD = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -44,6 +42,7 @@ cogl_create_context ()
|
||||
{
|
||||
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
||||
gulong enable_flags = 0;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
if (_context != NULL)
|
||||
return FALSE;
|
||||
@ -80,7 +79,11 @@ cogl_create_context ()
|
||||
sizeof (CoglLayerInfo));
|
||||
_context->n_texcoord_arrays_enabled = 0;
|
||||
|
||||
_context->draw_buffer = COGL_WINDOW_BUFFER;
|
||||
draw_buffer = g_slice_new0 (CoglDrawBufferState);
|
||||
draw_buffer->target = COGL_WINDOW_BUFFER;
|
||||
draw_buffer->offscreen = COGL_INVALID_HANDLE;
|
||||
_context->draw_buffer_stack =
|
||||
g_slist_prepend (NULL, draw_buffer);
|
||||
|
||||
_context->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
|
||||
_context->last_path = 0;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -38,6 +36,12 @@ typedef struct
|
||||
GLubyte c[4];
|
||||
} CoglTextureGLVertex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CoglBufferTarget target;
|
||||
CoglHandle offscreen;
|
||||
} CoglDrawBufferState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Features cache */
|
||||
@ -84,7 +88,7 @@ typedef struct
|
||||
guint n_texcoord_arrays_enabled;
|
||||
|
||||
/* Framebuffer objects */
|
||||
CoglBufferTarget draw_buffer;
|
||||
GSList *draw_buffer_stack;
|
||||
|
||||
/* Clip stack */
|
||||
CoglClipStackState clip;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -26,14 +24,11 @@
|
||||
#ifndef __COGL_DEFINES_H__
|
||||
#define __COGL_DEFINES_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <@CLUTTER_GL_HEADER@>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef GLenum COGLenum;
|
||||
typedef GLint COGLint;
|
||||
typedef GLuint COGLuint;
|
||||
|
||||
/* FIXME + DOCUMENT */
|
||||
|
||||
#define COPENSTEP OPENSTEP
|
||||
@ -227,7 +222,6 @@ typedef GLuint COGLuint;
|
||||
#define CGL_FOG_INDEX GL_FOG_INDEX
|
||||
#define CGL_FOG_START GL_FOG_START
|
||||
#define CGL_FOG_END GL_FOG_END
|
||||
#define CGL_LINEAR GL_LINEAR
|
||||
#define CGL_EXP GL_EXP
|
||||
#define CGL_LOGIC_OP GL_LOGIC_OP
|
||||
#define CGL_INDEX_LOGIC_OP GL_INDEX_LOGIC_OP
|
||||
@ -420,10 +414,6 @@ typedef GLuint COGLuint;
|
||||
#define CGL_TEXTURE_ALPHA_SIZE GL_TEXTURE_ALPHA_SIZE
|
||||
#define CGL_TEXTURE_LUMINANCE_SIZE GL_TEXTURE_LUMINANCE_SIZE
|
||||
#define CGL_TEXTURE_INTENSITY_SIZE GL_TEXTURE_INTENSITY_SIZE
|
||||
#define CGL_NEAREST_MIPMAP_NEAREST GL_NEAREST_MIPMAP_NEAREST
|
||||
#define CGL_NEAREST_MIPMAP_LINEAR GL_NEAREST_MIPMAP_LINEAR
|
||||
#define CGL_LINEAR_MIPMAP_NEAREST GL_LINEAR_MIPMAP_NEAREST
|
||||
#define CGL_LINEAR_MIPMAP_LINEAR GL_LINEAR_MIPMAP_LINEAR
|
||||
#define CGL_OBJECT_LINEAR GL_OBJECT_LINEAR
|
||||
#define CGL_OBJECT_PLANE GL_OBJECT_PLANE
|
||||
#define CGL_EYE_LINEAR GL_EYE_LINEAR
|
||||
@ -431,7 +421,6 @@ typedef GLuint COGLuint;
|
||||
#define CGL_SPHERE_MAP GL_SPHERE_MAP
|
||||
#define CGL_DECAL GL_DECAL
|
||||
#define CGL_MODULATE GL_MODULATE
|
||||
#define CGL_NEAREST GL_NEAREST
|
||||
#define CGL_REPEAT GL_REPEAT
|
||||
#define CGL_CLAMP GL_CLAMP
|
||||
#define CGL_S GL_S
|
||||
@ -693,9 +682,6 @@ typedef GLuint COGLuint;
|
||||
#define CGL_UNSIGNED_SHORT_8_8_MESA 0
|
||||
#endif
|
||||
|
||||
#define CGL_FRAGMENT_SHADER GL_FRAGMENT_SHADER_ARB
|
||||
#define CGL_VERTEX_SHADER GL_VERTEX_SHADER_ARB
|
||||
|
||||
#define CGL_OBJECT_COMPILE_STATUS GL_OBJECT_COMPILE_STATUS_ARB
|
||||
|
||||
#define CLUTTER_COGL_HAS_GL 1
|
||||
|
178
gl/cogl-fbo.c
178
gl/cogl-fbo.c
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -150,15 +148,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle)
|
||||
return _cogl_offscreen_handle_new (fbo);
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_offscreen_new_multisample ()
|
||||
{
|
||||
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_MULTISAMPLE))
|
||||
return COGL_INVALID_HANDLE;
|
||||
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_offscreen_free (CoglFbo *fbo)
|
||||
{
|
||||
@ -173,80 +162,16 @@ _cogl_offscreen_free (CoglFbo *fbo)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit_region (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int src_w,
|
||||
int src_h,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int dst_w,
|
||||
int dst_h)
|
||||
{
|
||||
CoglFbo *src_fbo;
|
||||
CoglFbo *dst_fbo;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT))
|
||||
return;
|
||||
|
||||
/* Make sure these are valid fbo handles */
|
||||
if (!cogl_is_offscreen (src_buffer))
|
||||
return;
|
||||
|
||||
if (!cogl_is_offscreen (dst_buffer))
|
||||
return;
|
||||
|
||||
src_fbo = _cogl_offscreen_pointer_from_handle (src_buffer);
|
||||
dst_fbo = _cogl_offscreen_pointer_from_handle (dst_buffer);
|
||||
|
||||
/* Copy (and scale) a region from one to another framebuffer */
|
||||
GE( glBindFramebufferEXT (GL_READ_FRAMEBUFFER_EXT, src_fbo->gl_handle) );
|
||||
GE( glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, dst_fbo->gl_handle) );
|
||||
GE( glBlitFramebufferEXT (src_x, src_y, src_x + src_w, src_y + src_h,
|
||||
dst_x, dst_y, dst_x + dst_w, dst_y + dst_h,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR) );
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer)
|
||||
{
|
||||
CoglFbo *src_fbo;
|
||||
CoglFbo *dst_fbo;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_BLIT))
|
||||
return;
|
||||
|
||||
/* Make sure these are valid fbo handles */
|
||||
if (!cogl_is_offscreen (src_buffer))
|
||||
return;
|
||||
|
||||
if (!cogl_is_offscreen (dst_buffer))
|
||||
return;
|
||||
|
||||
src_fbo = _cogl_offscreen_pointer_from_handle (src_buffer);
|
||||
dst_fbo = _cogl_offscreen_pointer_from_handle (dst_buffer);
|
||||
|
||||
/* Copy (and scale) whole image from one to another framebuffer */
|
||||
GE( glBindFramebufferEXT (GL_READ_FRAMEBUFFER_EXT, src_fbo->gl_handle) );
|
||||
GE( glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, dst_fbo->gl_handle) );
|
||||
GE( glBlitFramebufferEXT (0, 0, src_fbo->width, src_fbo->height,
|
||||
0, 0, dst_fbo->width, dst_fbo->height,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR) );
|
||||
}
|
||||
|
||||
void
|
||||
cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
{
|
||||
CoglFbo *fbo = NULL;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
draw_buffer = ctx->draw_buffer_stack->data;
|
||||
|
||||
if (target == COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
/* Make sure it is a valid fbo handle */
|
||||
@ -256,7 +181,7 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
fbo = _cogl_offscreen_pointer_from_handle (offscreen);
|
||||
|
||||
/* Check current draw buffer target */
|
||||
if (ctx->draw_buffer != COGL_OFFSCREEN_BUFFER)
|
||||
if (draw_buffer->target != COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
/* Push the viewport and matrix setup if redirecting
|
||||
from a non-screen buffer */
|
||||
@ -299,13 +224,11 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
GE( glEnable (GL_SCISSOR_TEST) );
|
||||
GE( glClear (GL_COLOR_BUFFER_BIT) );
|
||||
GE( glPopAttrib () );
|
||||
|
||||
}
|
||||
else if ((target & COGL_WINDOW_BUFFER) ||
|
||||
(target & COGL_MASK_BUFFER))
|
||||
else if (target & COGL_WINDOW_BUFFER)
|
||||
{
|
||||
/* Check current draw buffer target */
|
||||
if (ctx->draw_buffer == COGL_OFFSCREEN_BUFFER)
|
||||
if (draw_buffer->target == COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
/* Pop viewport and matrices if redirecting back
|
||||
from an offscreen buffer */
|
||||
@ -320,19 +243,74 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
|
||||
/* Bind window framebuffer object */
|
||||
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0) );
|
||||
|
||||
if (target == COGL_MASK_BUFFER)
|
||||
{
|
||||
/* Draw only to ALPHA channel */
|
||||
GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Draw to all channels */
|
||||
GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Store new target */
|
||||
ctx->draw_buffer = target;
|
||||
draw_buffer->target = target;
|
||||
if (draw_buffer->offscreen != offscreen)
|
||||
{
|
||||
if (draw_buffer->offscreen != COGL_INVALID_HANDLE)
|
||||
cogl_handle_unref (draw_buffer->offscreen);
|
||||
if (offscreen != COGL_INVALID_HANDLE)
|
||||
cogl_handle_ref (offscreen);
|
||||
draw_buffer->offscreen = offscreen;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_push_draw_buffer(void)
|
||||
{
|
||||
CoglDrawBufferState *old;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
old = ctx->draw_buffer_stack->data;
|
||||
|
||||
draw_buffer = g_slice_new0 (CoglDrawBufferState);
|
||||
*draw_buffer = *old;
|
||||
|
||||
ctx->draw_buffer_stack =
|
||||
g_slist_prepend (ctx->draw_buffer_stack, draw_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pop_draw_buffer(void)
|
||||
{
|
||||
CoglDrawBufferState *to_pop;
|
||||
CoglDrawBufferState *to_restore;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
if (ctx->draw_buffer_stack->next == NULL)
|
||||
{
|
||||
g_warning ("1 more cogl_pop_draw_buffer() than cogl_push_draw_buffer()");
|
||||
return;
|
||||
}
|
||||
|
||||
to_pop = ctx->draw_buffer_stack->data;
|
||||
to_restore = ctx->draw_buffer_stack->next->data;
|
||||
|
||||
/* the logic in cogl_set_draw_buffer() only works if
|
||||
* to_pop is still on top of the stack, because
|
||||
* cogl_set_draw_buffer() needs to know the previous
|
||||
* state.
|
||||
*/
|
||||
cogl_set_draw_buffer (to_restore->target, to_restore->offscreen);
|
||||
|
||||
/* cogl_set_draw_buffer() should have set top of stack
|
||||
* to to_restore
|
||||
*/
|
||||
g_assert (to_restore->target == to_pop->target);
|
||||
g_assert (to_restore->offscreen == to_pop->offscreen);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack->data == to_pop);
|
||||
ctx->draw_buffer_stack =
|
||||
g_slist_remove_link (ctx->draw_buffer_stack,
|
||||
ctx->draw_buffer_stack);
|
||||
|
||||
g_slice_free (CoglDrawBufferState, to_pop);
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
*
|
||||
* 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_INTERNAL_H
|
||||
#define __COGL_INTERNAL_H
|
||||
|
||||
#define COGL_DEBUG 0
|
||||
|
||||
#if COGL_DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
const char *_cogl_error_string(GLenum errorCode);
|
||||
|
||||
#define GE(x...) G_STMT_START { \
|
||||
GLenum err; \
|
||||
(x); \
|
||||
while ((err = glGetError()) != GL_NO_ERROR) { \
|
||||
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
||||
(char *)_cogl_error_string(err), \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* COGL_DEBUG */
|
||||
|
||||
#define GE(x) (x)
|
||||
|
||||
#endif /* COGL_DEBUG */
|
||||
|
||||
#define COGL_ENABLE_BLEND (1<<1)
|
||||
#define COGL_ENABLE_ALPHA_TEST (1<<2)
|
||||
#define COGL_ENABLE_VERTEX_ARRAY (1<<3)
|
||||
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||
|
||||
gint
|
||||
_cogl_get_format_bpp (CoglPixelFormat format);
|
||||
|
||||
void
|
||||
cogl_enable (gulong flags);
|
||||
|
||||
gulong
|
||||
cogl_get_enable ();
|
||||
|
||||
#endif /* __COGL_INTERNAL_H */
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -141,7 +139,7 @@ cogl_program_use (CoglHandle handle)
|
||||
glUseProgramObjectARB (gl_handle);
|
||||
}
|
||||
|
||||
COGLint
|
||||
int
|
||||
cogl_program_get_uniform_location (CoglHandle handle,
|
||||
const gchar *uniform_name)
|
||||
{
|
||||
@ -157,7 +155,7 @@ cogl_program_get_uniform_location (CoglHandle handle,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_1f (COGLint uniform_no,
|
||||
cogl_program_uniform_1f (int uniform_no,
|
||||
gfloat value)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
@ -165,7 +163,7 @@ cogl_program_uniform_1f (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_1i (COGLint uniform_no,
|
||||
cogl_program_uniform_1i (int uniform_no,
|
||||
gint value)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
@ -173,7 +171,7 @@ cogl_program_uniform_1i (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_float (COGLint uniform_no,
|
||||
cogl_program_uniform_float (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const GLfloat *value)
|
||||
@ -200,10 +198,10 @@ cogl_program_uniform_float (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_int (COGLint uniform_no,
|
||||
cogl_program_uniform_int (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const COGLint *value)
|
||||
const int *value)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -227,7 +225,7 @@ cogl_program_uniform_int (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_matrix (COGLint uniform_no,
|
||||
cogl_program_uniform_matrix (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
gboolean transpose,
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* 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
|
||||
@ -57,21 +55,33 @@ _cogl_shader_free (CoglShader *shader)
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_create_shader (COGLenum shaderType)
|
||||
cogl_create_shader (CoglShaderType type)
|
||||
{
|
||||
CoglShader *shader;
|
||||
GLenum gl_type;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
||||
|
||||
if (type == COGL_SHADER_TYPE_VERTEX)
|
||||
gl_type = GL_VERTEX_SHADER;
|
||||
else if (type == COGL_SHADER_TYPE_FRAGMENT)
|
||||
gl_type = GL_FRAGMENT_SHADER;
|
||||
else
|
||||
{
|
||||
g_warning ("Unexpected shader type (0x%08lX) given to "
|
||||
"cogl_create_shader", (unsigned long) type);
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
shader = g_slice_new (CoglShader);
|
||||
shader->gl_handle = glCreateShaderObjectARB (shaderType);
|
||||
shader->gl_handle = glCreateShaderObjectARB (gl_type);
|
||||
|
||||
return _cogl_shader_handle_new (shader);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_source (CoglHandle handle,
|
||||
const gchar *source)
|
||||
const char *source)
|
||||
{
|
||||
CoglShader *shader;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
@ -100,11 +110,11 @@ cogl_shader_compile (CoglHandle handle)
|
||||
|
||||
void
|
||||
cogl_shader_get_info_log (CoglHandle handle,
|
||||
guint size,
|
||||
gchar *buffer)
|
||||
size_t size,
|
||||
char *buffer)
|
||||
{
|
||||
CoglShader *shader;
|
||||
COGLint len;
|
||||
int len;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
@ -116,18 +126,51 @@ cogl_shader_get_info_log (CoglHandle handle,
|
||||
buffer[len]='\0';
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_get_parameteriv (CoglHandle handle,
|
||||
COGLenum pname,
|
||||
COGLint *dest)
|
||||
CoglShaderType
|
||||
cogl_shader_get_type (CoglHandle handle)
|
||||
{
|
||||
GLint type;
|
||||
CoglShader *shader;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, COGL_SHADER_TYPE_VERTEX);
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
return;
|
||||
{
|
||||
g_warning ("Non shader handle type passed to cogl_shader_get_type");
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
|
||||
shader = _cogl_shader_pointer_from_handle (handle);
|
||||
|
||||
glGetObjectParameterivARB (shader->gl_handle, pname, dest);
|
||||
GE (glGetObjectParameterivARB (shader->gl_handle, GL_SHADER_TYPE, &type));
|
||||
if (type == GL_VERTEX_SHADER)
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
else if (type == GL_FRAGMENT_SHADER)
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
else
|
||||
{
|
||||
g_warning ("Unexpected shader type 0x%08lX", (unsigned long)type);
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_shader_is_compiled (CoglHandle handle)
|
||||
{
|
||||
GLint status;
|
||||
CoglShader *shader;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
return FALSE;
|
||||
|
||||
shader = _cogl_shader_pointer_from_handle (handle);
|
||||
|
||||
GE (glGetObjectParameterivARB (shader->gl_handle, GL_COMPILE_STATUS, &status));
|
||||
if (status == GL_TRUE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -26,7 +24,7 @@
|
||||
#ifndef __COGL_TEXTURE_H
|
||||
#define __COGL_TEXTURE_H
|
||||
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
#include "cogl-handle.h"
|
||||
|
||||
typedef struct _CoglTexture CoglTexture;
|
||||
@ -70,8 +68,8 @@ struct _CoglTexture
|
||||
GArray *slice_y_spans;
|
||||
GArray *slice_gl_handles;
|
||||
gint max_waste;
|
||||
COGLenum min_filter;
|
||||
COGLenum mag_filter;
|
||||
CoglTextureFilter min_filter;
|
||||
CoglTextureFilter mag_filter;
|
||||
gboolean is_foreign;
|
||||
GLint wrap_mode;
|
||||
gboolean auto_mipmap;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -21,6 +19,11 @@
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Matthew Allum <mallum@openedhand.com>
|
||||
* Neil Roberts <neil@linux.intel.com>
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,6 +34,7 @@
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-util.h"
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
#include "cogl-texture-private.h"
|
||||
#include "cogl-material.h"
|
||||
#include "cogl-context.h"
|
||||
@ -40,17 +44,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
#define COGL_DEBUG 1
|
||||
|
||||
#define GE(x) \
|
||||
{ \
|
||||
glGetError(); x; \
|
||||
GLuint err = glGetError(); \
|
||||
if (err != 0) \
|
||||
printf("err: 0x%x\n", err); \
|
||||
} */
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
|
||||
#define glDrawRangeElements ctx->pf_glDrawRangeElements
|
||||
@ -939,12 +932,11 @@ _cogl_texture_slices_create (CoglTexture *tex)
|
||||
{
|
||||
x_span = &g_array_index (tex->slice_x_spans, CoglTexSliceSpan, x);
|
||||
|
||||
#if COGL_DEBUG
|
||||
printf ("CREATE SLICE (%d,%d)\n", x,y);
|
||||
printf ("size: (%d x %d)\n",
|
||||
COGL_NOTE (TEXTURE, "CREATE SLICE (%d,%d)\tsize (%d,%d)",
|
||||
x, y,
|
||||
x_span->size - x_span->waste,
|
||||
y_span->size - y_span->waste);
|
||||
#endif
|
||||
|
||||
/* Setup texture parameters */
|
||||
GE( glBindTexture (tex->gl_target,
|
||||
gl_handles[y * n_x_slices + x]) );
|
||||
@ -1243,8 +1235,8 @@ cogl_texture_new_with_size (guint width,
|
||||
tex->slice_gl_handles = NULL;
|
||||
|
||||
tex->max_waste = max_waste;
|
||||
tex->min_filter = CGL_NEAREST;
|
||||
tex->mag_filter = CGL_NEAREST;
|
||||
tex->min_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
tex->mag_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
|
||||
/* Find closest GL format match */
|
||||
tex->bitmap.format =
|
||||
@ -1304,8 +1296,8 @@ cogl_texture_new_from_data (guint width,
|
||||
tex->slice_gl_handles = NULL;
|
||||
|
||||
tex->max_waste = max_waste;
|
||||
tex->min_filter = CGL_NEAREST;
|
||||
tex->mag_filter = CGL_NEAREST;
|
||||
tex->min_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
tex->mag_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
|
||||
/* FIXME: If upload fails we should set some kind of
|
||||
* error flag but still return texture handle (this
|
||||
@ -1336,12 +1328,15 @@ cogl_texture_new_from_data (guint width,
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||
cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
||||
gint max_waste,
|
||||
CoglTextureFlags flags,
|
||||
CoglPixelFormat internal_format)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
CoglBitmap *bmp = (CoglBitmap *)bmp_handle;
|
||||
|
||||
g_return_val_if_fail (bmp_handle != COGL_INVALID_HANDLE, COGL_INVALID_HANDLE);
|
||||
|
||||
/* Create new texture and fill with loaded data */
|
||||
tex = (CoglTexture*) g_malloc ( sizeof (CoglTexture));
|
||||
@ -1358,8 +1353,8 @@ cogl_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||
tex->slice_gl_handles = NULL;
|
||||
|
||||
tex->max_waste = max_waste;
|
||||
tex->min_filter = CGL_NEAREST;
|
||||
tex->mag_filter = CGL_NEAREST;
|
||||
tex->min_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
tex->mag_filter = COGL_TEXTURE_FILTER_NEAREST;
|
||||
|
||||
/* FIXME: If upload fails we should set some kind of
|
||||
* error flag but still return texture handle if the
|
||||
@ -1399,19 +1394,20 @@ cogl_texture_new_from_file (const gchar *filename,
|
||||
CoglPixelFormat internal_format,
|
||||
GError **error)
|
||||
{
|
||||
CoglBitmap *bmp;
|
||||
CoglHandle bmp;
|
||||
CoglHandle handle;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
||||
|
||||
if (!(bmp = cogl_bitmap_new_from_file (filename, error)))
|
||||
bmp = cogl_bitmap_new_from_file (filename, error);
|
||||
if (bmp == COGL_INVALID_HANDLE)
|
||||
return COGL_INVALID_HANDLE;
|
||||
|
||||
handle = cogl_texture_new_from_bitmap (bmp,
|
||||
max_waste,
|
||||
flags,
|
||||
internal_format);
|
||||
cogl_bitmap_free (bmp);
|
||||
cogl_handle_unref (bmp);
|
||||
|
||||
return handle;
|
||||
}
|
||||
@ -1685,7 +1681,7 @@ cogl_texture_get_gl_texture (CoglHandle handle,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
COGLenum
|
||||
CoglTextureFilter
|
||||
cogl_texture_get_min_filter (CoglHandle handle)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
@ -1698,7 +1694,7 @@ cogl_texture_get_min_filter (CoglHandle handle)
|
||||
return tex->min_filter;
|
||||
}
|
||||
|
||||
COGLenum
|
||||
CoglTextureFilter
|
||||
cogl_texture_get_mag_filter (CoglHandle handle)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
@ -1713,8 +1709,8 @@ cogl_texture_get_mag_filter (CoglHandle handle)
|
||||
|
||||
void
|
||||
cogl_texture_set_filters (CoglHandle handle,
|
||||
COGLenum min_filter,
|
||||
COGLenum mag_filter)
|
||||
CoglTextureFilter min_filter,
|
||||
CoglTextureFilter mag_filter)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
GLuint gl_handle;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 OpenedHand
|
||||
* 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
|
||||
|
@ -8,6 +8,7 @@ libclutterinclude_HEADERS = \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-shader.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-bitmap.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-texture.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-types.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-vertex-buffer.h \
|
||||
@ -24,16 +25,13 @@ INCLUDES = \
|
||||
-I$(top_builddir)/clutter \
|
||||
-I$(top_builddir)/clutter/cogl \
|
||||
-DG_LOG_DOMAIN=\"Cogl-GLES\" \
|
||||
-DCLUTTER_COMPILATION \
|
||||
$(CLUTTER_CFLAGS) \
|
||||
$(CLUTTER_DEBUG_CFLAGS) \
|
||||
$(MAINTAINER_CFLAGS) \
|
||||
$(GCC_FLAGS)
|
||||
|
||||
LDADD = $(CLUTTER_LIBS)
|
||||
-DCLUTTER_COMPILATION
|
||||
|
||||
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) $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
libclutter_cogl_la_DEPENDENCIES = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||
@ -43,10 +41,10 @@ libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-shader.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-bitmap.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-texture.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-types.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-debug.h \
|
||||
cogl-internal.h \
|
||||
cogl-texture-private.h \
|
||||
cogl-fbo.h \
|
||||
cogl-context.h \
|
||||
@ -75,8 +73,6 @@ EXTRA_DIST = cogl-defines.h.in \
|
||||
cogl-fixed-vertex-shader.glsl \
|
||||
cogl-fixed-fragment-shader.glsl
|
||||
|
||||
libclutter_cogl_la_LIBADD = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la
|
||||
|
||||
.glsl.h :
|
||||
/bin/sh $(top_srcdir)/clutter/cogl/gles/stringify.sh -h $<
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -46,6 +44,7 @@ cogl_create_context ()
|
||||
{
|
||||
GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 };
|
||||
gulong enable_flags = 0;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
if (_context != NULL)
|
||||
return FALSE;
|
||||
@ -83,7 +82,11 @@ cogl_create_context ()
|
||||
sizeof (CoglLayerInfo));
|
||||
_context->n_texcoord_arrays_enabled = 0;
|
||||
|
||||
_context->draw_buffer = COGL_WINDOW_BUFFER;
|
||||
draw_buffer = g_slice_new0 (CoglDrawBufferState);
|
||||
draw_buffer->target = COGL_WINDOW_BUFFER;
|
||||
draw_buffer->offscreen = COGL_INVALID_HANDLE;
|
||||
_context->draw_buffer_stack =
|
||||
g_slist_prepend (NULL, draw_buffer);
|
||||
|
||||
_context->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
|
||||
_context->last_path = 0;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -40,6 +38,12 @@ typedef struct
|
||||
GLubyte c[4];
|
||||
} CoglTextureGLVertex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CoglBufferTarget target;
|
||||
CoglHandle offscreen;
|
||||
} CoglDrawBufferState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Features cache */
|
||||
@ -86,7 +90,7 @@ typedef struct
|
||||
guint n_texcoord_arrays_enabled;
|
||||
|
||||
/* Framebuffer objects */
|
||||
CoglBufferTarget draw_buffer;
|
||||
GSList *draw_buffer_stack;
|
||||
|
||||
/* Clip stack */
|
||||
CoglClipStackState clip;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#ifndef __COGL_DEFINES_H__
|
||||
#define __COGL_DEFINES_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <@CLUTTER_GL_HEADER@>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -429,10 +430,6 @@ G_BEGIN_DECLS
|
||||
#define CGL_WEIGHT_ARRAY_BUFFER_BINDING_OES GL_WEIGHT_ARRAY_BUFFER_BINDING_OES
|
||||
#define CGL_TEXTURE_CROP_RECT_OES GL_TEXTURE_CROP_RECT_OES
|
||||
|
||||
typedef GLenum COGLenum;
|
||||
typedef GLint COGLint;
|
||||
typedef GLuint COGLuint;
|
||||
|
||||
/* extras */
|
||||
|
||||
/* YUV textures also unsupported */
|
||||
@ -440,18 +437,6 @@ typedef GLuint COGLuint;
|
||||
#define CGL_UNSIGNED_SHORT_8_8_REV_MESA 0
|
||||
#define CGL_UNSIGNED_SHORT_8_8_MESA 0
|
||||
|
||||
#ifdef GL_FRAGMENT_SHADER
|
||||
#define CGL_FRAGMENT_SHADER GL_FRAGMENT_SHADER
|
||||
#else
|
||||
#define CGL_FRAGMENT_SHADER 0
|
||||
#endif
|
||||
|
||||
#ifdef GL_VERTEX_SHADER
|
||||
#define CGL_VERTEX_SHADER GL_VERTEX_SHADER
|
||||
#else
|
||||
#define CGL_VERTEX_SHADER 0
|
||||
#endif
|
||||
|
||||
#if defined(GL_OBJECT_COMPILE_STATUS)
|
||||
#define CGL_OBJECT_COMPILE_STATUS GL_OBJECT_COMPILE_STATUS
|
||||
#elif defined(GL_COMPILE_STATUS)
|
||||
|
166
gles/cogl-fbo.c
166
gles/cogl-fbo.c
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -132,15 +130,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle)
|
||||
return _cogl_offscreen_handle_new (fbo);
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_offscreen_new_multisample ()
|
||||
{
|
||||
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN_MULTISAMPLE))
|
||||
return COGL_INVALID_HANDLE;
|
||||
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_offscreen_free (CoglFbo *fbo)
|
||||
{
|
||||
@ -155,36 +144,16 @@ _cogl_offscreen_free (CoglFbo *fbo)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit_region (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int src_w,
|
||||
int src_h,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int dst_w,
|
||||
int dst_h)
|
||||
{
|
||||
/* Not supported on GLES */
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer)
|
||||
{
|
||||
/* Not supported on GLES */
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
{
|
||||
CoglFbo *fbo = NULL;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
draw_buffer = ctx->draw_buffer_stack->data;
|
||||
|
||||
if (target == COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
GLboolean scissor_enabled;
|
||||
@ -197,7 +166,7 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
fbo = _cogl_offscreen_pointer_from_handle (offscreen);
|
||||
|
||||
/* Check current draw buffer target */
|
||||
if (ctx->draw_buffer != COGL_OFFSCREEN_BUFFER)
|
||||
if (draw_buffer->target != COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
/* Push the viewport and matrix setup if redirecting
|
||||
from a non-screen buffer */
|
||||
@ -247,11 +216,10 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
scissor_box[2], scissor_box[3]);
|
||||
|
||||
}
|
||||
else if ((target & COGL_WINDOW_BUFFER) ||
|
||||
(target & COGL_MASK_BUFFER))
|
||||
else if (target & COGL_WINDOW_BUFFER)
|
||||
{
|
||||
/* Check current draw buffer target */
|
||||
if (ctx->draw_buffer == COGL_OFFSCREEN_BUFFER)
|
||||
if (draw_buffer->target == COGL_OFFSCREEN_BUFFER)
|
||||
{
|
||||
/* Pop viewport and matrices if redirecting back
|
||||
from an offscreen buffer */
|
||||
@ -267,27 +235,75 @@ cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
|
||||
/* Bind window framebuffer object */
|
||||
GE( glBindFramebuffer (GL_FRAMEBUFFER, 0) );
|
||||
|
||||
|
||||
if (target == COGL_WINDOW_BUFFER)
|
||||
{
|
||||
/* Draw to RGB channels */
|
||||
GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
||||
}
|
||||
else if (target == COGL_MASK_BUFFER)
|
||||
{
|
||||
/* Draw only to ALPHA channel */
|
||||
GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Draw to all channels */
|
||||
GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Store new target */
|
||||
ctx->draw_buffer = target;
|
||||
draw_buffer->target = target;
|
||||
if (draw_buffer->offscreen != offscreen)
|
||||
{
|
||||
if (draw_buffer->offscreen != COGL_INVALID_HANDLE)
|
||||
cogl_handle_unref (draw_buffer->offscreen);
|
||||
if (offscreen != COGL_INVALID_HANDLE)
|
||||
cogl_handle_ref (offscreen);
|
||||
draw_buffer->offscreen = offscreen;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_push_draw_buffer(void)
|
||||
{
|
||||
CoglDrawBufferState *old;
|
||||
CoglDrawBufferState *draw_buffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
old = ctx->draw_buffer_stack->data;
|
||||
|
||||
draw_buffer = g_slice_new0 (CoglDrawBufferState);
|
||||
*draw_buffer = *old;
|
||||
|
||||
ctx->draw_buffer_stack =
|
||||
g_slist_prepend (ctx->draw_buffer_stack, draw_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pop_draw_buffer(void)
|
||||
{
|
||||
CoglDrawBufferState *to_pop;
|
||||
CoglDrawBufferState *to_restore;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack != NULL);
|
||||
if (ctx->draw_buffer_stack->next == NULL)
|
||||
{
|
||||
g_warning ("1 more cogl_pop_draw_buffer() than cogl_push_draw_buffer()");
|
||||
return;
|
||||
}
|
||||
|
||||
to_pop = ctx->draw_buffer_stack->data;
|
||||
to_restore = ctx->draw_buffer_stack->next->data;
|
||||
|
||||
/* the logic in cogl_set_draw_buffer() only works if
|
||||
* to_pop is still on top of the stack, because
|
||||
* cogl_set_draw_buffer() needs to know the previous
|
||||
* state.
|
||||
*/
|
||||
cogl_set_draw_buffer (to_restore->target, to_restore->offscreen);
|
||||
|
||||
/* cogl_set_draw_buffer() should have set top of stack
|
||||
* to to_restore
|
||||
*/
|
||||
g_assert (to_restore->target == to_pop->target);
|
||||
g_assert (to_restore->offscreen == to_pop->offscreen);
|
||||
|
||||
g_assert (ctx->draw_buffer_stack->data == to_pop);
|
||||
ctx->draw_buffer_stack =
|
||||
g_slist_remove_link (ctx->draw_buffer_stack,
|
||||
ctx->draw_buffer_stack);
|
||||
|
||||
g_slice_free (CoglDrawBufferState, to_pop);
|
||||
}
|
||||
|
||||
#else /* HAVE_COGL_GLES2 */
|
||||
@ -306,12 +322,6 @@ cogl_offscreen_new_to_texture (CoglHandle texhandle)
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_offscreen_new_multisample ()
|
||||
{
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_offscreen_ref (CoglHandle handle)
|
||||
{
|
||||
@ -324,27 +334,7 @@ cogl_offscreen_unref (CoglHandle handle)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit_region (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int src_w,
|
||||
int src_h,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int dst_w,
|
||||
int dst_h)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cogl_offscreen_blit (CoglHandle src_buffer,
|
||||
CoglHandle dst_buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cogl_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
*
|
||||
* 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_INTERNAL_H
|
||||
#define __COGL_INTERNAL_H
|
||||
|
||||
typedef enum {
|
||||
COGL_BOXED_NONE,
|
||||
COGL_BOXED_INT,
|
||||
COGL_BOXED_FLOAT,
|
||||
COGL_BOXED_MATRIX
|
||||
} CoglBoxedType;
|
||||
|
||||
typedef struct _CoglBoxedValue
|
||||
{
|
||||
CoglBoxedType type;
|
||||
int size, count;
|
||||
gboolean transpose;
|
||||
|
||||
union {
|
||||
gfloat float_value[4];
|
||||
gint int_value[4];
|
||||
gfloat matrix[16];
|
||||
gfloat *float_array;
|
||||
gint *int_array;
|
||||
gpointer array;
|
||||
} v;
|
||||
} CoglBoxedValue;
|
||||
|
||||
|
||||
#define COGL_DEBUG 0
|
||||
|
||||
#if COGL_DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
const char *_cogl_error_string(GLenum errorCode);
|
||||
|
||||
#define GE(x...) G_STMT_START { \
|
||||
GLenum err; \
|
||||
(x); \
|
||||
while ((err = glGetError()) != GL_NO_ERROR) { \
|
||||
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
||||
(char *)_cogl_error_string(err), \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* COGL_DEBUG */
|
||||
|
||||
#define GE(x) (x)
|
||||
|
||||
#endif /* COGL_DEBUG */
|
||||
|
||||
#define COGL_ENABLE_BLEND (1<<1)
|
||||
#define COGL_ENABLE_ALPHA_TEST (1<<2)
|
||||
#define COGL_ENABLE_VERTEX_ARRAY (1<<3)
|
||||
#define COGL_ENABLE_COLOR_ARRAY (1<<4)
|
||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||
|
||||
void
|
||||
_cogl_features_init (void);
|
||||
|
||||
gint
|
||||
_cogl_get_format_bpp (CoglPixelFormat format);
|
||||
|
||||
void
|
||||
cogl_enable (gulong flags);
|
||||
|
||||
gulong
|
||||
cogl_get_enable ();
|
||||
|
||||
#endif /* __COGL_INTERNAL_H */
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -124,7 +122,7 @@ cogl_program_use (CoglHandle handle)
|
||||
ctx->gles2.settings_dirty = TRUE;
|
||||
}
|
||||
|
||||
COGLint
|
||||
int
|
||||
cogl_program_get_uniform_location (CoglHandle handle,
|
||||
const gchar *uniform_name)
|
||||
{
|
||||
@ -157,21 +155,21 @@ cogl_program_get_uniform_location (CoglHandle handle,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_1f (COGLint uniform_no,
|
||||
cogl_program_uniform_1f (int uniform_no,
|
||||
gfloat value)
|
||||
{
|
||||
cogl_program_uniform_float (uniform_no, 1, 1, &value);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_1i (COGLint uniform_no,
|
||||
cogl_program_uniform_1i (int uniform_no,
|
||||
gint value)
|
||||
{
|
||||
cogl_program_uniform_int (uniform_no, 1, 1, &value);
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_program_uniform_x (COGLint uniform_no,
|
||||
cogl_program_uniform_x (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
CoglBoxedType type,
|
||||
@ -217,7 +215,7 @@ cogl_program_uniform_x (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_float (COGLint uniform_no,
|
||||
cogl_program_uniform_float (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const GLfloat *value)
|
||||
@ -227,7 +225,7 @@ cogl_program_uniform_float (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_int (COGLint uniform_no,
|
||||
cogl_program_uniform_int (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const GLint *value)
|
||||
@ -237,7 +235,7 @@ cogl_program_uniform_int (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_matrix (COGLint uniform_no,
|
||||
cogl_program_uniform_matrix (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
gboolean transpose,
|
||||
@ -298,7 +296,7 @@ cogl_program_use (CoglHandle program_handle)
|
||||
{
|
||||
}
|
||||
|
||||
COGLint
|
||||
int
|
||||
cogl_program_get_uniform_location (CoglHandle program_handle,
|
||||
const gchar *uniform_name)
|
||||
{
|
||||
@ -306,13 +304,13 @@ cogl_program_get_uniform_location (CoglHandle program_handle,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_1f (COGLint uniform_no,
|
||||
cogl_program_uniform_1f (int uniform_no,
|
||||
gfloat value)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_float (COGLint uniform_no,
|
||||
cogl_program_uniform_float (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const GLfloat *value)
|
||||
@ -320,15 +318,15 @@ cogl_program_uniform_float (COGLint uniform_no,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_int (COGLint uniform_no,
|
||||
cogl_program_uniform_int (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
const COGLint *value)
|
||||
const int *value)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cogl_program_uniform_matrix (COGLint uniform_no,
|
||||
cogl_program_uniform_matrix (int uniform_no,
|
||||
gint size,
|
||||
gint count,
|
||||
gboolean transpose,
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
@ -50,22 +48,31 @@ _cogl_shader_free (CoglShader *shader)
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_create_shader (COGLenum shaderType)
|
||||
cogl_create_shader (CoglShaderType type)
|
||||
{
|
||||
CoglShader *shader;
|
||||
GLenum gl_type;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
if (type == COGL_SHADER_TYPE_VERTEX)
|
||||
gl_type = GL_VERTEX_SHADER;
|
||||
else if (type == COGL_SHADER_TYPE_FRAGMENT)
|
||||
gl_type = GL_FRAGMENT_SHADER;
|
||||
else
|
||||
{
|
||||
g_warning ("Unexpected shader type (0x%08lX) given to "
|
||||
"cogl_create_shader", (unsigned long) type);
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
shader = g_slice_new (CoglShader);
|
||||
shader->gl_handle = glCreateShader (shaderType);
|
||||
shader->type = shaderType;
|
||||
shader->gl_handle = glCreateShader (gl_type);
|
||||
|
||||
return _cogl_shader_handle_new (shader);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_source (CoglHandle handle,
|
||||
const gchar *source)
|
||||
const char *source)
|
||||
{
|
||||
CoglShader *shader;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
@ -94,11 +101,11 @@ cogl_shader_compile (CoglHandle handle)
|
||||
|
||||
void
|
||||
cogl_shader_get_info_log (CoglHandle handle,
|
||||
guint size,
|
||||
gchar *buffer)
|
||||
size_t size,
|
||||
char *buffer)
|
||||
{
|
||||
CoglShader *shader;
|
||||
COGLint len = 0;
|
||||
int len = 0;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
@ -110,20 +117,48 @@ cogl_shader_get_info_log (CoglHandle handle,
|
||||
buffer[len] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_get_parameteriv (CoglHandle handle,
|
||||
COGLenum pname,
|
||||
COGLint *dest)
|
||||
CoglShaderType
|
||||
cogl_shader_get_type (CoglHandle handle)
|
||||
{
|
||||
GLint type;
|
||||
CoglShader *shader;
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
return;
|
||||
{
|
||||
g_warning ("Non shader handle type passed to cogl_shader_get_type");
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
|
||||
shader = _cogl_shader_pointer_from_handle (handle);
|
||||
|
||||
glGetShaderiv (shader->gl_handle, pname, dest);
|
||||
GE (glGetShaderiv (shader->gl_handle, GL_SHADER_TYPE, &type));
|
||||
if (type == GL_VERTEX_SHADER)
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
else if (type == GL_FRAGMENT_SHADER)
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
else
|
||||
{
|
||||
g_warning ("Unexpected shader type 0x%08lX", (unsigned long)type);
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_shader_is_compiled (CoglHandle handle)
|
||||
{
|
||||
GLint status;
|
||||
CoglShader *shader;
|
||||
|
||||
if (!cogl_is_shader (handle))
|
||||
return FALSE;
|
||||
|
||||
shader = _cogl_shader_pointer_from_handle (handle);
|
||||
|
||||
GE (glGetShaderiv (shader->gl_handle, GL_COMPILE_STATUS, &status));
|
||||
if (status == GL_TRUE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#else /* HAVE_COGL_GLES2 */
|
||||
@ -131,7 +166,7 @@ cogl_shader_get_parameteriv (CoglHandle handle,
|
||||
/* No support on regular OpenGL 1.1 */
|
||||
|
||||
CoglHandle
|
||||
cogl_create_shader (COGLenum shaderType)
|
||||
cogl_create_shader (CoglShaderType type)
|
||||
{
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
@ -155,7 +190,7 @@ cogl_shader_unref (CoglHandle handle)
|
||||
|
||||
void
|
||||
cogl_shader_source (CoglHandle shader,
|
||||
const gchar *source)
|
||||
const char *source)
|
||||
{
|
||||
}
|
||||
|
||||
@ -166,16 +201,21 @@ cogl_shader_compile (CoglHandle shader_handle)
|
||||
|
||||
void
|
||||
cogl_shader_get_info_log (CoglHandle handle,
|
||||
guint size,
|
||||
gchar *buffer)
|
||||
size_t size,
|
||||
char *buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_get_parameteriv (CoglHandle handle,
|
||||
COGLenum pname,
|
||||
COGLint *dest)
|
||||
CoglShaderType
|
||||
cogl_shader_get_type (CoglHandle handle)
|
||||
{
|
||||
return COGL_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_shader_is_compiled (CoglHandle handle)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_COGL_GLES2 */
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -26,7 +24,7 @@
|
||||
#ifndef __COGL_TEXTURE_H
|
||||
#define __COGL_TEXTURE_H
|
||||
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
#include "cogl-handle.h"
|
||||
|
||||
typedef struct _CoglTexture CoglTexture;
|
||||
@ -70,8 +68,8 @@ struct _CoglTexture
|
||||
GArray *slice_y_spans;
|
||||
GArray *slice_gl_handles;
|
||||
gint max_waste;
|
||||
COGLenum min_filter;
|
||||
COGLenum mag_filter;
|
||||
CoglTextureFilter min_filter;
|
||||
CoglTextureFilter mag_filter;
|
||||
gboolean is_foreign;
|
||||
GLint wrap_mode;
|
||||
gboolean auto_mipmap;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
@ -30,7 +28,7 @@
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
#include "cogl-util.h"
|
||||
#include "cogl-bitmap.h"
|
||||
#include "cogl-bitmap-private.h"
|
||||
#include "cogl-texture-private.h"
|
||||
#include "cogl-material.h"
|
||||
#include "cogl-context.h"
|
||||
@ -42,17 +40,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
#define COGL_DEBUG 1
|
||||
|
||||
#define GE(x) \
|
||||
{ \
|
||||
glGetError(); x; \
|
||||
GLuint err = glGetError(); \
|
||||
if (err != 0) \
|
||||
printf("err: 0x%x\n", err); \
|
||||
} */
|
||||
|
||||
extern void _cogl_journal_flush (void);
|
||||
|
||||
static void _cogl_texture_free (CoglTexture *tex);
|
||||
@ -485,9 +472,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
||||
_cogl_current_matrix_push ();
|
||||
_cogl_current_matrix_identity ();
|
||||
|
||||
/* Draw to all channels */
|
||||
cogl_draw_buffer (COGL_WINDOW_BUFFER | COGL_MASK_BUFFER, 0);
|
||||
|
||||
/* Direct copy operation */
|
||||
|
||||
if (ctx->texture_download_material == COGL_INVALID_HANDLE)
|
||||
@ -584,8 +568,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
||||
_cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
|
||||
_cogl_current_matrix_pop ();
|
||||
|
||||
cogl_draw_buffer (COGL_WINDOW_BUFFER, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1435,12 +1417,13 @@ cogl_texture_new_from_data (guint width,
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_texture_new_from_bitmap (CoglBitmap *bmp,
|
||||
cogl_texture_new_from_bitmap (CoglHandle bmp_handle,
|
||||
gint max_waste,
|
||||
CoglTextureFlags flags,
|
||||
CoglPixelFormat internal_format)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
CoglBitmap *bmp = (CoglBitmap *)bmp_handle;
|
||||
|
||||
/* Create new texture and fill with loaded data */
|
||||
tex = (CoglTexture*) g_malloc ( sizeof (CoglTexture));
|
||||
@ -1498,19 +1481,20 @@ cogl_texture_new_from_file (const gchar *filename,
|
||||
CoglPixelFormat internal_format,
|
||||
GError **error)
|
||||
{
|
||||
CoglBitmap *bmp;
|
||||
CoglHandle bmp;
|
||||
CoglHandle handle;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
|
||||
|
||||
if (!(bmp = cogl_bitmap_new_from_file (filename, error)))
|
||||
bmp = cogl_bitmap_new_from_file (filename, error);
|
||||
if (bmp == COGL_INVALID_HANDLE)
|
||||
return COGL_INVALID_HANDLE;
|
||||
|
||||
handle = cogl_texture_new_from_bitmap (bmp,
|
||||
max_waste,
|
||||
flags,
|
||||
internal_format);
|
||||
cogl_bitmap_free (bmp);
|
||||
cogl_handle_unref (bmp);
|
||||
|
||||
return handle;
|
||||
}
|
||||
@ -1783,7 +1767,7 @@ cogl_texture_get_gl_texture (CoglHandle handle,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
COGLenum
|
||||
CoglTextureFilter
|
||||
cogl_texture_get_min_filter (CoglHandle handle)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
@ -1796,7 +1780,7 @@ cogl_texture_get_min_filter (CoglHandle handle)
|
||||
return tex->min_filter;
|
||||
}
|
||||
|
||||
COGLenum
|
||||
CoglTextureFilter
|
||||
cogl_texture_get_mag_filter (CoglHandle handle)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
@ -1811,8 +1795,8 @@ cogl_texture_get_mag_filter (CoglHandle handle)
|
||||
|
||||
void
|
||||
cogl_texture_set_filters (CoglHandle handle,
|
||||
COGLenum min_filter,
|
||||
COGLenum mag_filter)
|
||||
CoglTextureFilter min_filter,
|
||||
CoglTextureFilter mag_filter)
|
||||
{
|
||||
CoglTexture *tex;
|
||||
GLuint gl_handle;
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2007 OpenedHand
|
||||
* 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
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 OpenedHand
|
||||
* 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
|
||||
|
@ -1,16 +1,36 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Cogl
|
||||
#
|
||||
# An object oriented GL/GLES Abstraction/Utility Layer
|
||||
#
|
||||
# Copyright (C) 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.
|
||||
|
||||
|
||||
output_copyright ()
|
||||
{
|
||||
cat <<EOF > "$1";
|
||||
/*
|
||||
* Clutter COGL
|
||||
* Cogl
|
||||
*
|
||||
* A basic GL/GLES Abstraction/Utility Layer
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
* Copyright (C) 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
|
||||
|
Loading…
Reference in New Issue
Block a user