Re: [AD] bcb9eb95afc5aa00990627a7c27a954b549ecea7 breaks shader |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I figured out a way to "fix" it in my code, but I'm thinking there's probably a way to automate this. Maybe Peter knows, since he wrote most of the new code. This function is what I'm using now:
void use_shader(ALLEGRO_SHADER *shader)
{
ALLEGRO_TRANSFORM v, p;
al_copy_transform(&v, al_get_current_transform());
al_copy_transform(&p, al_get_projection_transform(display));
al_use_shader(shader);
al_use_transform(&v);
al_set_projection_transform(display, &p);
}
Trent
On 2013-03-14, at 2:03 PM, Trent Gamblin <nooskewl@xxxxxxxxxx> wrote:
> This revision breaks one of my shaders for some unknown reason. If I fudge the glGetUniformLocation back in where the projview matrix is set, it works. By breaking I mean it outputs nothing but black. My vertex shader is the default and pixel shader is below.
>
> Trent
>
> const char *tinter_pixel_source =
> #if defined OPENGLES
> "precision mediump float;\n"
> #endif
> "uniform sampler2D " ALLEGRO_SHADER_VAR_TEX ";\n"
> "varying vec4 varying_color;\n"
> "varying vec2 varying_texcoord;\n"
> "uniform float r;\n"
> "uniform float g;\n"
> "uniform float b;\n"
> "uniform float ratio;\n"
> "void main() {\n"
> " float avg, dr, dg, db;\n"
> " vec4 color = varying_color;\n"
> " vec4 coord = vec4(varying_texcoord, 0.0, 1.0);\n"
> " color *= texture2D(" ALLEGRO_SHADER_VAR_TEX ", coord.st);\n"
> " avg = (color.r + color.g + color.b) / 3.0;\n"
> " dr = avg * r;\n"
> " dg = avg * g;\n"
> " db = avg * b;\n"
> " color.r = color.r - (ratio * (color.r - dr));\n"
> " color.g = color.g - (ratio * (color.g - dg));\n"
> " color.b = color.b - (ratio * (color.b - db));\n"
> " gl_FragColor = color;\n"
> "}";
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers