Sign in to follow this  

Multiple Quads with Direct3D 8 - Which Method is More Efficient? (SOLVED)

Recommended Posts

I have yet another 'method' question, which pertains to drawing multiple quads at a given time. I have a background which is 398x170px (512x256px w/padding), and with it I am tiling it across the screen (400x300px). What I'm looking for is the most efficient method to draw multiple backgrounds at once. So far, I've come up with two methods: 1) I draw each background image as a simple quad with D3DPT_TRIANGLESTRIP using IDirect3DDevice8::DrawPrimitiveUP. This means that there are only four points per quad, and there are multiple calls to DrawPrimitiveUP. 2) I draw all the backgrounds using D3DPT_TRIANGLELIST. This means that there are six points per quad, which involves calling std::vector::resize() (along with copying), and only one call to DrawPrimitiveUP. I am not sure about this, because I remember seeing somewhere that you should limit the number of calls you make to DrawPrimitive() because it will slow your program down some. However, when I examine the FPS in each of the tests (using QueryPerformanceCounter()), scenario #1 goes up to around 134 FPS while I only saw scenario #2 go up to about 124 FPS (please note that there is other stuff going on). Do these seem right? EDIT: If scenario #2 is faster, I'll probably be using to draw 'tile groups' (Tiles are smaller sections of backgrounds). EDIT: Yet again do I feel the fleeting of intelligence. After a little more testing, I discovered that Method #2 is in fact, more efficient than Method #1, at least when tiling many many small images. I figured out that I could tell any obvious differences when testing a large image, so I made a small, 15x15 image and had it tile that with both methods. Method #1 averaged around 70-85 FPS while Method #2 averaged close to the same speed as it was with the large image (90-100 FPS, the above measurements were actually made when only drawing one backgorund, heh). Learning experience, anyone? [Edited by - deadimp on July 19, 2005 1:39:04 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this