2D in DX9? Where's DirectDraw?

Started by
12 comments, last by deadimp 19 years, 4 months ago
Ok, I've never really programmed properly in DirectX before, at least not in years. Now, I'm making a light simulator in Java, but it runs terribly slow on my P3-800. So I want to use DirectX9, but there seems to be no DirectDraw. All the beginners articles seem to be a few years out of date here and I don't really want to revert to DX7. My simulator involves propogating "light balls" inside a room. I will have +30000 balls on the screen at any given time. I asked a peer and he said to describe a circle with vertices and project it on a plane in 3D to simulate 2D, but the retardedness of that seems too outstanding to be the only solution. Any suggestions?
Advertisement
DirectX 9 has the nice ID3DXSprite function, which should suit any of your 2D graphics needs. There's very little setup involved.
DirectDraw is indeed no longer being worked on. You can still use it with the 9.0c SDK, however.

As far as 2D with Direct3D, you have two options:
1. Using pre-transformed vertices. These don't go through the rendering pipeline, so when you set their position to 1, 1, they literally go at 1,1 on the screen.

2. Create an orthographic projection. This basically removes depth from the scene and allows for 2D. This is what I use in my tile engine. Since you sound like you want to perform custom lighting, this is probably the best best. Avoid using the ID3DXSprite interface though because you don't have access to the vertices and won't be able to modify their lighting values manually. Atleast, I think that's what you want to do.
DirectPlay and DirectDraw have been deprecated and are no longer supported.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                          
Looking for video game music? Check out some of my samples at http://www.youtube.c...ser/cminortunes            
                                                          
I'm currently looking to create music for a project, if you are interested e-mail me at cminortunes@gmail.com    
                                                          
Please only message me for hobby projects, I am not looking to create music for anything serious.
Thank you for the replies.
Mucca, you say "DirectX 9 has the nice ID3DXSprite function", is that a slow call? Because, I will need to call it +30000 times per frame.

Grozzler, you said, "Using pre-transformed vertices. These don't go through the rendering pipeline". This sounds good because I don't want to render 30000 objects in 3D, but I do want to translate their position. Would this be my best bet then? "Create an orthographic projection. This basically removes depth from the scene and allows for 2D." Would this be much slower than pre-transformed vertices? If not, what method calls do I use and what params do I pass?
Sorry, Grozzler, I forgot to mention somthing. I will not be using lighting. By "light balls" I mean that I am simulating the motion of balls bouncing around in a box. They simply represent light. I'm doing this because I don't understand the theory of relativity and this program has helped me to understand how time slows down and how objects compress in their direction of motion.

As for the lighting aspect, I simply want every object to be aluminated the same amount. I.E. not lighting effects. Simply ambience (I think).
There IS a direct draw, even though it's not supported anymore. There are tons of tutorials on the subject, and there's no reason why you can't use direct draw if it satisfies your needs in your game. Remember DirectX is backwards compatible. The final DirectDraw version was in DirectX7 I beleive, and it any user can play your game as long as they have a version of DirectX7.0 or later (including DirectX9.0c).
Quote:Original post by LateMage
Sorry, Grozzler, I forgot to mention somthing. I will not be using lighting. By "light balls" I mean that I am simulating the motion of balls bouncing around in a box. They simply represent light. I'm doing this because I don't understand the theory of relativity and this program has helped me to understand how time slows down and how objects compress in their direction of motion.

As for the lighting aspect, I simply want every object to be aluminated the same amount. I.E. not lighting effects. Simply ambience (I think).


If that's the case, use ID3DXSprite. It will setup your orthographic projection matrix for you and is incredibly easy to use.
*Yawn*
you dont like me Pipo?

This topic is closed to new replies.

Advertisement