It’s getting a bit more complicated, actually

I’ve managed install XP on my MacBook Pro and run the original HLSL shader in the program it was designed for, vvvv. On one of my computers (a PowerMac G5), duplicating the settings across into my GLSL version of the shader from vvvv produced a similar result (apart from the right side of the image being black). Whereas running exactly the same file, with identical settings, in the same Mac application (Quartz Composer) on the MacBook Pro produced a completely different result. I’ve posted screenshots on my blog of the original shader output from vvvv, and my GLSL/Quartz Composer version on the Intel and PPC-powered Macs.

http://machinesdontcare.wordpress.com/2008/01/20/intelppc-weirdness/

Here is the Fragment Shader code I came up with:

= = = = = = = = = = = = = = = =

// 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 = ((lLamn)+(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;

}

= = = = = = = = = = = = = = = = = = = =

It looks like there are two separate issues here, one to do with my GLSL conversion, and another possibly to do with differences in Quartz Composer running on different processor architectures. The second issue is obviously beyond the scope of this forum, but I wonder if anyone can spot any weirdies in my GLSL code that might cause things to behave in an odd manner.

Incidentally, I claim no credit at all for writing the gradient-generating code, which was written by Ernst Hot, and downloaded from

http://www.vvvv.org/tiki-index.php?page=User+Shaders

…I just converted it (or attempted to).

Cheers guys,

alx