GPWiki.org
GPWiki.org
It is currently Wed May 22, 2013 5:14 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Apr 01, 2009 1:17 pm 
Level 22 Norse Warrior-Librarian

Joined: Sun Mar 04, 2007 5:08 pm
Posts: 525
Location: Perth w.a.
I didn't know where to put this post.

In directx,when drawing to the screen you call the BeginScene() method,
for sprites you need to call the Begin() method seperatly and within the BeginScene block.

MY question is do you have to call the Sprites Begin() method only once or does every single instance of a sprite need to call it individually?

Like,
Code:
d3ddev->BeginScene(); // Enter scene blitting.

myBackground->d3dspt->Begin(NULL);
// ... do stuff with background...

myShip->d3dspt->Begin(NULL);
// ... do stuff with ship ...

myCloud->d3dspt->Begin(NULL);
// ... do stuff with cloud ...


?

I also have this class,
Code:
class MySprite{
public:

                // the pointer to our Direct3D Sprite interface
   LPD3DXSPRITE d3dspt;

                // the pointer to the sprite
   LPDIRECT3DTEXTURE9 sprite;
};


Is it viable to have each instance of class MySprite contain the pointer to
directx's sprite interface,or should I only have one such pointer?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 3:50 pm 
Funky Monkey

Joined: Mon Aug 16, 2004 2:48 pm
Posts: 1604
Location: Minneapolis, MN USA
My experience has been that you only need 1 instance of the Sprite interface, and you treat it similar to a device-within-the-device.

So, you try to have as few Sprite.Begin/Sprite.End pairs are you can.

If you can draw all of your sprites at once, then you only need a single Being/End pair.

If, however, you need to draw some sprites ... draw some 3D stuff ... draw some more sprites, then you may need additional Begin/End blocks for the Sprite interface.

HTH,
-Bryk

_________________
www.mwgames.com ... Dicey Curves, Space Mission, Jump Gate, Gem Raider, DareBase, Castle Danger, Keeps & Moats Chess


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 11:58 pm 
Okay,thanks Bryk.

hugh


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group