Sign in to follow this  
_Tank_

[mdx] Can't create empty texture due to InvalidCallException

Recommended Posts

The aim is to create a texture that will display 2-d data on screen, with methods located in Sprite class, the problem is that it is not possible to create a texture other than TextureLoader.FromFile ... [code] Texture t = new Texture(Device, width, height, 0/*numlevels*/, Usage.None, Format.L16, Pool.Default) [\code] Device != null width = 10 height = 10 This line of code throws exception InvalidCallException So the question: How to create an empty texture ??? By the way i need this texture to be of one color scale i.e (grayscale or greenscale) is Format.L16 or Format.L8 suitable for such purpose, how does it work?

Share this post


Link to post
Share on other sites
Well you've got the right idea.

1) Does your card will support L16. I had this problem a few days ago using P8 and after hours of frustration it turned out I jusr couldn't use that.

2) Make sure the Device is not null, although that should cause one of those NullReference exceptions.

3) The width and height aren't negative and you're card supports non-power of 2 textures, if they are non-p^2.

4) The MDX docs claim that for compatibility it's best to set the usage flags to the same as the Device. Try that if the above three don't work.

Running the caps viewer in the SDK should be able to solve most of this.

Share this post


Link to post
Share on other sites
Quote:
Original post by Demirug
Which CPU you are useing and what your values for width and height?


Well CPU P4 1.7 ghz. But i don't think that this gives radical effect even if i'll use Celeron 1.7 ghz

Share this post


Link to post
Share on other sites
Aaah got the solution!!!

TextureLoader contains method called CheckTextureRequirements which gave an

Answer:

Format:Not L16 or L8, but A8R8G8B8
NumberOfMipmapLevels : Not 0, but 1

Share this post


Link to post
Share on other sites
Sorry I want to write GPU. But as you already solved it I know the reason. Your GPU doesn’t support non power of 2 textures with mipmaps. Zero as mipmap count means generate as much mipmaps as needed to go down to 1*1 texel.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this