Skip to main content
GameDev.net gamedev.net
🔒 Locked

TextureFromStream Mip Levels

Started by GoodFun Dec 8, 2008 at 4:28 PM 1 replies 950+ views
Original Post
GoodFun
GoodFun
Hi there, I just found something strange with my texture maps. When I create them, I specify mip levels = 1, I then save them to a dds file, zip them, load them in another program into a stream, unzip the stream and then create a texture from the unzipped stream. When I now check the mip levels I get full mip levels, i.e. 12 - 14 levels depending on texture size. Is there a way to specify that I don't want mip levels??? Thanks Marcel [Edited by - GoodFun on December 9, 2008 2:38:32 PM]
GoodFun
GoodFun
I was thinking about this a bit more... do I have to load the texture into a temporary texture, copy the texture description, set the mip levels to 1, make a new texture with that description, copy the texture over and destroy the temporary texture???
GoodFun
GoodFun
Did some tests, this is the code that works but creates full mip levels:

using D3D10 = SlimDX.Direct3D10;private D3D10.Texture2D _texture;private D3D10.ShaderResourceView _textureView;_texture = D3D10.Texture2D.FromStream(device, stream, (int)stream.Length);_textureView = new D3D10.ShaderResourceView(device, _texture);

Then I tried to load the texture into a temp texture, copy the texture description, set the mip levels to 1, create a new texture, copy the texture over and use that... but for some reason that doesn't work... well, it renders but none of the datas shows up and no errors in DebugView
D3D10.Texture2D tempTexture = D3D10.Texture2D.FromStream(device, stream, (int)stream.Length);D3D10.Texture2DDescription tempTextureDesc = tempTexture.Description;tempTextureDesc.MipLevels = 1;_texture = new D3D10.Texture2D(device, tempTextureDesc);device.CopyResource(tempTexture, _texture);tempTexture.Dispose();_textureView = new D3D10.ShaderResourceView(device, _texture);

Any help would be greatly appreciated

[Edited by - GoodFun on December 9, 2008 2:10:33 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.