Jump to content
  • Advertisement
Sign in to follow this  
deadimp

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

This topic is 4872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!