Jump to content

  • Log In with Google      Sign In   
  • Create Account

2D With direct3d...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 DevLiquidKnight   Members   -  Reputation: 834

Like
Likes
Like

Posted 24 February 2004 - 09:32 AM

I was wondering... I made a small engine that is purely 3D but sense calculation collisons tends to be a pain in 3D, I was wondering if anyone had some good resources (links) on using direct3D to create 2D based applications. Im kinda familiar with the Direct3D stuff now and was hoping to make a tile based 2D engine using direct3d. I reverted my game engine that I had in 3D and tried to make it so it loads a 256x256x5 tile map 5 being used as depth to have like.. cliffs and stuff , I am trying to come up with how to make the tile-based concept work with direct3d. Ive done it in DirectDraw awhiel back it wasn't to complicated but I've found its a bit differnt when using direct3d and was hoping anyone had some links of information and stuff besides gamedev.net on this concept. Main problem im kinda having is using the vertex buffers, I've used them before to make like particle systems but I'd like to find how to correctly use them with a tile based game in direct3d? If anyone has any information on that.. Im assuming its the same, however I have also read about index buffers and I have no clue how those work... But would you be rendering to the view matrix or no? stuff like this im confused with... if anyone has any information it would be greatly appreicated! [edited by - DevLiquidKnight on February 24, 2004 4:37:11 PM]

Sponsor:

#2 TreborZehn   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 February 2004 - 10:52 AM

You can find help here under "DirectX"

edit: couldn't get the link thing working so I'll just spell it out.

http://www.gamedev.net/reference/list.asp?categoryid=24

Basic idea is to form a "quad" (i.e. two triangles) and texture it.

I've heard you can also use D3DXSprite but haven't seen a good tutorial on that (I don't know why, maybe someone else can answer that?)

[edited by - TreborZehn on February 24, 2004 5:53:06 PM]

[edited by - TreborZehn on February 24, 2004 5:54:09 PM]

#3 fyhuang   Members   -  Reputation: 253

Like
Likes
Like

Posted 24 February 2004 - 11:13 AM

D3DXSprite is actually pretty easy:

D3DDevice is an initialized D3D device object.
TestTexture is an initialized texture object.
TestRect is a RECT that contains the source coordinates for D3DXSprite to draw.

To initialize:

LPD3DXSPRITE MainSprite;

D3DXCreateSprite( D3DDevice, &MainSprite );

And then, to draw:

MainSprite->Begin();

MainSprite->Draw( TestTexture (texture), &TestRect (source RECT), &D3DXVECTOR2( scalex, scaley ) (scale), NULL (rotation center (D3DXVECTOR2)), 0.0 (rotation amount), &D3DXVECTOR2( posx, posy ) (position), D3DCOLOR_RGBA( r, g, b, a ) (color) );

MainSprite->End();

#4 DevLiquidKnight   Members   -  Reputation: 834

Like
Likes
Like

Posted 24 February 2004 - 11:59 AM

Intresting never heard about d3dxsprites.... What type of things do they do and exaclty what are they used for? Just 2D stuff? or what eaxctly? can u do like animation sequences and stuff with them for 2D Direct3D stuff?

[edited by - DevLiquidKnight on February 24, 2004 7:02:25 PM]

#5 reana1   Members   -  Reputation: 277

Like
Likes
Like

Posted 24 February 2004 - 01:28 PM

Well, I'm sort of at the same stage of learning as you and I made a list of links for my brother to read over that might help you too.

I've number them in the order I think I'd read them. Alot are numbered the same since they are kind of the same level, but just tell different ways of doing stuff. #2 is a very good article I think (though it starts with the complete basics).

(3) 2D Programming in a 3D World: Developing a 2D Game Engine Using DirectX 8 Direct3D
This shows how to use the ID3DXSprite interface in DX 8 and good explanation of how things have changed for 2D programmers after DX 8. However, it's probably more useful for those who either never want to use 3D or who are used to the old way.

(5) Direct3D8 Sprite Wrapper
It has white text on white background so you have to select everything to see it. This is similar to the previous one and is a wrapper for Direct3D8 to act like DirectDraw7 but still using ID3DXSprite.

(5) Dissecting Sprites in Direct3D
This is another sort of wrapper I think, but doesn't use ID3DXSprite. I think it instead sort of rewrites it. (I haven't read it yet.)

(5) Using Direct3D For 2D Tile Rendering
This one actually seems to use Direct3D, but is based on DX7. It focuses on tile-based isometric rendering, which may be what we want. (I haven't read it yet.)

(5) Introduction To Isometric Engines
Another Isometric article which may be useful for us. It is at more of a higher level and doesn't get into any of the details of which API to use. (I haven't read it yet.)

(5) Isometric Engines: Are they for you?
Looks nice. More articles on the main site too, though they're all fairly old. (I haven't read it yet.)

(5) More tile-based and Isometric articles
(I haven't read it yet.)

(5) 2D Rendering in DirectX 8
This shows how to use the real D3D interface (same as you would use for 3D) to do 2D graphics. (I haven't read it yet.)

(5) 2D in Direct3D using Textured Quads
This also shows how to use the real D3D interface (same as you would use for 3D) to do 2D graphics (written for DX 9). (I haven't read it yet.)

(4) DirectX 8 Graphics and Video: A Fresh Start
This looks like good background on how DX 8 is organized and how to work with it. (I haven't read it yet.)

(4) Starting Direct3D9: Setting Up a Window
This covers the basics of getting started in DirectX programming for DX9. (I haven't read it yet.)

(4) DirectX-tasy
This is sort of the history of DX and more on how it's organized, and it might be good for understanding DX in general. It's by LaMothe, but it's old (DX 5). (I haven't read it yet.)

(6) A DirectX Game: Tetris
A complete example with some explanations for making a 2D DX 8 game. It uses a wrapper to the DirectDraw7 interface though, but still may be useful to see how they organize things. (I haven't read it yet.)

(2) Game Programming Genesis series (parts 1-10)
This looks like a good (thorough) discussion of game design. It may help with figuring out how to organize a graphics manager. Some of the details (like DirectDraw) we can probably just skim over, but I'm pretty sure the general discussions are still applicable. (I haven't read it yet.)

(1) Striving For Graphics API Independence (parts 1-4)
This looks like it might be a good option for how to do a GM. He mentions using the COM interface as another option (which some of the DX overview articles above talk about (and I know MSDN does to). So this and COM stuff are probably what we need to read for figuring out how to organize the GM. Although, there may be other options out there too. (I haven't read it yet.)

(6) Magmai Kai Holmlor's Krude ATL COM tutorial
Not sure, but it's an alterative to the "Striving For Graphics API Independence" method. (I haven't read it yet.)

(6) XEngine - The Platform- and API-Independent 3D Engine
An Open-source engine. There are docs and code which might be a good example for us, but it is 3D.

Some links to people asking questions we're interested in:
clicky
clicky
clicky
clicky
clicky
clicky
clicky
clicky
clicky
Not all of these are great (but some are!). They generally have good, related discussions I think, though.

Edit: fixed links
Tadd
- WarbleWare

[edited by - reana1 on February 24, 2004 8:33:39 PM]




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS