Code works on one machine, not on another

Started by
11 comments, last by FieroAddict 20 years, 11 months ago
I''ve been working on a game using the Sprite class in managed Direct3D. Well, it was working just fine on my desktop computer but when I tried moving it over to my new laptop to work on it all of my TextureLoader.FromStream() calls fail. At first I though maybe it was having trouble loading the larger textures because the laptop has 32MB of video memory and the desktop has 64MB, but I commented out the others and left a couple 16x16 textures and those fail too. I checked the device caps and it supports the same formats that my desktop card does. Anyone have an idea of what could make a function call like this fail from one machine to another? Thanks for any ideas.


    Public Shared Function Init(ByRef dev As Device, ByRef image As Stream) As Boolean
        theSprite = New Sprite(dev)
        srcTexture = TextureLoader.FromStream(dev, image, 0, 0, 0, Usage.Dynamic, Format.Unknown, Pool.Default, Filter.None, Filter.None, Color.Pink.ToArgb)
    End Function


Advertisement
If you wrap the FromStream() call in a try/catch, you can find out what the error is...
Well, I tried displaying the exception that was thrown in a message box... all it says is "Error in the application" as the exception message. Not very helpfull. I wonder if it has something to do with the ATI Mobility 7500... I going to have to try this on another video card and see if the problem still exists.
Check the ErrorCode member of the exception. It should tell what''s going on.
OK, I''m new to .NET error checking...

Now I have it catching a Direct3DXException and displaying an error code of -2005530518. I attempted to look up the number in the DirectX error code lookup, but didn''t find anything there. I''m still new to a lot about DirectX so I appriciate you helping me try to figure this out.

Apparently the program is loading the files OK into the stream... so it''s finding them OK. It seems weird that the FileLoader would work on my desktop with a GeForce 4200 but not with the laptop which has the ATI Mobility 7500.
I''m still having difficulty with this. I just can''t figure out why a simple Texture.FromStream, or even Texture.FromFile fails on my laptop but works on my desktop. I haven''t had a chance to check it out on another desktop yet. Any other suggestions may be helpful. If you need more info to help me out, let me know.

Thanks.
Check the SDK docs on the problematic command. Usually you will see a list of possible errors, which are usually listed as constants. In Direct Draw, you might have DDERR_SURFACEBUSY for example, which is -2005532242.

Unfortunately, the SDK doesn''t list the error codes as numbers, just their constant equivalients (in my example, DDERR_SURFACEBUSY), while the error you get is usually expressed in its numeric format.

Somebody probably knows an easier way around this, but the way I do it is create a print-to-screen function that prints all of the possible constants (I cut and paste them from the SDK into the code). What you will get is the numeric equivalents of these constants. I them write these down for future reference. One of them should match your error.

I''d tell you what it is, but I haven''t run into that particular error code before.
Check to make sure you have the most recent sdk and that your library files are linked right. Make sure your settings for VB on your laptop are the same as those on your desktop.
Well, even if I copy over the contents of my "bin" folder to the laptop and run it, it crashes at the same point. I have the DirectX 9.0a dev runtime and release runtimes installed. Even tried installing the "end user" runtimes just to see if it would change anything. Using Visual Studio .NET 2002 with .NET framework 1.0. Both computers are setup the same as far as VS.NET and OS. Hmpf.
Also tried writing a test app from scratch on the laptop and it still crashes on all texture loading function calls except for:

TextureLoader.FromStream(dev,stream)
TextureLoader.FromFile(dev,"filename")

But those distort the image and aren''t useful in my app. Are the parameters in the texture loading functions device dependant?

This topic is closed to new replies.

Advertisement