Archived

This topic is now archived and is closed to further replies.

D8 questions (a bunch of quick ones)

This topic is 5651 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

Just started with DX8 and so far its awesome. Here are a couple of questions that I need to clear up. (2d game) 1. I use a texture for my main sprite, and place it using the texture coordinates (0.0f to 1.0f). Now I am a bit unclear about this. How do I know the exact bounds of the screen, since my tex coords start at the centre (0.0f, 0,0f)? I used DDraw before so I could just test bounds using the width and height of the surface. 2. Since I use matrices to do translation and rotation for textures, wouldn''t this be slow? Is there a better method for translation and rotation? 3. Is it a good idea to use action formats? Is it better or worse than doing it as before? (for a simple game) 4. Last question: Do any one have a good tutorial site or source site other than nexe or drunkenhyena or gamedev''s for DX8? Thanks!

Share this post


Link to post
Share on other sites
4) http://www.mvps.org/directx

3) What is an action format?

2) Matrices are fine, they have the advantage of a uniform speed for operations. You can also look into Quaternions, but I would start with matrices. Also I think you are likley transforming your meshes for vertices, not your textures?

1) If you are defining your meshes as follows, you will be using world coordinates:


    
#define FVF_ICEMESH_VERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)


However, you can define your meshes as follows for screen objects; such as a mouse:


        
#define D3DFVF_CV2D_T1D (D3DFVF_XYZRHW | D3DFVF_TEX1)



Check the manual, but the difference is between D3DFVF_XYZRHW AND D3DFVF_XYZ. [/source]

[edited by - sdoherty55 on June 23, 2002 6:47:25 PM]

Share this post


Link to post
Share on other sites
4. Thanks, gonne be living there for a while

3. action formats: I meant action mapping. I tried to write out an explanation of it but can't seem to do it well. So here is a copy and paste from the SDK:

"Using action mapping, you no longer need to make assumptions about the best use of devices and device objects. Instead, your application binds actions to virtual controls wherever possible. Rather than getting data from the x-axis and steering the car to the left or the right accordingly, the application might get data from a virtual control called DIAXIS_DRIVINGR_STEER. Microsoft® DirectInput® assigns the virtual control to a physical control—that is, a device object. It does so by taking into account the application genre, user preferences, information from the device manufacturer, and the user's configuration of the device."


2. "Also I think you are likley transforming your meshes for vertices, not your textures?" Well, all I am doing is applying a matrix (SetTransform) to the D3D device, which I believe applies to the whole screen. And I think this is the wrong way to go about it.

1. I define my custom vertex using the unprocessed flag ->D3DFVF_XYZ

[edited by - CoderX on June 23, 2002 7:10:03 PM]

Share this post


Link to post
Share on other sites
3) If you are new I would skip this for a simple game, Direct input is a big enough pain. Altough, I tend to develop everything for the mouse. Other people may have a different opinion.

2) m_pd3dDevice->SetTransform(D3DTS_WORLD, &matWorld); just sets the state of the object that you are planning to render.

1) If memory serves D3DFVF_XYZRHW vertices have already been processed so if you have a quad a vertice of 100,100, this vertice will be rendered to the screen. As they are absolute.


Share this post


Link to post
Share on other sites