bug report: td.rota.jxs

Feb 2, 2007 at 9:51pm

bug report: td.rota.jxs

i cannot get anything but black out of jit.gl.slab @file td.rota.jxs,
in either 1.6.2 or 1.6.3b2. i was previously able to use this shader
with no problem, but haven’t tried in months.

hardware: 1.67Ghz pbg4, os 10.4.8.

can anyone else confirm this?

j

#30094
Feb 3, 2007 at 5:58pm

On Feb 2, 2007, at 1:51 PM, joshua goldberg wrote:

> i cannot get anything but black out of jit.gl.slab @file
> td.rota.jxs, in either 1.6.2 or 1.6.3b2. i was previously able to
> use this shader with no problem, but haven’t tried in months.
>
> hardware: 1.67Ghz pbg4, os 10.4.8.

Search the forum. There’s two versions. One for old HW like you have
and one for new HW. AB has posted them both to the list, I believe.

-Joshua

#95410
Feb 3, 2007 at 6:57pm

i’ve now tried both the old version and the new version and i still
get black.

anyone out there with my model powerbook able to confirm my problem?

On Feb 3, 2007, at 12:58 PM, Joshua Kit Clayton wrote:

>
> On Feb 2, 2007, at 1:51 PM, joshua goldberg wrote:
>
>> i cannot get anything but black out of jit.gl.slab @file
>> td.rota.jxs, in either 1.6.2 or 1.6.3b2. i was previously able to
>> use this shader with no problem, but haven’t tried in months.
>>
>> hardware: 1.67Ghz pbg4, os 10.4.8.
>
> Search the forum. There’s two versions. One for old HW like you
> have and one for new HW. AB has posted them both to the list, I
> believe.
>
> -Joshua
>

#95411
Feb 3, 2007 at 7:10pm

I have the same setup and the shader works here. This was using Jitter 1.6.2.

Here’s the shader:



kaleidoscope








< ![CDATA[

varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
varying vec2 texdim1;
varying vec2 texorient0;
varying vec2 texorient1;
varying vec2 no;
varying float bound_is_0;
varying float bound_is_1;
varying float bound_is_2;
varying float bound_is_3;
varying float bound_is_4;
varying float bound_is_0_1_3;
varying float bound_not_1;

uniform vec2 zoom;
uniform vec2 offset;
uniform float theta;
uniform vec2 anchor;
uniform int boundmode;

void main()
{
// perform standard transform on vertex
gl_Position = ftransform();

// transform texcoords
texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
// extract the x and y scalars from the texture matrix to
determine dimensions
texdim0 = vec2
(abs(gl_TextureMatrix[0][0][0]),abs(gl_TextureMatrix[0][1][1]));
texdim1 = vec2
(abs(gl_TextureMatrix[1][0][0]),abs(gl_TextureMatrix[1][1][1]));
// extract the sign for orientation
texorient0 = vec2
(gl_TextureMatrix[0][0][0]/texdim0.x,gl_TextureMatrix[0][1][1]/texdim0.y);
texorient1 = vec2
(gl_TextureMatrix[1][0][0]/texdim1.x,gl_TextureMatrix[1][1][1]/texdim1.y);

// perform rota transform (since linear, more efficient to do in
vertex program)
mat2 sca = mat2 (1./zoom.x,0.,0.,1./zoom.y);//scaling matrix (zoom)
mat2 rot = mat2
(cos(theta),sin(theta),-sin(theta),cos(theta));//rotation matrix
no = ((((texcoord0-anchor*texdim0)*rot)*sca)+anchor*texdim0)+offset;

// setup our boundmode boolean scalars to reduce fragment program
instruction count
bound_is_0 = float (boundmode==0);
bound_is_1 = float (boundmode==1);
bound_is_2 = float (boundmode==2);
bound_is_3 = float (boundmode==3);
bound_is_4 = float (boundmode==4);
bound_is_0_1_3 = float ((boundmode==0)||(boundmode==1)||(boundmode==3));
bound_not_1 = float (boundmode!=1);

}

]]>

< ![CDATA[

//setup for 2 texture
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
varying vec2 no;
varying float bound_is_0;
varying float bound_is_1;
varying float bound_is_2;
varying float bound_is_3;
varying float bound_is_4;
varying float bound_is_0_1_3;
varying float bound_not_1;

uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
const float pi=3.1415926;

void main()
{
// where is the point?
vec2 sizea = texdim0;

//create boundmodes
vec2 no2 = mod(mod(no,sizea)+sizea,sizea);//wrap

vec2 no4 = mod(abs(no),sizea*2.);//folded coords
no4 = sizea-abs(no4-sizea);

// sampler coord
vec2 tc = no*bound_is_0_1_3 + no2*bound_is_2 + no4*bound_is_4;

//sample textures
vec4 smp0 = texture2DRect(tex0,tc);
vec4 smp1 = texture2DRect(tex1,sizea-texcoord0);

vec2 outbound = sign(floor(no/sizea));//check for point>size
float boundchk = float(sign(float(outbound.x!=0.)+float(outbound.y!=0.)));
float checkm0 = bound_is_0*boundchk;
float checkm1 = bound_is_1*float(boundchk==0.);
vec4 ifb0 = mix(smp0,smp1,checkm0);//ignore
vec4 final = ifb0*bound_not_1 + ifb0*float(checkm1==1.);//clear

// output texture
gl_FragColor = final;
}
]]>

wes

#95412
Feb 3, 2007 at 7:19pm

On Feb 3, 2007, at 10:57 AM, joshua goldberg wrote:

> i’ve now tried both the old version and the new version and i still
> get black.
> anyone out there with my model powerbook able to confirm my problem?

Here’s the one that works on the radeon mobility cards in your
machine (and basically nothing else). If it still doesn’t work, you
might need to add some typecasts to work with the 10.4.3 and later
built in GLSL compiler.

Would recommend you save to disk renaming td.rota.radeon9700.jxs or
something.

If you don’t care about all the boundmode logic, it’s easy to make
one that works everywhere. We mostly provide these shaders as
examples, rather than guaranteed functionality across all HW, so I’d
recommend you get your hands dirty with learning how to code shaders
if you want to make sure you can get them working on whatever machine
you see fit.

Good luck.

-Joshua



shader to approximate jit.rota on GPU








< ![CDATA[

varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
varying vec2 texdim1;
varying vec2 texorient0;
varying vec2 texorient1;
varying vec2 no;
varying float bound_is_0;
varying float bound_is_1;
varying float bound_is_2;
varying float bound_is_3;
varying float bound_is_4;
varying float bound_is_0_1_3;
varying float bound_not_1;

uniform vec2 zoom;
uniform vec2 offset;
uniform float theta;
uniform vec2 anchor;
uniform int boundmode;

void main()
{
// perform standard transform on vertex
gl_Position = ftransform();

// transform texcoords
texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
// extract the x and y scalars from the texture matrix to
determine dimensions
texdim0 = vec2 (abs(gl_TextureMatrix[0][0][0]),abs
(gl_TextureMatrix[0][1][1]));
texdim1 = vec2 (abs(gl_TextureMatrix[1][0][0]),abs
(gl_TextureMatrix[1][1][1]));
// extract the sign for orientation
texorient0 = vec2 (gl_TextureMatrix[0][0][0]/
texdim0.x,gl_TextureMatrix[0][1][1]/texdim0.y);
texorient1 = vec2 (gl_TextureMatrix[1][0][0]/
texdim1.x,gl_TextureMatrix[1][1][1]/texdim1.y);

// perform rota transform (since linear, more efficient to do in
vertex program)
mat2 sca = mat2 (1./zoom.x,0.,0.,1./zoom.y);//scaling matrix (zoom)
mat2 rot = mat2 (cos(theta),sin(theta),-sin(theta),cos(theta));//
rotation matrix
no = ((((texcoord0-anchor*texdim0)*rot)*sca)+anchor*texdim0)+offset;

// setup our boundmode boolean scalars to reduce fragment program
instruction count
bound_is_0 = float (boundmode==0);
bound_is_1 = float (boundmode==1);
bound_is_2 = float (boundmode==2);
bound_is_3 = float (boundmode==3);
bound_is_4 = float (boundmode==4);
bound_is_0_1_3 = float ((boundmode==0)||(boundmode==1)||
(boundmode==3));
bound_not_1 = float (boundmode!=1);

}

]]>

< ![CDATA[

//setup for 2 texture
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
varying vec2 no;
varying float bound_is_0;
varying float bound_is_1;
varying float bound_is_2;
varying float bound_is_3;
varying float bound_is_4;
varying float bound_is_0_1_3;
varying float bound_not_1;

uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
const float pi=3.1415926;

void main()
{
// where is the point?
vec2 sizea = texdim0;

//create boundmodes
vec2 no2 = mod(mod(no,sizea)+sizea,sizea);//wrap

vec2 no4 = mod(abs(no),sizea*2.);//folded coords
no4 = sizea-abs(no4-sizea);

// sampler coord
vec2 tc = no*bound_is_0_1_3 + no2*bound_is_2 + no4*bound_is_4;

//sample textures
vec4 smp0 = texture2DRect(tex0,tc);
vec4 smp1 = texture2DRect(tex1,texcoord1);

vec2 outbound = sign(floor(no/sizea));//check for point>size
float boundchk = float(sign(float(outbound.x!=0.)+float(outbound.y!
=0.)));
float checkm0 = bound_is_0*boundchk;
float checkm1 = bound_is_1*float(boundchk==0.);
vec4 ifb0 = mix(smp0,smp1,checkm0);//ignore
vec4 final = ifb0*bound_not_1 + ifb0*float(checkm1==1.);//clear

// output texture
gl_FragColor = final;
}
]]>

#95413
Feb 3, 2007 at 7:26pm

this one works! THANKS GUYS!

On Feb 3, 2007, at 2:19 PM, Joshua Kit Clayton wrote:

>
> On Feb 3, 2007, at 10:57 AM, joshua goldberg wrote:
>
>> i’ve now tried both the old version and the new version and i
>> still get black.
>> anyone out there with my model powerbook able to confirm my problem?
>
>
> Here’s the one that works on the radeon mobility cards in your
> machine (and basically nothing else). If it still doesn’t work, you
> might need to add some typecasts to work with the 10.4.3 and later
> built in GLSL compiler.
>
> Would recommend you save to disk renaming td.rota.radeon9700.jxs or
> something.
>
> If you don’t care about all the boundmode logic, it’s easy to make
> one that works everywhere. We mostly provide these shaders as
> examples, rather than guaranteed functionality across all HW, so
> I’d recommend you get your hands dirty with learning how to code
> shaders if you want to make sure you can get them working on
> whatever machine you see fit.
>
> Good luck.
>
> -Joshua
>
>
>
>
> shader to approximate jit.rota on GPU
>

>

>

>

>

>

>

>

>
>
>
>
>
>
>
>
>

> < ![CDATA[
>
> varying vec2 texcoord0;
> varying vec2 texcoord1;
> varying vec2 texdim0;
> varying vec2 texdim1;
> varying vec2 texorient0;
> varying vec2 texorient1;
> varying vec2 no;
> varying float bound_is_0;
> varying float bound_is_1;
> varying float bound_is_2;
> varying float bound_is_3;
> varying float bound_is_4;
> varying float bound_is_0_1_3;
> varying float bound_not_1;
>
> uniform vec2 zoom;
> uniform vec2 offset;
> uniform float theta;
> uniform vec2 anchor;
> uniform int boundmode;
>
> void main()
> {
> // perform standard transform on vertex
> gl_Position = ftransform();
>
> // transform texcoords
> texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
> texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
> // extract the x and y scalars from the texture matrix to
> determine dimensions
> texdim0 = vec2 (abs(gl_TextureMatrix[0][0][0]),abs
> (gl_TextureMatrix[0][1][1]));
> texdim1 = vec2 (abs(gl_TextureMatrix[1][0][0]),abs
> (gl_TextureMatrix[1][1][1]));
> // extract the sign for orientation
> texorient0 = vec2 (gl_TextureMatrix[0][0][0]/
> texdim0.x,gl_TextureMatrix[0][1][1]/texdim0.y);
> texorient1 = vec2 (gl_TextureMatrix[1][0][0]/
> texdim1.x,gl_TextureMatrix[1][1][1]/texdim1.y);
>
> // perform rota transform (since linear, more efficient to do in
> vertex program)
> mat2 sca = mat2 (1./zoom.x,0.,0.,1./zoom.y);//scaling matrix (zoom)
> mat2 rot = mat2 (cos(theta),sin(theta),-sin(theta),cos(theta));//
> rotation matrix
> no = ((((texcoord0-anchor*texdim0)*rot)*sca)+anchor*texdim0)+offset;
>
> // setup our boundmode boolean scalars to reduce fragment program
> instruction count
> bound_is_0 = float (boundmode==0);
> bound_is_1 = float (boundmode==1);
> bound_is_2 = float (boundmode==2);
> bound_is_3 = float (boundmode==3);
> bound_is_4 = float (boundmode==4);
> bound_is_0_1_3 = float ((boundmode==0)||(boundmode==1)||
> (boundmode==3));
> bound_not_1 = float (boundmode!=1);
>
> }
>
> ]]>
>
>

> < ![CDATA[
>
> //setup for 2 texture
> varying vec2 texcoord0;
> varying vec2 texcoord1;
> varying vec2 texdim0;
> varying vec2 no;
> varying float bound_is_0;
> varying float bound_is_1;
> varying float bound_is_2;
> varying float bound_is_3;
> varying float bound_is_4;
> varying float bound_is_0_1_3;
> varying float bound_not_1;
>
> uniform sampler2DRect tex0;
> uniform sampler2DRect tex1;
> const float pi=3.1415926;
>
> void main()
> {
> // where is the point?
> vec2 sizea = texdim0;
>
> //create boundmodes
> vec2 no2 = mod(mod(no,sizea)+sizea,sizea);//wrap
>
> vec2 no4 = mod(abs(no),sizea*2.);//folded coords
> no4 = sizea-abs(no4-sizea);
>
> // sampler coord
> vec2 tc = no*bound_is_0_1_3 + no2*bound_is_2 + no4*bound_is_4;
>
> //sample textures
> vec4 smp0 = texture2DRect(tex0,tc);
> vec4 smp1 = texture2DRect(tex1,texcoord1);
>
> vec2 outbound = sign(floor(no/sizea));//check for point>size
> float boundchk = float(sign(float(outbound.x!=0.)+float(outbound.y!
> =0.)));
> float checkm0 = bound_is_0*boundchk;
> float checkm1 = bound_is_1*float(boundchk==0.);
> vec4 ifb0 = mix(smp0,smp1,checkm0);//ignore
> vec4 final = ifb0*bound_not_1 + ifb0*float(checkm1==1.);//clear
>
> // output texture
> gl_FragColor = final;
> }
> ]]>
>
>

>
>

#95414

You must be logged in to reply to this topic.