for a blend string like:
"RGBA=ADD(SRC_COLOR, SRC_COLOR * (DST_COLOR[A]))"
it was awkward that we were requiring developers to explicitly put
redundant brackets around the DST_COLOR[A] blend factor. The parser has
been updated so now braces are only required for factors like
"(1-SRC_COLOR[A])"
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Add a method on the renderer to know how many texture image units are
accessible from fragment shaders.
https://bugzilla.gnome.org/show_bug.cgi?id=657347
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This function was not used in the opengl pipeline, probably because of
the more precise get_max_activable_texture_units().
Remove it then.
https://bugzilla.gnome.org/show_bug.cgi?id=657347
Reviewed-by: Robert Bragg <robert@linux.intel.com>
When using glib-android, it's not possible to select parts of the
library you want to initialize anymore. Plus it was decided that argc
and argv are useless as you basically don't start applications with
command line arguments on Android.
https://bugzilla.gnome.org/show_bug.cgi?id=655791
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This file is generated by:
android update project -p . -t $i
but it needs to have the name changed to the application name and thus
needs to be checked in.
https://bugzilla.gnome.org/show_bug.cgi?id=655792
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Similar to the widely used gluLookAt API, this adds a CoglMatrix utility
for setting up a view transform in terms of positioning a camera/eye
position that points to a given object position aligned to a given
world-up vector.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Cogl aims to consistently put the origin of 2D objects at the top-left
instead of the bottom left as OpenGL does, but there was an oversight
and the experimental cogl_framebuffer_swap_region API was accepting
coordinates relative to the bottom left. Cogl will now flip the user's
given rectangles to be relative to the bottom of the framebufffer before
sending them to APIs like glXCopySubBuffer and glBlitFramebuffer.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
If the user doesn't explicitly allocate a CoglFramebuffer then Cogl
should automatically allocate the framebuffer when the user starts to
draw to the framebuffer. So this way calling cogl_framebuffer_allocate
is only required if you are explicitly interested in checking for and
gracefully handling failures to allocate a framebuffer. If automatic
allocation fails then application behaviour becomes undefined.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This makes cogl_framebuffer_clear and cogl_framebuffer_clear4f public as
experimental API. Since these functions take explicit framebuffer
pointers you don't need to push/pop a framebuffer just to clear it. Also
these functions are implicitly tied to a specific CoglContext via the
framebuffer pointer unlike cogl_clear.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Some of the functions we were calling in cogl_framebuffer_clear[4f] were
referring to the current framebuffer, which would result in a crash
if nothing had been pushed before trying to explicitly clear a given
framebuffer.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
There is no need to call _cogl_framebuffer_init_bits for the draw and
read buffers each time we flush the framebuffer state since we will
always re-sync with gl if necessary when the
cogl_framebuffer_get_red/green/blue/alpha_bits functions are called.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds a function to query what CoglContext a given framebuffer
belongs too. This can be useful if you pass framebuffer pointers around
and at some point you want to create another framebuffer as part of the
same context as a given framebuffer without assuming there is a single
default context.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
The CoglBuffer api is available as experimental 2.0 api but we forgot to
exposed the COGL_BUFFER casting macro.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Instead of creating typedefs like uint8, uint16 and uint32 we now use
the glib sized typedefs in stb_image to avoid conflict with the uint8,
uint16 and uint32 typedefs on android.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
We shouldn't assume the GLchar is a valid typedef with all GL headers
when declaring all the symbols in cogl-ext-functions.h to lookup. GLchar
may not be avilable with gles1 for example so we were seeing build
failures. The patch simply replaces occurrences of GLchar with char.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
When cogl initializes we now check for a cogl/cogl.conf in any of the
system config dirs (determined using $XDG_CONFIG_DIRS on linux) we then
also check the user's config directory (determined using XDG_CONFIG_HOME
on linux) for a cogl/cogl.conf file. Options specified in the user
config file have priority over the system config options.
The config file has an .ini style syntax with a mandatory [global]
section and we currently understand 3 keynames: COGL_DEBUG, COGL_DRIVER
and COGL_RENDERER which have the same semantics as the corresponding
environment variables.
Options set using the environment variables have priority over options
set in the config files. To allow users to undo the enabling of debug
options in config files this patch also adds a check for COGL_NO_DEBUG
environment variable which will disable the specified options which may
have been enabled in config files.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Only cogl-pango needs a dependency on pangocairo so we are now careful to
separate the pangocairo pkg-config flags from the others so we can avoid
having libcogl builds refer to them.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Instead of storing four vertices per rectangle in the array for a
texture node in the display list, it now only stores two in a format
that is acceptable to cogl_rectangles_with_texture_coords. That way
it can pass the array directly to that function. That function has the
advantage over cogl_rectangle that it doesn't need to validate the
pipeline for every quad so it should be slightly faster.
When the texture node is being rendered with a CoglPrimitive we now
map the buffer and expand the rectangles into 4 vertices as the data
is copied.
https://bugzilla.gnome.org/show_bug.cgi?id=656303
Reviewed-by: Robert Bragg <robert@linux.intel.com>
When rendering text through a VBO, CoglPangoDisplayList now uses the
CoglPrimitive API instead of CoglVertexBuffer. CoglVertexBuffer is
just a layer on top of the attribute buffer API anyway so it should be
slightly faster.
https://bugzilla.gnome.org/show_bug.cgi?id=656303
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The parser couldn't cope with TEXTURE_N source arguments because the
sources are checked in turn to find one that matches the beginning of
the argument. The TEXTURE_N source was checked last so it would end up
matching the regular 'TEXTURE' source and then the parser would choke
when it tries to parse the trailing parts.
This patch just moves the check for TEXTURE_ to the top. It also also
changes it so that the argument only needs to be at least 8 characters
long instead of 9. This is necessary because the parser doesn't
consider the digits to be part of the name of the argument so while we
are parsing 'TEXTURE_0' the length is only 8.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Since the projection matrix isn't tracked in the journal and since our
software transform of vertices as we log into the journal doesn't
include the projective transform we need to make sure we flush all
primitives in the journal before ever changing the projection.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
It's not necessary to generate cogl-display.h just for the GDL backend
and to change the inclusion of libgdl.h. We can just tweak the include
CFLAGS to put /usr/include/CE4100 in the search path when needed.
Previously this did not work because of a stay ',' at the end of the
COGL_EXTRA_CFLAGS int he configure.ac. This actually simplifies the
code, which is always good.
This also fixes out of tree builds.
https://bugzilla.gnome.org/show_bug.cgi?id=655724
Reviewed-by: Neil Roberts <neil@linux.intel.com>
cogl_polygon creates some temporary strings, CoglAttributeBuffers and
CoglAttributes but it was never freeing them.
Based on a patch by Florian Renaut
https://bugzilla.gnome.org/show_bug.cgi?id=655556
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The documentation for wglGetProcAddress implies that it should only be
used for extension functions. The rest of Cogl assumes that it can
dynamically resolve all GL symbols so it would crash if this
happens. This patch makes it fallback to trying to resolve the symbol
using GModule to open the opengl32 library if wglGetProcAddress fails.
https://bugzilla.gnome.org/show_bug.cgi?id=655510
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The check for the point sprite feature got lost when the feature
functions header was combined for GL and GLES in dae02a99a.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The cogl_framebuffer_get_blue_bits was defined 2 times-fix to use the
correct define for cogl_framebuffer_get_alpha_bits
Reviewed-by: Neil Roberts <neil@linux.intel.com>