Hi people!!
If you read the title you know im new. I have a few questions that i need answered.
1) how do you use DirectX to program games?
2) is it hard to program games?
3) what is bitblt?
Printable View
Hi people!!
If you read the title you know im new. I have a few questions that i need answered.
1) how do you use DirectX to program games?
2) is it hard to program games?
3) what is bitblt?
question #1: There are whole books written on this. The best answer I can give is, you use the componets of directx, like DirectDraw, Direct3d, directSound, directMusic, etc. to get harware acceleration for your games. This is much faster, smoother, and gives you more options as far as graphics, animation, 3d models, and sound are concerned.
question#2: Once you learn it, no. It has a pretty high learning curve, but once you learn it, it sticks. And it's worth it if you want to write games with good graphics.
question #3: bitblt is an API call that does fast, clean, flickerless drawing. You draw from one source to another, basically, using device context handles(where image data is held). It basically draws really fast and is brilliant for animation. DirectDraw has a Blt funtion too, but they are not the same. DD's is much faster.
thanks for replying. so direct x is like a drawing tool for graphics in games. is it easier to program when you use DX? i read somewhere that is is or something along those line.
im slightly biased, but personally i find that OpenGL is alot better for 3d applications.
why?
first off, its alit easier to program. writing applications in OpenGL is very simple compared to the DirectX syntax for such things, plus (imo) it makes more sense. it dosent come with such things as direct input and direct sound, but you can use directX for that. Secondly, most video cards support OGL alot more than they do direct 3d. compare framerates between OpenGL and DX on an nvidia card (like the GF line) and you will be suprised. not to mention the rendering quality is better. the lighting system is a lot more vibrant than the washed-out look of D3D
just my 2 cents :)
oh, and if you want to do stuff in 2d, your best bet is either bitblt or direct draw (which was removed, however you can use DirectX 7 to run it, and it tends to be faster than bitblt, as well as supporting various neat effects :)
ok thanks. i am going to make almost all my games 2-D. I'll probably make at the most 3 3-D games and they wont be that good either.
How exactly do you use diredt draw and/or bitblt?
that much information would not be reasonable to post in this forum. Go to a search engine and type "Direct Draw tutorials" in quotation marks.
The syntax between OGL and D3D is getting a WHOLE lot closer with each release. Once you learn either, the other is fairly simple to learn. The real difference is only that OpenGL uses C Syntax (everything is a set of functions, classes are not used), while D3D (and all of DX) is COM, so everything is a class.
Comparing framerates isnt a very conclusive argument, since relativly few games are going to be running both (Halflife being the only exception that I can come up with at the moment), and so you can never tell what is ACTUALLY going on under the hood, and whether or not the bottleneck is the AI, the rendering, or the actual API itself.
When comparing the two APIs on a card by card basis, there are conclusions to be drawn. DirectX is an API that is designed to work (up to a point) on ANY card you give it, that has the right drivers. Code for running, say, a pixel shader, is going to be the same, whether you are running on a GeForce3, or a Radeon 8500. On the other hand, OpenGL uses modules known as extensions that are provided by a card manufacturer, and VERY rarely are cross card compatible. Thus, if you want to use a pixel shader in your game or application, you must write 2 sets of code, one for nVidia cards, and one for ATI cards (and one for each other card manufacturer you want to include).
The above is basically the difference between the two. When it comes to writing applications that are for your own use, the difference is very small, but when you plan to release your application, you have to decide on whether you want to sacrifice speed for compatibility (D3D), or whether you want to write more code (OGL). In the end, it is a purely opinionated choice, and should never be discussed as anything else =).
Z.
[edit]
Oh, I forgot one thing about OpenGL that is important if you are not going to be using it in VB. OpenGL is a cross-platform API, meaning that if you write OpenGL code on Windows, the OpenGL parts of your code will compile exactly the same, without modification, on Linux, or any other operating system that supports it. This, of course, means that your coding styles must adhere to the compilers that you are choosing (some are better then others, for instance, GCC 2.96 is a stricter (and more compliant) C/C++ compiler then MSVC). You would also have to manually port any OS API specific function calls to the appropriate OS when porting. Agian, the above is only if you are not going to be using VB =).
my "OpenGl is faster" remark comes from expierence in Unreal Tournament.
However, this might be slightly bloated due to the S3 texture support OGL has in UT, (which D3D lacks in that release)
however, i still stand by my comments about the lighting.:)
i guess if you wanted somthing really easy to start on you could use Glide, but then again a rapidly falling amount of people can run glide. poor 3DFX :(
If the lighting is bad in a game, it is the fault of the developers, not the API. The math is the same.
Z.
Thanks for all the info again.:D
My last question is which is easier to make 2-D games like a side scroller or a zelda type game, bitblt or direct draw? (I want to know code wise and time.)
BitBlt is easier in the short run, but DDraw is far faster. In the end, it depends on the game you are making. If your game is going to be fairly complex, DDraw is your best bet, while if the game is going to be fairly simple, you can safely stick with BitBlt.
Z.