Jump to content
  • Advertisement

Archived

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

Hedos

2d engine with textured quads, in DirectX9

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

Hey, I''m trying to build a small 2d engine for my 2d game.. I''ve made 2d games using openGL but I have now decided to switch to DirectX.. and I''m now trying to find a good way to draw in 2d.. I''ve looked at the tutorials on gamedev.net, some of them received kinda bad comments as they don''t teach a really fast way to draw 2d quads.. Right now I''m kinda confused between all the different way to do what I want to do... so I would like to hear the opinion of experimented people about what is the best way they found to do 2d. Also, if anyone know a tutorial where a good technique is taught, I would be really happy to know it Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
Well, when I first started doing this (only like 4 months ago, but meh) I started with tranformed vertices. Though interesting turned out to be rather unintelligent since I had to rewrite the vertex buffer (vb) every frame.

So now, I use 3D Coordinates and use some basic trig to set the camera back and render everything on the plane z=0. But using this you position by units, not pixels, so it''s a little different from normal 2D, but not much. (Keep forgetting +y means up... though I guess I could switch it.. but meh)

This works for 2D since you set the the camera back so far back (depending how many units high you want the screen) and position the camera above the point you want to see on the xy plane and have it positioned at the same point on the xy plane (thus the camera vector is perpindicular to what you''re drawing on so it all looks flat).

Hope this doesn''t sound confusing. anyway.

This worked alot faster, plus I got some benefits of shaders and camera effects (ZOOM IN... oooh) Yeah, didn''t take much to impress me. Best of luck...

Share this post


Link to post
Share on other sites
Thanks for the reply

Actually, I''m using OrthoLH and this works fine since it allows me to work with pixels instead of units..

But I don''t understand why switching to this 3d mode allowed you to avoid having to "rewrite the vertex buffer (vb) every frame"..


Right now I''m a little bit confused with this Vertex Buffer stuff and I don''t really know what would be the best thing to do..

I''m currently using this article: www.gamedev.net/reference/articles/article1946.asp
And using "Example #2: Optimizing Example #1"..
But since it has to lock/unlock every frame, it doesn''t look that good..
And I don''t think I really need the advantages of this lock/unlock since I won''t really need to ever modify the size/position of the vertices inside my VB..

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!