Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - stoikheion

Pages: [1]
1
Graphics / Arbitrarily split an image?
« on: July 03, 2010, 12:45:45 am »
Thanks for the tip! Do you think it makes the most sense to look at implementation for sf::Sprite::SetSubRect, and modify the sf::Sprite class directly? This would require recompiling SFML, but it might be easier to access the underlying OpenGL texture data used in sf::Sprite.
Alternatively, should I create a subclass from sf::Sprite in my own code, and manipulate the texture coordinates used in sf::Sprite from there? I don't know if I should consider the possibility of committing this change, if it works well and is usable in a lot of scenarios.

2
Graphics / Arbitrarily split an image?
« on: July 01, 2010, 09:22:07 am »
Hello everyone,

I'm trying to "split" a sprite into two separate entities, as if I were to cut across one with a knife. This would be a fairly easy problem if I could allocate new images for each split, but since I want this to happen for several sprites at once, all using the same texture, allocating several pairs of new images seems very silly and inefficient. This is a visual example of what I'm trying to accomplish:

The red line across which the sprite is split could be at any angle (and hopefully in the future multiple lines, like a jagged line), and the two images in the third panel would be separate and independent.

I feel like the use of texture coordinates would simplify what I'm doing, but I haven't gone source-diving into SFML enough to know what modifications I would make, and I wanted to see if there's an easy way to do this that I'm overlooking. I can't create a pixel mask, since that would allocate a new image, but maybe I could make some sort of simple vector mask using sf::Shape?

If anyone could provide any general suggestions, references, or hints, that would be fantastic. Thanks in advance!

Pages: [1]
anything