Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / most efficient way to resize a texture? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
JaggedLittlePixel

May 10, 2005, 11:51 AM

Hi,

I want to resize a texture on the GPU (using DirectX). I can think of two ways to do this:

A) StretchRect
B) Do the stretching by texturing an appropriately sized quad

Just out of interest, does anyone know which of A) and B) is actually more efficient?

Thanks in advance,
JLP

 
Scali

May 10, 2005, 12:08 PM

Assuming you disable zbuffer, stencil, alphablend/test shading and useless texturefiltering options, there should be little or no difference between StretchRect and rendering a quad on most hardware (it's a bandwidth-limited operation)... StretchRect may have slightly less overhead though, so you may notice something on small textures.. But I never bothered to benchmark that.

Note also that using the quad is far more flexible, because StretchRect is limited to a small set of source/destination surfaces and filtering options.

NVIDIA recommends using a single triangle by the way, set up so that it covers the whole screen. This is more efficient than a quad, especially with AA, because there's no edge on screen that requires extra processing. But that probably doesn't apply to what you want to do.

 
JaggedLittlePixel

May 10, 2005, 12:28 PM

Hi Scali & thanks for your quick reply,

The triangle trick is really neat but will indeed not work for what I want to do.

What extra processing would an on screen edge produce anyway? Do you mean clamping?

thanks,
JLP

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.