• Advertisement
Sign in to follow this  

moving to directx advice please

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

I have a small iso engine and am porting it to directx from GDI... now..From my understanding the way to do this is to create a quad and set it to the size of the screen...texture it...and then draw to that texture just like i would in GDI Am I going wrong here or is this the way to do it in directx 9? i dont want any 3d.

Share this post


Link to post
Share on other sites
Advertisement
The general approach is to take your 2d artwork (tiles, sprites, etc) and load them as textures in d3d. Then for each object on the screen create a quad and texture it with one of your sprite textures. Updating a texture and drawing that texture to the framebuffer each frame will be much slower than using the hardware accelerated pipeline to composite your sprites into the scene. You might use a fullscreen textured quad for something like a background image behind the sprites though.

For an isometric game you have another option for the tiles. You could set up an orthographic projection with the same orientation as the sprites. Then draw square quads for the tiles and they will appear as diamonds due to the transform. Reset to a top down ortho projection and draw your sprites as normal. This allows you to use square textures for the sprites and avoid some of the work of dealing with diamond tiles.

Share this post


Link to post
Share on other sites
ugh..that is so much more work lol.

so for each tile...i would create a new quad...and texture it...ok

then lay em down looking straight down at the quads. i assume i would use some alpha blending to get rid of the area around the diamond then position the quads so that the diamonds line up. yes?

now for scrolling i would have to then remove quads from opposite my move direction and add them in the move direction.

how would this work for layering...normally to get several different things on a tile you would layer the tiles...would i then render another quad on top of the other one...or would i use Sprites for everything but the terrain?

thank you!

Share this post


Link to post
Share on other sites
Since you say you don't want to get into 3D, you should use DirectDraw 7 instead of DirectX Graphics 8 or higher, that way you don't have to get into 3d at all.

DirectDraw and Direct3D used to be 2 different APIs, but for version 8 and up, they have been merged.

Because of this merger, you will have to get into 3D to some degree if you want to use DirectX 8 or 9.

But since your game was made in GDI, you are probably not going to be able to compleletly port it to DirectDraw. Try to creep away from GDI as much as possible. [grin]

Share this post


Link to post
Share on other sites
thanks for the advice...

i have a version working in directdraw but every time i write code i always see...DEPRECATED!!! and that worries me.

should i be worried about this?

you guys are great :D

Share this post


Link to post
Share on other sites
I mean they killed it man...heartless!!! heartless i say!!

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_m/directx/ref/microsoft.directx.directdraw.asp


Warning: Microsoft® DirectDraw® has been deprecated. Deprecated components of Microsoft DirectX® 9.0 for Managed Code are considered obsolete. While these components are still supported in this release of DirectX 9.0 for Managed Code, they may be removed in the future. When writing new applications, you should avoid using these deprecated components. When modifying existing applications, you are strongly encouraged to remove any dependency on these components.

Share this post


Link to post
Share on other sites
I suppose that this is for directx 9 and as you stated they have been merged...but i dont want my apps to be limited by deprecated api...

i can see it now...

my poor app being deprecated right along with direct draw. The future...gotta think about the future!

Share this post


Link to post
Share on other sites
But seriously, if it were me, I wouldn't worry about it, the simplicity and thus lowered development time makes up for the future incompatibilities, but thats just me. [wink]

But if you want some money for this game, or it is very important to you that it works for 253 years to come (exaggeration), then yeah, go the 3d route.

Quote:
Warning: Microsoft® DirectDraw® has been deprecated. Deprecated components of Microsoft DirectX® 9.0 for Managed Code are considered obsolete. While these components are still supported in this release of DirectX 9.0 for Managed Code, they may be removed in the future. When writing new applications, you should avoid using these deprecated components. When modifying existing applications, you are strongly encouraged to remove any dependency on these components.


I don't really know, but I'm sure that microsoft been saying this for years.

Share this post


Link to post
Share on other sites
thanks for the advice forgotten...ill have to mull it over and make my decision.

DirectDraw is sooooooooooo....sooooooooooooooooo...oooo o ... much easier

Share this post


Link to post
Share on other sites
actually i think i might give 3d a try...

/sigh..time to find a book

Share this post


Link to post
Share on other sites
Hello nex7,
If your looking for a book, your might want to try "Focus on 2d in direct3D". This is so far been a very good book learn 2d programming using direct3d. I've worked through the first 3 chapters, and am learning quite a bit on how direct3d draws the 2d primitives, and from what I can tell, it will also teach you how to use textures to draw 2d sprites and backgounds. So goto Amazon or whereever and give this book a try!
Matt

Share this post


Link to post
Share on other sites
And Drunken Hyena's [he's often in the directX forum] tutorials are very straightforward and newbie friendly.

And having used both, using d3d9 is by far easier and simpiler than directdraw ever was. Or at least once you get over the fairly steep 1-2 week learning curve, and encapsulate the d3d stuff into your own class[es].

Share this post


Link to post
Share on other sites
do you guys have a tutorial in mind dealing with textured quads for 2d?

i just bought a $60 book about isometrics to fill in the holes i was missing and would rather not spend more...i might have to look at that book though.

thanks for all the help.


i have an engine up and running..its going through my game loops and displaying ye ole triangle...but i need to move into the textured quads to get my tile maps loaded up.

Thanks again!!

Share this post


Link to post
Share on other sites
well..i went to bed at 4am this morning...but...i got the framework of my engine set up...

I am rendering textured quads.....

next is alpha blending and creating a drawing routine to line up my tiles...then comes the scrolling..

ugh...so many things to do....

Share this post


Link to post
Share on other sites
Ok here is my question.

as im rendering my quads will i be doing the same thing as 2d...

making the corners of my Iso quad transparent and translating the tile down by half to lock with the tiles below it?

thats silly...ok so the next thought is to make diamonds and texture them...but...they have to be 2:1 to be isometric...so if i textured that it would squish the texture...arg!



thanks


sorry for all of the questions..im just trying to find the best way to do this so i dont have to rewrite..AGAIN!

[Edited by - nex7 on March 3, 2005 11:31:35 AM]

Share this post


Link to post
Share on other sites
The quads should actually be diamond like in shape, There should be no black borders around them implying that they are actually rectangles. You will have to move them down halfway though.

EDIT: missed your thats silly comment. [smile]. Can't be helped, prepare for a long road filled with many twists ,turns and rewrites. [grin]. Using a texture similar in size to your tile should have acceptale results. In my game I used 128x64 tiles and 128x64 textures.

Share this post


Link to post
Share on other sites
how...

the textures cant be...they would get squished...but!!! wait!!!...

what about seamlessness i would imagine that munging textures like that would cause issues....

I feel like a newb...and thats not cool!

Share this post


Link to post
Share on other sites
It would not look horrible, as for seamlessness..That is a whole other level of dificulty. The simplest is to have many transition tiles and the best is to use a method called texture splatting.

Share this post


Link to post
Share on other sites
lol my head hurts.

ok ill tackle that after i get the tile rendering done.

couple more questions...

whats the best way to render each tile...right now i render each one seperate...

beginscene
for(num of tiles)
draw tile
endscene

should i do one large triangle strip....
if i use a large triangle strip..i cant texture each quad individually can I?
and if i do that how am i supposed to scroll...
in 2d you just draw new stuff in the direction your going....
I assume i just have a position relative to my world array and draw from that position...so id be redrawing everything each time...

i really wish i could find a good tutorial on making a 3d isometric engine that talked about the specifics of tile generation and scrolling...and the proper way to load up new tiles as i walk in a particular direction. I just dont want to reinvent the wheel and invent it wrong.

Share this post


Link to post
Share on other sites
You do not draw one big quad, you draw them each individually,so yeah, how you are doing it now is fine. This is a good tutorial on scrolling within a 3D framework and although it utilized Direct3D 7 the concepts still apply to Direct3D 8.

Share this post


Link to post
Share on other sites
tiles are up and running...now on to the scrolling :) thanks a ton!

Share this post


Link to post
Share on other sites
Just to be clear...

Each time the screen is scrolled i am planning on

1. screen scrolled
3. drop old vertex buffer
2. rebuild vertex buffer with new tiles from array
3. draw

yes?

thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement