C# - this is really strange...

EFileTahi-A

Contributor
Joined
Aug 8, 2004
Messages
623
Location
Portugal / Barreiro
My directX dveice is set to be rendered into a panel control. This works fine as long I don't resize the panel. If I change the panels size it does give this error:

"An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.directx.direct3dx.dll

Additional information: Object reference not set to an instance of an object".

When executing the following code:
Code:
sprite.Draw(dxTexture[VAR.iTag], textureSize, new Vector3(0, 0, 0), new Vector3(0,0,0), Color.White);

Why on earth the sprite.draw stops working when I change the panels size?!
The dxTexture[] have a texture (it's not null), the textureSize is correctly set...
 
Last edited:
I discovered the problem.

Instead of loading the textures into the texture[] like this;
Code:
c_DirectX.dxTexture[iCounter] = TextureLoader.FromFile(c_DirectX.dxDevice, sCurrentFile, 0, 0, D3DX.Default, 0, Format.Unknown, Pool.Pool, Filter.None, Filter.None, Color.Blue.ToArgb());
I needed to change the Pool.Pool to Pool.Managed :D

- THREAD CLOSED -
 
Back
Top