Copy rects

Started by
7 comments, last by mdfmKoRn 22 years, 3 months ago
Does anybody here know how to make a texture the destination of a CopyRects function in DX8. The MS docs say all over them that it can be done, yet if I try it, it says the destination has to be another surface. ---- Herb M. (mdfmKoRn) www.sky-meyg.com s3202@attbi.com
Advertisement
Look at the texture interface - you can access the underlying surfaces of a texture.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Specifically, you want to do something like this:

hr = texture->GetSurfaceLevel(0, &surface);

This will format the texture data into ''surface'' a LPDIRECT3DSURFACE8.

Keep in mind that you''re only accessing the fullsize texture at level 0, if you''re using mipmaps you''re going to have to loop through and change all the surface levels.

Also keep in mind that CopyRects doesn''t do any pixel format conversion, so the surface will need to be the same format as the texture''s pixel format or you''ll need to write your own CopyRects-alike function.
I try to point people to the docs rather than spell things out. This is the kind of case where that becomes more important. If you use copyrects in this manner, pay careful attention to all of the attributes of your texture.

A careful perusal of the texture interface is probably a good idea here...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Well if that''s your intention why don''t you try actually pointing me to the docs?

I spent hours looking for the function GetSurfaceLevel, since the docs can be quite misleading. I post here when I get tired of that crap, not to listen to people like you beat around the bush.

----
Herb M. (mdfmKoRn)
www.sky-meyg.com
s3202@attbi.com
Sigh...

search on "IDirect3DTexture8" - the texture interface... Although other searches will get you to the same place very quickly. Click on any link to IDirect3DTexture8" - the texture interface.

Anyway, if you search for IDirect3DTexture8 (the texture interface), the topmost hit will be the entry for IDirect3DTexture8 (the texture interface) If you click on that, you will get the documentation for the texture interface (IDirect3DTexture8).

Very near the top to that page, you will find a table that lists all the methods of the texture interface (IDirect3DTexture8). Most of them address your problem.

GetLevelDesc gives you a description of the surface of the texture (aha! a surface)

GetSurfaceLevel returns that surface to you (aha, a surface again)

Come on now, the docs for CopyRects includes information about levels, surfaces, and textures. I don't think it's unreasonable to assume that you could find the docs for the texture interface. When you have a question about a particular interface, look at that interface! (as stated in the original reply)

Sorry for the rant, but I can't think of a more direct way of giving you the correct information short of cutting and pasting the docs themselves. If you have trouble navigating the docs, say so, but don't accuse me of beating around the bush. I could reinterpret the docs for you, but that would be a lower fidelity version of the info that you already have access to.
Spoon feeding you with information is a dangerous thing because you'll never learn the limitations, things to look out for, etc.

Edited by - CrazedGenius on January 13, 2002 3:40:30 PM
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
News flash: the docs for CopyRects include information on surfaces, yes. GetSurfaceLevel... no. Like I said, they can be misleading. Regardless, I found it on my own anyway so your cause isn''t in vain.

----
Herb M. (mdfmKoRn)
www.sky-meyg.com
s3202@attbi.com
For future reference:

The arrangement of the docs is such that I wouldn''t expect CopyRects to expound on the texture interface because CopyRects is not about textures.

In general, questions about interfaces are answered in the interface docs. So, copyrects talks about surfaces of textures. Your first question should be "How do I get a surface from a texture". The interface of an object supplies access to info and attributes of that object, so your question becomes "What method of the interface gives me a surface?" At that point you look at the texture interface.

The point to all of these posts was to try to get you to look at the docs. You are having problems with textures, look at the texture interface.

There''s no news flash there, I wouldn''t expect the docs for IDirect3DDevice8 to go into detail about textures. I''m not saying this to argumentative, I''m trying to give you some insight into how the docs are arranged. They aren''t perfect, but they do have a logical layout.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
use c++
its faster,
its more powerful
AND
you are "typesafe"

(at least until you "cast away" your problems

cheers,
the an-on-ym-ous.

This topic is closed to new replies.

Advertisement