What does ofDisableArbTex() do?


#1

It seems that built-in 3d mesh objects doesn’t map textures properly without disabling ArbTex();

As far as I understood, arbTex has to do with normalisation of texture coordinates.
If the default state is ofEnableArbTex(), why do 3d objects use texture coordinates that doesn’t match with the default state so one needs to disable it?

Is there any way to make mesh’s texCoords to use default ArbTex which is unnormalised?


#3

ofDisableArbTex has a confusing name, it should be called ofDisableRectTex or something like that. By default OF uses rectangular textures instead of 2D textures (the default in opengl). That’s like that for legacy reasons: rectangular textures used to be the only way to support non power of 2 sizes in textures, in old hardware you couldn’t create textures unless their size was something like 256 or 512… but you could do so with rectangular textures. as a side effect rectangular textures have pixel coordinates instead of normalized ones.

in nowadays graphics cards using 2d textures doesn’t limit the size so it’s totally ok to always disable rectangular textures by default and if you are going to use textures to map 3d objects it’s recomended to do so

we can’t disable rectangular textures by default in OF cause that would break old projects in weird ways that would be hard to detect.


#4

Thank you so much @arturo
Now I understand :slight_smile: