Coding, Design & GraphicsIf you are programming a script, designing a web page, building your own graphics or anything related and need to discuss it, get help and tips or general advice, then you should post your thoughts to this section.
Recently started learning DirectX. Got myself a book on DirectX10 (might drop down to DX9 as there are more books etc). It's quite a good book bit I've never tried to learn the use of an API like this and it just seems there's tons of stuff to remember. The majority of it is filling in structures with a load of members all with annoyingly long and cryptic names
Anyway my current tactic is to just keep reading and rereading and keep writing out the code and hope it'll eventually stick.
Was just wondering if anyone has any tips to approach learning this stuff. Any other general comments about learning to use DirectX are more than welcome as well.
I would avoid using directx if I could, its outdated, low level, doesnt lend to OOP very well and being raplaced gradually, its also one of the most awefull kludgy API to use.
for high level languages, such as c# with .net the situation isnt very good, microsoft started work on manged directx, but then started working on xna, however xna is mostly for the xbox, and many windows features are hard to use, however theyve now abandoned the managed directx library so its going to end up obselete. this leaves directx rather akwrd to use. opengl is becoming a reasonabl ealternative.
there are a variety of graphics engines wich do a lot for you, from just handling the basics, to doing evrything, it depends wich language you intend to program from.
Thanks for the link, it offers C++ DirectX tutorials which is what I was after. It seems to follow my book pretty closely, but it's always nice to have different perspectives.
I'm pretty determined to learn DirectX, I'll just have to fight my way through the kludginess
Cheers.
Must spread Karma. Been consulting meowpedia too often >.<
Last edited by Allanon; 29-08-2008 at 19:53..
Reason: karma system = noob
yep ive used that site a lot, it has great tutorials, also the directx software development kit SDK is a good place to look.
it realy depends what you want to do with directx.even doing the stuff the simple way like drawing individual points is quite a lot to learn and triangles and meshes and lighting etc. the trouble is that when you reach a certain point all that becomes useless and you have to make sure you use more eficient function calls wich are totaly diferent.
then once you get even more items to draw you have to re organise your code yet again to make sure all draw operations are joined together in batches of primitives all with the same render state and textures. then you have to make sure any translucent surfaces are drawn last etc.
I have a module wich is about 1000 lines wich does almost all the low level stuff you ever need to do with directx and any calls to it do not need to reference directx so it can easily be replaced when directx is made obselete.
the higher level module deals with all the sorting of objects into batches etc. I spent ages trying to get various 3d graphics engines to do exactly what I wanted. but each of them had problem with one of the things i wanted to do.
with c++ theres quite a lot more work, as you need to ensure you free all memory etc at the right time wich with directx is a heck of a lot of work. when an other aplication grabs the device many of the data items you sent to the device become invalid such as textures and render surfaces etc, and its a lot to deal with as there are so many diferent types. once youve done that youl probably have many many thousands of lines of difficult to debug code that causes memory leaks and illegal memory access errors.
with c# the memory management manages to cope with it all quite well.
with c# you can get a free microsoft development system and with the xna wich is similar to directx you can write your own game in a few easy lessons. however xna is a real pain if you want to have multiple 3d viewports.
directx is also awkward to use becuase only one aplication can use it at a time, at least easily anyway.
with opengl there is no such limitation.
although opengl and directx look fairly diferent at first, once you start to use the batch processing functions theres actualy little diference between them. exept of course directx is a lot more work. niether are realy OOP friendly.
I would stronlgly sufggest looking at the many 3D engines out there some are truly fantastic.
the ones I was looking at were all open source such as Irrlicht Engine - A free open source 3d engine
if you want to work in the games indusrty good luck
unfortunatly I think most games seem to use directx, although I would imagine if you worked for a large games company you would not likely to be writing software to interface to directx, however knowledge of directx might well stand you in good stead at the interview
they probably also still highly likely to use c++, although i would argue c# is now more effective, becuase you can arrive at a working solution far quicker, and spend the remaining time optimising the crap out of any function that is spending most of the cpu time.
if you look at that 3d library I mentioned youl realise how complicate they are, and its not something to taken new game engine development lightly.
im not sure what ps3 uses, but xbox seems to be somewhat compatable with directx.
I think theres a lot of reasons to move away from directx but i doubt this will realy hapen, just like 64 bit PCs are still efectily 16bit machines with extra bits kludged on.
you would not beleive how long i spent trying to find a solution to a few obscure problems, and this is with c# wich takes care of all the memory management.
I've never liked DirectX too much. For any sort of rapid graphical app development, OpenGL is just easier (no fiddling around with vertex buffers! Just pumping vertices straight at the GPU!).
I used DirectX Tutorial.com - Game Programming with DirectX 9 to get on top of DirectX 9.0 in C++ (You might want to back off from 10 for now as I've heard it's quite different from 9, so a lot of tutorials etc. will be outdated and redundant).
Good luck! Make some noises if you get stuck and maybe one of us will be able to help...
ofc you dont have to use them, niether do you have to in directx, but you cant do much without them in either as each call to the graphics device has an enormous overhead.
opengl has display lists wich can be used instead of vertex buffers but these are not as fast or as flexible as vertex buffers, but are however easy to use and quicker than pixel by pixel drawing.
vertex buffers become necessary when drawing large numbers of polygons, as the efficient graphics calls take triangles, splitting the polygons into triangles creates many more points wich increases memory bandwidth.
using vertex buffer AND index buffer solves this problem by storing each point once and using indices for the list of points in eacg triangle, wich keeps the memory bandwidth down.
I guess it's cause I'm more interested in physics than graphics, but it just seems like so much work to get something on screen. I'd rather just get stuff displayed and then make it do fun things than fight to get polygons on screen.
Also all the fun of graphics begins once objects are on screen, and you can start pushing them through shaders and other interesting things.
well, i wanted to make a simple model editor, but ended up geting far too absorbed in the graphics detail, fortunatly you can just copy a sample from the c# xna and get a game up and running in a few minutes, then modify it to you hearts desire
however for an editor having one fixed game window was a hard limitation to overcome, and so tried various other things including managed directx, opengl, and various libraries. opengl is simpler definatly, and opengl has call lists wic improve speed considerably as you compile pixel by pixel routines into one list.
My biggest problem came when I had 200k polygons and wanted to use bitmaped lighting, and made the mistake of having a bitmap for each surface, combining 100s of bitmaps into one bitmap was the answer. even with my old radeon 9800 i was able to get almost 70fps. (instead of 3fpm)
ps theres a graph of calls per second for opengl v directx wich is a severe limitatio in either case althoug opengl seems to manage twice as many calls, but its still quite low, you cant do more than a few thousand calls per second.
I've never liked DirectX too much. For any sort of rapid graphical app development, OpenGL is just easier (no fiddling around with vertex buffers! Just pumping vertices straight at the GPU!).
I used DirectX Tutorial.com - Game Programming with DirectX 9 to get on top of DirectX 9.0 in C++ (You might want to back off from 10 for now as I've heard it's quite different from 9, so a lot of tutorials etc. will be outdated and redundant).
Thanks for the link, looks promising ^.^
Quote:
Originally Posted by ShiningForce
Good luck! Make some noises if you get stuck and maybe one of us will be able to help...
I will. They might be strangled noises of DX based suffocation but they'll be noises nonetheless .