|
-
Aug 18th, 2001, 12:55 PM
#1
Thread Starter
Hyperactive Member
Hey, Please learn me!
Hey, I'm trying to learn Direct Draw 7. But it is kind of hard.
VB Code:
MainDesc.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
MainDesc.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX
MainDesc.lBackBufferCount = 1
Set PrimaryBuffer = Motor.CreateSurface(MainDesc)
What are the 'caps'?? Can anybody explain deep how this works?
What are the difference between DDSCAPS_COMPLEX, DDSCAPS_FLIP and DDSCAPS_PRIMARYSURFACE ?
And what are the difference between DDSD_CAPS and DDSD_CAPS2? Or 3?
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 18th, 2001, 01:56 PM
#2
CAPS, very simply, are the capabilities exposed by your video hardware. Basically, any video card that supports an API has certain things that it supports, and will do for you. For example, in D3D8, there are some newer technologies, Pixel and Vertex Shaders being a good example. Pixel Shaders are only supported in hardware on the newest video cards (geForce 3, and possibly 2, i dont know, those are examples). On just about any other card, if you try to use them, either your program will crash,m or something wierd will happen. To prevent this, you ask the device to enumerate its capabilites for you, and you can then check for support. On older cards, you wont be able to use pixel shaders, so you wont find that in the CAPS. On newer cards, it will be there, so you can use them. I hope this is all making sense =).
Z.
-
Aug 18th, 2001, 05:40 PM
#3
Thread Starter
Hyperactive Member
So you're saying that if possible, my program will use PrimarySurface(Whatever that may be :P) If my video card cannot support it, it will attempt to use Flip, and so on? So what I'm doing is to check the capabilities of my computer to create the backbuffer...?
But...
MainDesc.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
What are the Flags? Is this if the computer has no capabilities? Zaei, you have any place where to find any background of this type of programming which goes really deep, cause I think asking you from here might take a lot of effort for the both of us So if I had a place where I could find out WHAT the different components are and how they work, it would be a lot easier to use it
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 18th, 2001, 08:17 PM
#4
Lively Member
Helpful Site...
This site may prove helpful. Check out the DX7 stuff from the top of the menu...
http://64.23.12.52//index.asp
-
Aug 19th, 2001, 06:19 AM
#5
Thread Starter
Hyperactive Member
I know about that site. As a matter of fact, I got my code from there. That site is GREAT, but he's left out a few details in the code so some of it seems like some kind of a recipie.
!!THAT'S NOT GOOD IN A TUTORIAL!!
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 19th, 2001, 07:30 AM
#6
transcendental analytic
Besides looking for tutorials (which is good for learning but they might not be informative enough somtimes) you can look up certain things in the SDK's documentation. MSDN is another good source, look under dwFlags here:
http://msdn.microsoft.com/library/de...trcts_2y7b.asp
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 19th, 2001, 08:13 AM
#7
Thread Starter
Hyperactive Member
Hey. I've noticed that when to make all the flags valid etc, you use the Or-operator. Why is that? Why not 'And'?
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 19th, 2001, 08:32 AM
#8
transcendental analytic
Or and And have actually two uses. They are both boolean logic operators and bitwise boolean logic operators. Between boolean datatypes boolean logic is applied while between numeric datatypes bitwise operation is performed. Here's the results of the boolean operations:
0 And 0 = 0
0 And 1 = 0
1 And 0 = 0
1 And 1 = 1
0 Or 0 = 0
0 Or 1 = 1
1 Or 0 = 1
1 Or 1 = 1
If you replace 1 with true and 0 with false you have boolean logic, if you stack up them like this:
Code:
01000101
OR 10000011
____________
11000111
you perform bitwise boolean logic. Bitwise boolean logic are as said performed between numeric datatypes like long, a 32 bit integer. All numbers can be written in any decimal system but computers store them binary, which means only digits 0 and 1 are used. A 32 bit integer consists of 32 bits, 32 0's or 1's that is. When bitwise boolean logic is performed, boolean logic is performed between each pair of bits, which means they won't interfer with each other. Flags are basically bit's wich means something, so a 32 bit integer has 32 flags, 32 on/off switches so to speak. When you peform boolean Or, you actually put on all switches that are on in one of the operands Or both, when you perform boolean And, you only get the common switches, that is those that are both in the first And the second operand.
Bitwise boolean Or is performed here to flag on new flags and preserve old ones as well.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 19th, 2001, 05:37 PM
#9
I don't post in here often, basically read the post as I am new to the graphics era, but I just wanted to say that, Kedaman, you explained that really good, even though I already knew that. well done
-
Aug 19th, 2001, 06:09 PM
#10
SCoutt i know that not related with the topic but i like your icon under your name 8)
-
Aug 19th, 2001, 06:11 PM
#11
he he thanks
-
Aug 19th, 2001, 07:55 PM
#12
Unfortunately, Igor, if your video card cannot support an option, the application will probably quit, instead of doing what i can do. Its your job as the programmer to figure out what the computer is capable of, and use it.
Z.
-
Aug 20th, 2001, 09:56 AM
#13
Thread Starter
Hyperactive Member
So you mean it's my job to make the application search through the computer for components available and stick to them?? GOD DAMN, I'm giving this up! I'll stick to making the graphics, not the engine. Better find me one who can. How 'bout it, Zaei?
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 20th, 2001, 12:17 PM
#14
You know what Im working on =P. Ive got little time to do anything else as it is =).
Z.
-
Aug 20th, 2001, 12:40 PM
#15
transcendental analytic
Actually DirectX does it for you, not you, you just need to play with the cute api's
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 20th, 2001, 01:31 PM
#16
Not true, kedaman, at least for most of the things I have seen... If you dont have a T&L video card, and you try, for example, to create a D3D Device with the flag D3DCREATE_PUREDEVICE, it will fail. Same for choosing an incorrect BackBuffer format, etc. This is all from DX8, but it should hold true for earlier versions.
Z.
-
Aug 20th, 2001, 02:11 PM
#17
transcendental analytic
Not true Zaei 
On each DirectX component there's a neat GetCaps() function that fills in all hardware accelerated capabailities supported
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 20th, 2001, 02:53 PM
#18
But you, the programmer, still has to make sure the device has the capability to use whatever advanced technology before using it. DirectX does not automatically make sure you can do what you want to do, and compensate if you cannot.
Z.
-
Aug 20th, 2001, 05:16 PM
#19
New Member
Hey Real Igor,
Don't give up on DX7 - I am a newbie myself, but
once I got going with DX I found it very easy to
use. The trick with it is that you don't have
to worry about much in the beginning. DX will
substitute most hardware functions that it can't
find with it's loverly library of software
support.
What your code is doing is :
1) Telling whatever looks at your surface that it
has a back buffer.
2) It's your primary (what's seen on the
screen), complex surface (there is more than
one) which you want to flip between. Flipping
is just the means by which you copy from the
back buffer to the screen.
3) Tell it there is only one back buffer.
4) And create your object.
DX is all about filling in structures, then using
them with funky functions to get the results.
When you get to optimisations, etc, (which is
what I am trying to deal with now) you do have
to write some specialised code because some of
the software functions are a tad slow (bitmap
rotation for example), but for learning's sake,
ignore that for now and just step through your
engine. You can always touch it up later.
Oh, and don't expect your learning code to be
much use to your finished product. By the time
you are done, you will know much better ways to
do things, and will want (yes, want) to start
with a clean slate.
All my DX experience has been with MSC++ so take
all this with a grain of salt, but the DX stuff
should still all be the same.
Good luck with it.
Steele.
-
Aug 20th, 2001, 10:42 PM
#20
Good Ol' Platypus
I've been doing some DX7/8 in my "travels" and spare-time, so here's what I've learned:
1. Most tutorial writers put in a lot of extra junk that you won't use unless you know what it is and add it in yourself. Eg. In Jack's program, he has a bRunning variable, I never use it. Actually, most of the framework for my app comes from http://rookscape.com/vbgaming/ . The part about loading a bitmap in ddraw is gold, has all the basics, no bells nor whistles. It's perfect. All you have to do is set everything to nothing when you're done.
2. Experiment with Primary.Flip / Primary.BltFast (...). The Flip is limited by your monitor's refresh rate ANDed with your video card's refresh rate. If I didn't do that math right, it means that it takes the lower of the two. My Optiquest/GeForce2MX combo goes at 150hz, when I ask it to, which is absolutely fine for games, 60 is really all that you need. BltFast/Blt isn't limited, but it's slower usually, and some weird things happen (my frame rates dipped to 0.1 fps when there was no text on the screen, weird, eh?), but once you solve these you'll be on your way.
3. A final word; use 24/32bit colour depth, spare yourself the idiocy of 16-bit. Believe me, dont go 16/15 and it will be WORTH it. Also, 8-bit is fine for things such as starfield simulators, set the primary surface's palette to 0,0,0 - 255,255,255 for a complete grayscale screen.
>=) Good luck!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 21st, 2001, 03:39 AM
#21
transcendental analytic
No Zaei, that is the end user's issue, he has to have a monitor for playing Quake, otherways he can't see what he's doing Furthermore DirectX is built with a interface that delegates functionality to both hardware acceleration layer and hardware emulation layer, the second if the first is not supported.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 21st, 2001, 10:03 AM
#22
Good Ol' Platypus
But you have to have better than a 2"... that's what Zaei is getting at, I believe. Also you cant play it if you have a B&W hercules card!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 21st, 2001, 04:42 PM
#23
Thread Starter
Hyperactive Member
Thanx for the advice and help, everyone. Unfortunately, I'll have to put the project on the shelf for a while (NOT TOW, if that's what you're thinking, Sas). That includes, Main Instrument(Oh, I'm gonna get GOOD!), A musical project (Where I play the piano), misc. school stuff, etc, etc (Bet you're not really that interrested anyway). So I guess I'll learn DX some other time Good night, fellow earthmen!
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 21st, 2001, 06:07 PM
#24
Im getting a good debate with kedaman on this one =). Perhaps DX7 is different then DX8, but I know that in DX8, you can create your D3D Device in (at this point) either the HAL mode, or the REF mode. HAL is, of course, Hardware, while REF is the software version of the entire DX8 functionality. While running in HAL, it will not revert to REF for stuff that isnt supported by the card. Itll just not do something, or do something wierd.
Z.
-
Aug 22nd, 2001, 06:17 AM
#25
transcendental analytic
Yeah that was sort of what I was pointing at. The devices that HAL supports can easily be determined with GetCaps and I'm refering to DX8 as well
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|