Jump to content
  • Advertisement

Archived

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

HexDump

2D in DX9 What is the way to go.

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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 matrix
D3DXMATRIX 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 this post


Link to post
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 this post


Link to post
Share on other sites

  • 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!