Archived

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

2D in DX9 What is the way to go.

Recommended Posts

Hello guys, I have read some dx9 info and I have seen that you can use ddraw methods in dx9. The thing is, what should be the way to go for my upcoming GUI rendering, billboards or render with directdraw? If you think direct draw is the right decision is it dificult to use with d3d?. Thanks in advance. HexDump.

Share on other sites
You can''t use DirectDraw in D3D. D3D does have some similar function calls to DD, but I haven''t found them particularly useful compared to the other stuff D3D can do.

So use billboards, but that''s probably not the correct term for them. Billboards are usually objects in some sort of 3D environment. For a GUI you would probably use transformed quads. (which I think is what you meant anyway).

- Fuzz

Share on other sites
Just have all of your verticies in screen-space coords. This is what I do and is also whatCrazed Genius has suggested.

Dwiel

Share on other sites
I suggest to use D3D, using textured quads as sprites, alpha channel as color key. And geometry pipeline is something that you can't miss. It allows your 2D game to be resolution independent. How cool is that!

Doing 2D with D3D will also make your life easier when you decide moving to 3D.

throw Exception( "End of post" );

[edited by - alnite on March 18, 2003 1:22:19 PM]

Share on other sites
quote:
And geometry pipeline is something that you can''t miss. It allows your 2D game to be resolution independent

Know any good tutorials on that subject? I''ve been messing with a 2D GUI using D3D for some time now. For instance, I''m using textured quads to display text. To save some time, I would want to render stuff like text and misc. graphic to a another texture/surface (lets call it surface X), and then render X to the screen. This should save a lot of time since rendering one large surface is much faster than rendering several smaller ones. Besides, X only has to updated when its contents change. Problem is that I can''t get it to work properly, the things I render to X become garbled. But if I render the text directly to the screen, they look ok. So.. does anyone know of a tutorial that covers this topic as well?

Regards / Fyyar

Share on other sites
Also, it sometimes easier to just use DrawUserPrimatives (or is it DrawPrimativesUP?) when doing 2d because making a vertex buffer for a single quad is kinda pointless/bad.

Share on other sites
quote:
Original post by Fyyar
Know any good tutorials on that subject?
Unfortunately, I don''t have any. I read it from "Focus on 2D in Direct3D."
Here''s the way I do it:
// set Projection matrixD3DXMATRIX tmatProj;D3DXMatrixIdentity(&tmatProj);tmatProj._22 = -( 2.0f / (float) TILECOUNT_VERTICAL );tmatProj._11 = -tmatProj._22 * .75f;tmatProj._41 = -1.0f;tmatProj._42 = 1.0f;pD3DDevice->SetTransform( D3DTS_PROJECTION, &tmatProj );
where TILECOUNT_VERTICAL is the maximum number of tiles you want to display on the vertical axis (y axis), assuming that each tile is 1.0 width and 1.0 height.

So, let''s say, you want to see 20x15 tiles on the screen, you use 15 for TILECOUNT_VERTICAL.

Current project: 2D in Direct3D engine.
% completed: ~20%

Share on other sites
Thx! Btw, do you recommend that book?

Share on other sites
quote:
Original post by Fyyar
Btw, do you recommend that book?
Totally.

Current project: 2D in Direct3D engine.
% completed: ~20%

Share on other sites
quote:
Original post by Pseudo
Also, it sometimes easier to just use DrawUserPrimatives (or is it DrawPrimativesUP?) when doing 2d because making a vertex buffer for a single quad is kinda pointless/bad.

If he''s doing a tile based game it''s a good idea to put all tiles in the same texture, and then draw the whole playfield with one call to DrawPrimitive, rather than using the slow UP method. Not sure if it''s worth using when drawing single quads though.

quote:
Original post by Fyyar
Thx! Btw, do you recommend that book?

It''s a good book to get started with, but don''t copy too much of the code samples as the author is not that concerned about speed (IMHO).

• Forum Statistics

• Total Topics
628327
• Total Posts
2982088

• 22
• 9
• 9
• 13
• 11