   LPDIRECT3DTEXTURE9::LockRect()
  Well, im trying to create a simple class to manage my textures and insure that no textures are loaded twice, now, the way im doing it is i do in fact load the texture, then compare it's bits to see if the same image already is in memory (and registered with my manager) and my question is this:are the dirty reigons in D3DLOCKED_RECT's completely random? aka just whatever was occupying that spot in memory beforehand?  because if thats true i need to compare the textures line by line to avoid the dirty reigon, bleh...edit: i did find this: "D3DLOCK_NO_DIRTY_UPDATE By default, a lock on a resource adds a dirty region to that resource. This option prevents any changes to the dirty state of the resource. Applications should use this option when they have additional information about the set of regions changed during the lock operation. " on MSDN, but i kinda dont get it, maybe i should read up more on surfaces to get what a dirty state is...Thanx all-Dan[edited by - Ademan555 on February 16, 2004 10:00:23 PM]
  Why not just compare texture names?  Its a lot faster and won''t kill load times.If someone has image1, image2, image3, image4 all named differently but the exact same image, thats not really your engine''s fault. ;  True, thats how my original one worked, but when it (for seemingly no reason at all) crapped out on me, i decided to rewrite it, and make it mo betta... maybe i shouldnt lol, but it DID shave off an extra parameter from my function, which i thought was nice lol ;  Plz, i need to know, otherwise it completely negates the point of this...thanx-Dan ;  *shameful but necessary bump* ;  Let me get this straight, when a new texture is loaded, you''re going to walk a list of existing textures, lock each one, and compare pixel data?  If that is the case, you might want to rethink this.Drivers aren''t required to initialize any surface (textures included) at creation time.  The contents of the surface are undefined.Investigate IDirect3DBaseTexture9::SetPrivateData.  It is designed for tagging a texture with whatever data an app may require.  It also doesn''t require an expensive trip down to the driver in order for you to perform your comparison. ;quote:Original post by Ademan555  True, thats how my original one worked, but when it (for seemingly no reason at all) crapped out on me, i decided to rewrite it, and make it mo betta... maybe i shouldnt lol, but it DID shave off an extra parameter from my function, which i thought was nice lol   You do NOT want to compare bits of the texture.  Comparing 2 256x256 textures requires 65536 comparisons.  And that''s just to check 2 textures!If you want a simple solution, create an STL map to map a string to a texture (either a bare texture or your own wrapper around it).  Checking for its existance is now trivial, robust and about 65000 times faster. Stay Casual,KenDrunken Hyena;  Not to mention that the filename approach doesn''t require you to load the texture before deciding if you needed to.   Stay Casual,KenDrunken Hyena;  True True True, so i guess now it comes down to my utter lack of knowledge about std::map  i looked it up at like sgi.stl.com or something like that, (where i looked up vector which is the only other standard struct ive used) and anyways... i dont get it... well i kinda do, but here goes my question, so i have std::map bleh; right? so say i do if (bleh[path] == NULL)  (to check if there is something there) would that be a good approach? because it says if there is nothing there it will create a default object, or something like that, and so assuming that is null, then i should be good right?  well if thats true then its time for my other problem, (though i didnt look very hard) it didnt appear i could iterate through the map the way you would a vector... which makes me wonder how the heck to remove textures when the time comes (without storing the file path outside of the map as well)hope that didnt just seem like rambling... any ideas tho? ;  the fastest method to do this is by name comparison. you cannot compare the filename as default LPSTR format but if you copy this name to a char* file1, file2; you can use strcmp(file1, file2) to compare them.