Archived

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

Mike

Using Direct3D in 2D...

Recommended Posts

I believe you still need to set up the viewport (in D3D 6.x) but the projection matrices don't really matter if you draw translated vertices. (D3DTLVERTEX) You can also skip the materials and lights with this vertex type. (you just specify the color with D3DRGBA(), but remeber the color values are from 0-1 for each component, ex. D3DRGBA(1,1,1,1) is white with full alpha)

Share this post


Link to post
Share on other sites
I would like to use Direct3D Immediate Mode in my 2D game in order to handle the alpha blending. I’m quite familiar with Direct Draw, but I’ve never used Direct3D. Generally speaking I would an outline as to what one would need to do in order to use Direct3D for alpha blending (and possibly light maps). Here is what I’ve got so far:

Setup

1. Of course I need to create all the global variables and include the needed libraries.
2. First I need to Create a direct draw object
3. Then create a primary surface
4. Now create a Direct3D object
5. Finnish Direct Draw setup (cooperative level, display mode, etc…)

Using it

1. Draw all Direct Draw stuff first.
2. Set the Direct3D object’s texture.
3. Call draw primitive (with the vertices that I’ve kept track of)

So far that is all I’ve pieced to gather. Do I really need to go through the trouble of setting up the view port and all the other 3D things if my only intent is to use Direct3D to draw an alpha blended primitive? I would appreciate any more information on the subject.

Share this post


Link to post
Share on other sites