CopySurfaceToSurface()
ok, so i need to copy a surface to another surface, i think i got it, as long as the data for a pixel is a DWORD, but anyways, i have a book that im reading to help me, and well, it keeps referring to the PITCH, what is it? thanx;
wow i ended a sentence wit ha semicolon, too much c++ :-/
[edited by - Ademan555 on November 30, 2003 4:24:02 PM]
The book you said you are using, "The Zen of Direct3D Game Programming", explains it in the beginning of the first Direct3D chapter. And, again, that book isn''t very good...
"pitch" is the distance between the first pixel of each scanline. Often, the "pitch" is the same as "sizeof(pixel)*width", but not always. For example, when using less than 4-byte pixels, pitch is often rounded up to a multiple of 4 for efficiency reasons. Also, if you have a larger image, and refer to some subset of that image that''s narrower than the full image, the pitch of the subset is still the same as the pitch of the big image.
Another way to say it:
To move a (char) pointer one pixel over, add sizeof(pixel).
To move a (char) pointer one scanline over, add pitch.
Another way to say it:
To move a (char) pointer one pixel over, add sizeof(pixel).
To move a (char) pointer one scanline over, add pitch.
ah, thanx, and sorry playggy for not looking closer :-/, i personally like the book though, since im only 15 it kinda brings it down to earth, what would u reccomend?
Yeah, I'm 16... age doesn't really matter.
I don't know what to recomment, but here is what is wrong with it:
1. He starts off explaining things really well, but as the book goes on, he explains things less and less and less.
2. There are tons of typos, even in the math section.
3.He programs terribly. I am still getting better myself, but he brags in the beginning that his code is great. His code is extremely messy, and almost everything is global, which, once you start making more complicated stuff, makes things really hard to modify and deal with. Plus, he just does stupid things. He Releases and recreates the back buffer every frame at one point in the book (which, in case you didn't know, is a super slow and you don't have to), and in his DirectInput section, he Polls the entire keyboard every time he checks for a single key.
3. At one point he makes a function (ValidateDevice) that works for where he is in the book, and the forgets about it, adds new stuff to the program, and then the function stops working.
4. If someone starts at the 3D section, he says "Here are the functions I have made so far, in case you are just starting here" and leaves out a bunch of them that he still uses in the functions he shows. He even says in the beginning of the book that it would be no problem starting at any chapter in the book.
5. He spends too much time explaining specific things (like making a console), and leaves out a ton of D3D's features.
[edited by - PlayGGY on November 30, 2003 4:45:49 PM]
[edited by - PlayGGY on November 30, 2003 4:46:26 PM]
[edited by - PlayGGY on November 30, 2003 4:54:23 PM]
I don't know what to recomment, but here is what is wrong with it:
1. He starts off explaining things really well, but as the book goes on, he explains things less and less and less.
2. There are tons of typos, even in the math section.
3.He programs terribly. I am still getting better myself, but he brags in the beginning that his code is great. His code is extremely messy, and almost everything is global, which, once you start making more complicated stuff, makes things really hard to modify and deal with. Plus, he just does stupid things. He Releases and recreates the back buffer every frame at one point in the book (which, in case you didn't know, is a super slow and you don't have to), and in his DirectInput section, he Polls the entire keyboard every time he checks for a single key.
3. At one point he makes a function (ValidateDevice) that works for where he is in the book, and the forgets about it, adds new stuff to the program, and then the function stops working.
4. If someone starts at the 3D section, he says "Here are the functions I have made so far, in case you are just starting here" and leaves out a bunch of them that he still uses in the functions he shows. He even says in the beginning of the book that it would be no problem starting at any chapter in the book.
5. He spends too much time explaining specific things (like making a console), and leaves out a ton of D3D's features.
[edited by - PlayGGY on November 30, 2003 4:45:49 PM]
[edited by - PlayGGY on November 30, 2003 4:46:26 PM]
[edited by - PlayGGY on November 30, 2003 4:54:23 PM]
On the topic of "Zen"-bashing.. I can''t believe that anyone who''s been programming for a while would publish his book. If you look at his source code, it''s all in one header and one source file. It just gives headaches; if you try to cut and paste one class that he''s written to your own project, you find that it has a million dependencies on previous classes/functions.
As for what books I recommend.. there''s a bunch of good reviews on this site, and I''ve heard that Programming RPG Games for DirectX is an awesome book. I''ve only skimmed through it at a bookstore, though.
As for what books I recommend.. there''s a bunch of good reviews on this site, and I''ve heard that Programming RPG Games for DirectX is an awesome book. I''ve only skimmed through it at a bookstore, though.
yah, ive looked at that for a split second, but anyways, i seem to have some across yet another difference between dx9 and dx8, there seems to be no copy rects function, unless it isnt a member of the device, which is very possible considering what you guys seem to think of this author. anyways ill look for it in msdn, but if anyone has a quick solution, thatd be cool
I beleive Beginning Direct3D is better, but I only looked at it for a few minutes, and I have heard some bad things about it, too. I have heard the RPG book that the guy before me mentioned is good, but I haven''t ever looked at it.
But again, the code in Zen is extremely messy . I can''t even describe it, so pop in the CD, close the installition page, browse the CD in a folder, go to Examples->Final Zen Base and open it up. Look at the header file. Wow.
But again, the code in Zen is extremely messy . I can''t even describe it, so pop in the CD, close the installition page, browse the CD in a folder, go to Examples->Final Zen Base and open it up. Look at the header file. Wow.
quote:Original post by Ademan555
yah, ive looked at that for a split second, but anyways, i seem to have some across yet another difference between dx9 and dx8, there seems to be no copy rects function, unless it isnt a member of the device, which is very possible considering what you guys seem to think of this author. anyways ill look for it in msdn, but if anyone has a quick solution, thatd be cool
Yeah, I had the same problems you did. I went on MSDN, found the function for creating a surface in DX9, looked for a new CopyRects function, didn''t find one, and then switched over to texture quads.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement