edgar-mtz-e / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

Texture type cast problem #277

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When something like Texture2D.FromStream is called, result of internal
function Texture.FromStream is casted to Texture2D type using static cast:
...
return static_cast<Texture2D^>( baseTexture );
...

It is not correct. Runtime type of the baseTexture variable will remain the
same and when I try to cast that variable to Texture2D type in my managed
code, I've got invalid cast exception: "Unable to cast object of type
'SlimDX.Direct3D10.Texture' to type 'SlimDX.Direct3D10.Texture2D'".

Original issue reported on code.google.com by boris.ja...@gmail.com on 5 Jun 2008 at 2:03

GoogleCodeExporter commented 9 years ago

Original comment by josh.petrie on 6 Jun 2008 at 1:35

GoogleCodeExporter commented 9 years ago
Refactored the base class to include methods that return the native 
ID3D10Resource, 
which the subclasses use to gcnew an appropriate managed type.

Original comment by josh.petrie on 6 Jun 2008 at 2:32