declaration:
switch_default_scalemode(scalemode) => nil
This overrides the global state scalemode used when creating textures. Allowed values are defined by the constants below:
SCALE_NOPOW2 -- Use whatever size the source image defines
SCALE_POW2 -- Scale and filter image to fit a pow2 resolution. This is costly, and damaging to the quality of the texture.
SCALE_TXCOORD -- Pad texture to a pow2 resolution, but only tweak the texture coordinates used. This may have effect on mipmapping but also on scripts that rely on texture coordinate manipulation.
related functions:
[switch_default_texmode][switch_default_imagemode]
caveats:
Each image tracks its own mode that's copied from the current default upon creation (no push/pop/launch option should change this).
This function may severely reduce the number of devices/systems that the script will behave properly on.
For frameserver- and other dynamic sources, SCALE_POW2 may not currently work.
notes:
Accurately sizing textures plays a large part in virtually everything in the graphics pipeline. Historically, consumer-level 3D accelerators have forced them to be sized in powers of 2 (128,256,512,..) as this simplified the implementation of the higher level graphics APIs (e.g. OpenGL).
Unfortunately, not all implementations do this correctly -- some cause degraded performance or image quality, some wastes memory and it is unfortunately somewhat up to the user to be able to tweak (that's why the default can be set through the command-line).
Wiki: Video Functions
Wiki: switch_default_imageproc
Wiki: switch_default_texmode