PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

2700G & MD3DM

Driving me nuts this is

note that is managed direct 3d mobile (C#)

Im trying to load a PVRTC4 texture into video memory in windows mobile 5. I've had success using P8 format. 9 hours later, I can't get this damn thing to work.
Code:

byte[] arr = new byte[teximgsize];
arr = br.ReadBytes(arr.Length);

MemoryStream ms = new MemoryStream(arr, 0, arr.Length, true, true);

Tex[y][x] = TextureLoader.FromStream(device, ms, teximgsize, texsize, texsize, 1, Usage.Texture, (Format)Utility.MakeFourCC('P', 'T', 'C', '4'), Pool.VideoMemory, Filter.None, Filter.None, 0);



Basically my teximgsize is set to 256 * 256 /2. this would equate to 4bpp that PVRTC4 is.

texsize is 256.

So I have a 2D array of textures to make up a large image bigger than 2048 x 2048.

The (Format) cast should be passing the correct value. My MakeFourCC was copied straight from micosoft's C# example.

The FourCC code is straight from PVR themselfs.

The texture was compressed from PVRTC library file, but anyhow, I'd assume you could throw any data at it and still operate?.

The error I get is 80004005 which is a GraphicsException.

Has anyone got this working? :?: [/code][/i]
Pool.Default or Pool.SystemMemory?
Thanks for the suggestion. Unfortunately no pools work... btw on compact framework other options are pool.SystemMemory and Pool.Managed.
Can use CheckDeviceFormat() to see if the format is available.
I was able to successfully create PTC2 & PTC4 textures on an Axim using the D3DM API. They need to be created from D3DMPOOL_VIDEOMEM though.
Code:
bool check = Manager.CheckDeviceFormat(0, DeviceType.Default, Format.R5G6B5, Usage.Texture, ResourceType.Textures, (Format)Utility.MakeFourCC('P', 'T', 'C', '4'));


the above returns true. I similarly can't create a surface with the PTC4 type on it. The only thing i havn't tried is full screen mode instead of window mode ... but then what's that got to do with it.
Just read on MS forum that format type is enforced you cant have FourCC types in MD3DM..... :(
I think the return value (check) only indicates successful execution of function, not acceptable format.

Try:

Code:

int hr;

bool check = Manager.CheckDeviceFormat(0, DeviceType.Default, Format.R5G6B5, Usage.Texture, ResourceType.Textures, (Format)Utility.MakeFourCC('P', 'T', 'C', '4'), out hr);

if (hr == ResultCode.NotAvailable)
//do something else
joshbu [MSFT] · 09 Dec 2005, 21:32 UTC
Burrito:

Can you post the return values from IDirect3DMobile::GetAdapterIdentifier on your system? I'm curious to see what driver you are running.

Thanks

Joshbu
Boy that was fun getting that running :)

Desc: 0x2611f5c4 "PowerVR D3DMobile HAL"
Version LowPart = 1310725
Version Highpart = 131072
DeviceID =1
VenderID = 0
Revision 0
SubSysID = 0

Hope that helps. Would be great to see support for this in MD3DM. Converting to CPP from here is out of the question for me.
joshbu [MSFT] · 20 Dec 2005, 19:07 UTC
burrito:

I spoke to Dave Wrighton, who is our managed guy, and he pointed me at this:


Managed Direct 3D Mobile enforces a restriction on the formats which can be used for Textures and Surfaces, and the restriction is that they must be one of the formats that is defined in the Format enumeration. This is done in order to be able to determine the size of the buffer for locking the data if the Lock command is called. This size is used to set the length of the GraphicsStream object, and can be used reliably to prevent code from accidentally overwriting the memory buffer that they can use. Unfortunately, as arbitrary FourCC codes do not contain the information to enforce these restrictions, they cannot be used to construct managed Texture or Surface objects.

David Wrighton
- .NET Compact Framework


Sorry. They are looking at changing this in the next rev of MD3DM, but for now you'll have to stick with the standard formats, or convert to c++.

Sorry I couldn't be more helpful.

joshbu[/quote]