Jump to content
  • Advertisement
Sign in to follow this  
Jason47401

Weird texture display failure

This topic is 4036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I am sort of rebuilding an old Visual C++ project that was to be a 3D modeling program. I wrote it on my old computer and began the new editor there too. Then, that computer started freezing up, and I determined it was the harddrive going bad. It would run OK for random lengths of time, and no particular program running could be its cause. This is and an occasional rattle sound within were what convinced me it was the hard drive, but it also meant that I could save both projects' code onto a flash drive so it wouldn't be lost for good. Well, luckily, a friend of mine had an old computer which he sold me. Though old, it was not as old as mine and had among other things an ethernet card. I could only use dial-up on the old computer. It also runs Windows XP instead of Windows 98 on my former computer. I installed Visual C++ Standard edition 6.0 on the new one, which pretty well explains why I don't have the DirectX header files to use DirectX 9 even though that is the version of DirectX on it. No, all my code continues to use Direct3D retained mode. When I first tried to compile the old project on my new computer, I changed the initial MeshBuilder object load call to load an object which uses a ppm file texture. It was one of the pre-made X files in the library disk's Media folder. The object appeared, but it was wrong. It was like it was all gray, save for a few faces. I soon understood that I was seeing the object without the texture that was supposed to be wrapped on it and which it had before. I looked at the X file, and realized I had not copied the ppm file into the old editor's folder. They're both there on the old computer, but I had missed it. So I got it, transfered it, and voila! It worked. The new project was an effort to turn the more or less poorly organized old code into a modular and object oriented better beginning. So when I finally tested the version where I added a ViewRect object I created in and it was capable of rendering, it appears gray. I breath a programmer's "I've already dealt with this kind of problem" sigh of relief, and copy the ppm file in the same directory. As you can probably guess, the obvious did NOT work. I have tried all I could think of to track the problem. In debug, step-by-step traces, when it makes the MeshBuilder2 load call, the return indicates success in both seperate projects. Just so we're clear here, on the same computer, one project displays an X file properly and the other does not, and both folders have a copy of the X file and the ppm file it uses. I've even SetCurrentDirectory of the old working version to load from the new project's X file, and it still works right! That pretty much convinced me that both files copies were truly the same. I even inserted debugging code into the load texture callback function which both version use to write the image in seperate files, compared the two image's data, and it appears that DirectX is reporting that the MeshBuilder2 in my new editor is successfully loading both the object and its texture, but it doesn't show it. Any ideas or more specific information about how the texture is loaded and displayed exactly would probably help.

Share this post


Link to post
Share on other sites
Advertisement
I don't like to be negative, but you're using D3DRM - no one uses that these days. I had a brief encounter with it around '98 or '99 and haven't touched it since. It was withdrawn with Windows Vista so you're stuck with XP and below as target OS's for your application...

In all fairness, you might as well upgrade to something from this millenium as you're almost certainly on your own with D3DRM these days [wink].


Cheers,
Jack

Share this post


Link to post
Share on other sites
I wound up having to take all the relevant objects of my new version and bring them into a copy of the old version to hunt down where the difference was. At first, I just adjusted non-existant references and other things that would prevent this hybrid version from compiling at all. This created a version of the old that had but did not use any of the new one's functionality. Then, one small step at a time, I placed the lifetime of DirectX objects and API objects under control of the new version Application object and its initialize member. The last version that worked before behaving strangely was when I replaced the subroutine that makes the first scene.

Then I recreated the original viewer sample code project I had studied to learn the use of Retained Mode. This always worked on my old computer, but it had its own perplexing behaviour I never witnessed before. One of its menu options allows for change from an RGB color model to a mono color model. In the DirectX sections of the MSDN library disk, it specifically mentions that it is not possible to change the color model of a device. It is necessary to enumerate the devices available on your system or use FindDevice like the viewer program and both my editors do for a device that has capabilities you want. And the original viewer code responds to that menu command by rebuilding the device and searching for a GUID of one that supposedly uses that color model. This is what's new: when that menu item is used to change to RGB model, the ship loses its texture. But only if any other meshbuilder does not have any part of it visible in the viewport. It remains "skinless" through all manner of manipulations and through window resizings until or unless you happen to move or load another visible object into view. At that point, it immediately gets its texture back as if by magic. Switch back to what the menu says is mono, and even if alone in the viewport, resizings do NOT lose the texture.

I speak of whether it is actually in mono or RGB doubtfully because I put test code in to call GetColorModel method of the DirectX device object, but in both states, it returns 1, which is the indicator of mono. So I have the actual made device object telling me its color model is mono when I perform the menu command to change models, but a visible difference on screen.

I have a NVIDIA Vanta/Vanta LT card according to dxdiag tool, and remember seeing topics about problems in DirectX with those cards. I hope somebody may have encountered similar issues or have some thoughts. I'm going to copy both versions of my editor so far and the original viewer back to my old computer and see if the weirdness vanishes, but I am still in the dark.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!