A general question: I've always used sampler2D; what, generally, are the circumstances where you'd use sampler2dRect?

Sampler2D requires a texture to be a square, with power-of-two dimensions. (I think mismatched powers of two work as well, like 256x512, but I may be mistaken). With "square" Power-of-two textures, texture coordinates are normalized (0 to 1). If you feed a non-power- of-two texture, QC will power-of-two-ify it (in the sampler composition passed around, the image is something like 604x400. QC resized it to 512x512, making it a bit fuzzy).

Sampler2DRect does not require power-of-two dimensions. It allows arbitrary dimensions, so QC won't resize the image at all. This makes texture coordinations non-normalized (instead of 0-1, they're 0- dimension), which can mess up shaders that expect texcoords to be normalized.

If you want your images to not be resized by QC, sampler2DRect can help you out.

Back in the olden days, rectangular textures were more expensive for the GPU to deal with. As far as I've seen, this isn't the case anymore, but if you google around you might find folk wisdom that says to avoid non-power-of-two textures.

--
[ christopher wright ]
[email protected]
http://kineme.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to