Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently using the Farseer tools to create a body from a Texture2D. However, my texture is a spritesheet and I need to get the uint array containing the colors from a portion of the full Texture2D.

Let's say may texture is 200x200 big and I need to get the colors in the Rectangle(20, 20, 40, 40). I know that there is a GetData() overload and I'd imagine I have to call it like this:

        uint[] subData = new uint[40 * 40];
        polygonTexture.GetData(0, new Rectangle(20, 20, 40, 40), subData, 0, 40*40);

However, I always get a "System.NotImplementedException", probably due to MonoGame. Is there another easy way to do this? Or do I have to create a Subtexture and then get the Colors from that subtexture?

Any help would be appreciated, thanks!

share|improve this question
2  
Ah, System.NotImplementedException. The classiest way of saying "couldn't be bothered". –  Anko Apr 15 '13 at 21:01
1  
The best way would be to implement the missing functionality in MonoGame so the next person to try this won't get a NotImplementedException. Be bothered ;) –  craftworkgames Apr 15 '13 at 23:55
    
This doesn't sound too bad, actually, although I don't really know much about DirectX/OpenGL, but I'll look into it. –  mreinfurt Apr 16 '13 at 19:38

1 Answer 1

I noticed this question has been around for a while unanswered so I thought I'd put some information here for future reference. It's not a complete answer, but it might help the next person.

Is seems there are a number of open issues with lots of discussion around this issue and why it's difficult to implement.

https://github.com/mono/MonoGame/issues/1405

https://github.com/mono/MonoGame/issues/644

https://github.com/mono/MonoGame/pull/1789

The primary issue is that OpenGL ES 2.0 does not support retrieving data from textures. However, it looks like there have been plenty of attempts to solve it and it may be solved now for some platforms. Not sure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.