Commit Graph

8 Commits

Author SHA1 Message Date
Owen W. Taylor
d8e521af0a Always bind a new texture to unit 1 when necessary
The special handling for texture unit 1 caught the case where unit
1 was changed for transient purposes, but didn't properly handle
the case where the actual non-transient texture was different between
two materials with no transient binding in between.

If the actual texture has changed when flushing, mark unit 1 as dirty
and needing a rebind.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2261
2010-08-09 22:02:03 +01:00
Robert Bragg
a75a7fadab material: don't dereference layer->texture directly
In _cogl_material_texture_storage_change_notify we were potentially
dereferencing layer->texture without checking first that it is the
authority of texture state. We now use
_cogl_material_layer_get_texture() instead.
2010-08-09 17:12:26 +01:00
Robert Bragg
99ae7b15f5 cogl-program: gles2: bind programs lazily as for GL
This makes the gles2 cogl_program_use consistent with the GL version by
not binding the program immediately and instead leaving it to
cogl-material.c to bind the program when actually drawing something.
2010-08-03 15:00:07 +01:00
Robert Bragg
8640f527cb cogl: don't include cogl-debug.h in cogl.h or install
cogl-debug.h is an internal header so it shouldn't have been included by
cogl.h and the header shouldn't be installed either.
2010-08-02 17:41:42 +01:00
Neil Roberts
0ab6dc9db1 cogl-material: Don't map the shininess value to [0,1]
In OpenGL the 'shininess' lighting parameter is floating point value
limited to the range 0.0→128.0. This number is used to affect the size
of the specular highlight. Cogl materials used to only accept a number
between 0.0 and 1.0 which then gets multiplied by 128.0 before sending
to GL. I think the assumption was that this is just a weird GL quirk
so we don't expose it. However the value is used as an exponent to
raise the attenuation to a power so there is no conceptual limit to
the value.

This removes the mapping and changes some of the documentation.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2222
2010-07-22 17:52:51 +01:00
Neil Roberts
89286f6a47 cogl-material: Always reset the GLSL program to zero when flushing
When flushing a fixed-function or arbfp material it would always call
disable_glsl to try to get rid of the previous GLSL shader. This is
needed even if current_use_program_type is not GLSL because if an
application calls cogl_program_uniform then Cogl will have to bind the
program to set the uniform. If this happens then it won't update
current_use_program_type presumably because the enabled state of arbfp
is still valid.

The problem was that disable_glsl would only select program zero when
the current_use_program_type is set to GLSL which wouldn't be the case
if cogl_program_uniform was called. This patch changes it to just
directly call _cogl_gl_use_program_wrapper(0) instead of having a
separate disable_glsl function. The current program is cached in the
cogl context anyway so it shouldn't cause any extra unnecessary GL
calls.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2232
2010-07-22 17:50:56 +01:00
Robert Bragg
96b0e6c304 material: splits out all the state flushing code
This moves the code supporting _cogl_material_flush_gl_state into
cogl-material-opengl.c as part of an effort to reduce the size of
cogl-material.c to keep it manageable.
2010-07-13 19:26:58 +01:00
Robert Bragg
5442e429ba material: split the texture unit management out
In general cogl-material.c has become far to large to manage in one
source file. As one of the ways to try and break it down this patch
starts to move some of lower level texture unit state management out
into cogl-material-opengl.c. The naming is such because the plan is to
follow up and migrate the very GL specific state flushing code into the
same file.
2010-07-13 19:26:58 +01:00