I think I may have solved this one.
Thanks once again to -NiCo- from the OpenGL.org forum,
who pointed out I had failed to initialise the p1
variable. I haven't tested it on the G5 at home yet,
but fixing this little error has cleared up the
remaining weirdness in the QC/GLSL Shader on my
MacBook Pro here. I guess the unitialised vec2 was
defaulting to different values on the Intel and PPC
machines...
alx
--- Alex Drinkwater <[EMAIL PROTECTED]> wrote:
> I've been attempting to convert a HLSL Pixel Shader
> to
> GLSL/QC.
>
> Here's the code for the Fragment shader (the vertex
> shader is the default one that is in a GLSL patch
> when
> it's created):
>
>
> // CONTROL INPUTS
>
> // Color 1 color UIName 'Color 1'
> uniform vec4 c1;
> // Color 2 color UIName 'Color 2'
> uniform vec4 c2;
> // Linear Amount -1000.0 > 1000.0 UIName 'Linear'
> uniform float Lamn;
> // Linear Power -1000.0 > 1000.0 UIName 'Linear
> Power'
> uniform float Lpow;
> // Radial Amount -1000.0 > 1000.0 UIName 'Radial'
> uniform float Ramn;
> // Radial Pow -1000.0 > 1000.0 UIName 'Radial Pow'
> uniform float Rpow;
> // Radial2 Amount 0.0 > 1000.0 UIName 'Radial2'
> uniform float R2amn;
> // Radial2 Pow -1000.0 > 1000.0 UIName 'Radial2 Pow'
> uniform float R2pow;
> // Pinwheel Amount 0.0 > 1000.0 UIName 'Pinwheel'
> uniform float Pamn;
> // Pinwheel Pow 0.0 > 1000.0 UIName 'Pinwheel Pow'
> uniform float Ppow;
> // Multiplier -1000.0 > 1000.0 UIName 'Multiplier'
> uniform float Multiplier;
> // Phase 0.0 > 1.0 UIName 'Phase'
> uniform float Phase;
> // Linear Pow switch UIName 'Linear Pow enabled'
> uniform bool LPe;
> // Linear Pow switch UIName 'Pinwheel Pow enabled'
> uniform bool PPe;
> //Declare a 2D texture as a uniform variable
> uniform sampler2D texture;
>
>
> // MAIN LOOP
>
> void main()
> {
> vec4 col;
> vec2 p1;
> vec2 p2 = gl_TexCoord[0].xy;
> vec2 p3 = vec2(0.0,1.0);
> vec4 v;
> float val,l,r,r2,p = 0.0;
> v.xy = p1;
> v.zw = p2;
> v -= 0.5;
> // linear
> l=p2.y;
> if (LPe) l = pow(l,Lpow);
> // radial
> r = distance(p1+0.5,p2);
> // Radial 2
> r2 = dot(v,v);
> // pinwheel
> p = 2.3873*atan(0.5-p2.x,0.5-p2.y); // 2.3873 ?
> if (PPe) p = pow(p,Ppow);
> // sum
> val =
>
((l*Lamn)+(pow(r,Rpow)*Ramn)+(pow(r2,R2pow)*R2amn)+(p*Pamn))*Multiplier;
> val = fract(val+Phase);
> if(val>0.5)
> {
> val -= 0.5;
> val *= -1.0;
> val += 0.5;
> }
> val *= 2.0;
> col = mix(c1,c2,val);
> gl_FragColor = col;
> }
>
> I take no credit at all for writing the code; I've
> just converted it to GLSL.
> The weird thing is, when I run the same QC patch on
> my
> G5 and my MacBook Pro, I get VERY different results.
>
> I've attached three screenshots; one from the G5,
> one
> from the MacBook Pro, and finally, one from the
> original shader, running in vvvv under XP on the
> MBP.
> To reiterate: same QC patch on the G5 and the
> MacBook
> Pro, identical parameter settings, and in VVVV, also
> the same parameter settings (apart from the colours,
> which are slightly different).
>
> I'm running the same OS version (10.5.1) and
> QuickTime
> version (7.4) on both machines.
>
> Anyone any idea what might be going on?
>
>
> alx
>
>
>
>
__________________________________________________________
> Sent from Yahoo! Mail - a smarter inbox
> http://uk.mail.yahoo.com
> > _______________________________________________
> Do not post admin requests to the list. They will be
> ignored.
> Quartzcomposer-dev mailing list
> ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/quartzcomposer-dev/the_voder%40yahoo.co.uk
>
> This email sent to [EMAIL PROTECTED]
___________________________________________________________
Support the World Aids Awareness campaign this month with Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]