Commit Graph

15 Commits

Author SHA1 Message Date
Neil Roberts
18378fe180 [fixed-to-float.sh] Use float names for the GLES2 wrappers
For example cogl_wrap_glFrustumx -> cogl_wrap_glFrustumf.

The wrappers get #defined to the float versions anyway but it helps
avoid some confusion.

The conversion is done using a regular expression in the upgrade
script. Some of the patches had to be updated to apply cleanly.
2009-01-16 13:07:02 +00:00
Neil Roberts
52d7b7be73 [fixed-to-float-patches] Move the changes to gles2-wrapper.h into the patch
It looks like the changes to cogl-gles2-wrapper.h were accidentally
committed to the actual file instead of the patch in commit
de27da0e. This commit moves the changes back into the patch so
cogl-gles2-wrapper.h is reverted back to master.
2009-01-16 10:50:53 +00:00
Neil Roberts
bef099ce40 [fixed-to-float-patches] Fix use of glClearColor and glColor under GLES 2
The wrapper for glClearColor was taking fixed arguments but was given
floating point values so it ended up always setting the clear color to
black. Now that GLES 1.1 is using the floating point version, there is
no need for the wrapper so both versions now just use glClearColor
directly.

A similar problem was happening for glColor but this does still need a
wrapper because it needs to set the vertex attribute.
2009-01-15 19:00:55 +00:00
Neil Roberts
4e94500a2a Merge branch 'master' into cogl-float
The patches have been updated to apply cleanly.

The patches for the g_warnings in clutter-actor.c have been removed
because master now uses CLUTTER_UNITS_FORMAT so they aren't
necessary. The clutter-units.h patch now sets CLUTTER_UNITS_FORMAT to
'f'.
2009-01-15 18:26:22 +00:00
Neil Roberts
ea1d9f5522 [fixed-to-float-patches] Fix some of the matrix getters and setters
The GL versions of get_modelview_matrix, get_projection_matrix and
get_viewport were using glGetDoublev and then converting them to
floats, but it might as well just call glGetFloatv directly.

The GL ES versions were using glGetFixedv but this was being replaced
with glGetFloatv by the #define in the GLES 2 wrappers.

The patch also replaces the glGetFixedv wrapper with
glGetFloatv. Previously this was calling
cogl_gles2_float_array_to_fixed which actually converted to
float. That function has been removed and memcpy is used instead.
2009-01-15 15:25:05 +00:00
Robert Bragg
66afd41868 Remove cogl_blahx Cogl interfaces that used to take CoglFixed parameters.
Since they are no longer actually taking fixed point parameters the 'x' suffix is
no longer appropriate. To maintain support for sub-pixel precision the
corresponding interfaces that were taking integer parameters now get patched
to take float parameters instead.
2009-01-13 12:47:49 +00:00
Robert Bragg
b60c2a2df6 [gl/cogl.c] Updates the cogl_rotatex prototype to take float x,y,z params
I missed this in my last commit; it just updates the prototype in gl/cogl.c
in line with the change made in cogl.h.in
2009-01-12 18:20:03 +00:00
Robert Bragg
010fd71059 [cogl.h.in.0.patch] Fixes the cogl_rotatex prototype to take float x,y,z params
The cogl_rotatex was incorrectly defined to take gint x,y,z params as opposed
to CoglFixed. This patch changes them directly to floats.
2009-01-12 17:21:14 +00:00
Robert Bragg
de27da0e5b [cogl/gles] Fixes for building for GLES 1 using floats
* This adds GLfixed -> GLfloat conversion
* redefines cogl_wrap_glBlahx macros as glBlahf
* Other misc fixes (mostly corresponding to cogl/gl equivalents)
2009-01-12 17:21:09 +00:00
Robert Bragg
ec403b2805 converts clutter_{sin,cos,tan,atan}x angles to radians before calling math.h func
These functions are defined to take an angle in degrees, so the angle needs
converting before calling the corresponding {sin,cos,tan,atan}f()

This fixes test-cogl-tex-tile.
2009-01-12 17:13:58 +00:00
Robert Bragg
012b169a73 [fixed-to-float-patches] Updates the patches in line with the last merge
Most of the patches updated weren't failing but there were a number of
hunk offsets when applying so it tidies that up. The change in
mtx_transform.0.patch has been moved to clutter-actor.c.0.patch.
2009-01-12 17:13:51 +00:00
Robert Bragg
c1866858dd fixes for clutter-behaviour-ellipse.c.0.patch 2009-01-08 11:47:28 +00:00
Robert Bragg
0ffb6f7aa5 [clutter-alpha.c.0.patch] replace ClutterAngle with float
This is just an update of the patch to reflect that fixed-to-float.sh now
replaces ClutterAngle usage with float.
2009-01-08 11:47:27 +00:00
Robert Bragg
e42d756a69 [clutter-alpha.c.0.patch] Normalizes sine values [0,1] before calculating alpha
The previous patch broke some of the normalization done before the sine value
gets multiplied with CLUTTER_ALPHA_MAX. This e.g. broke test-actors when sine
values went through to -1, as the o-hands were scaled so large all you saw was
the red 'O'.
2009-01-06 18:54:00 +00:00
Robert Bragg
e8915fcb12 First cut at a fixed point to floating point conversion script + patches
This commit doesn't actually include any direct changes to source; you
have to run ./fixed-to-float.sh. Note: the script will make a number of
commits itself to your git repository a various stages of the script.
You will need to reset these if you want to re-run the script.

* NB: Be carefull about how you reset your tree, if you are making changes
to the script and patches, so you don't loose your changes *

This aims to remove all use of fixed point within Clutter and Cogl. It aims to
not break the Clutter API, including maintaining the CLUTTER_FIXED macros,
(though they now handle floats not 16.16 fixed)

It maintains cogl-fixed.[ch] as a utility API that can be used by applications
(and potentially for focused internal optimisations), but all Cogl interfaces
now accept floats in place of CoglFixed.

Note: the choice to to use single precision floats, not doubles is very
intentional. GPUs are basically all single precision; only this year have high
end cards started adding double precision - aimed mostly at the GPGPU market.
This means if you pass doubles into any GL[ES] driver, you can expect those
numbers to be cast to a float. (Certainly this is true of Mesa wich casts
most things to floats internally) It can be a noteable performance issue to
cast from double->float frequently, and if we were to have an api defined in
terms of doubles, that would imply a *lot* of unneeded casting. One of the
noteable issues with fixed point was the amount of casting required, so I
don't want to overshoot the mark and require just as much casting still. Double
precision arithmatic is also slower, so it usually makes sense to minimize its
use if the extra precision isn't needed. In the same way that the fast/low
precision fixed API can be used sparingly for optimisations; if needs be in
certain situations we can promote to doubles internally for higher precision.

E.g.
quoting Brian Paul (talking about performance optimisations for GL programmers):
"Avoid double precision valued functions
    Mesa does all internal floating point computations in single precision
    floating point. API functions which take double precision floating point
    values must convert them to single precision. This can be expensive in the
    case of glVertex, glNormal, etc. "
2008-12-22 16:59:00 +00:00