GL arbfp1 programs

· by Steve · Read in about 2 min · (273 Words)

bad_camel, the lucky owner of a GeForceFX and a linux user, raised an issue late last night about the cel shader not looking right on his machine. Unfortunately, because my dev boxes don’t have ARB_fragment_program capable cards (because arbfp1 is equivalent to ps_2_0, and my cards only support ps_1_x) I haven’t been able to test the cel shader in GL yet.

Luckily my wife’s machine has an ATI 9500 Pro in it, kindly donated by ATI a while back so I used that for a bit of testing, and it turns out that GL does not like you sampling a 2D texture with a 1D texture coordinate. D3D is quite happy with that, and I’m sure that I’ve read somewhere that if you sample a texture at a lower dimensionality, it assumes the other coordinates are 0, but maybe not. Anyway, although I can hack it in arbfp1 by turning the 1D texture coords into 2D, ps_1_x does not allow that so I actually have to use genuinely 1D textures. I didn’t do this before because loading 1D textures has not really been tested before; and sure enough, the connection code isn’t really there to make it work even though the lower level code understands 1D textures.

So I’ve added a new field on to the ‘texture’ attribute in material scripts, you can now say ‘1d’, ‘2d’ or ‘cubic’, with ‘2d’ being the default. ‘texture something.png cubic’ is equivalent to ‘cubic_texture something.png combineduvw’. Note that I did not use ‘3d’ because as _mental_ pointed out to me, 3d textures are a different animal entirely, they are volume textures which we don’t support yet.