Yo,
So basically I was messing around with some JPEG-glitching. I changed some bytes between the end of the JPEG header and EOF and tried to display the new image, but encountered access violations. Sometimes the image loading would work, sometimes it would not, and I can't figure out when and why.
This is a glitched image that makes the application throw an exception:
Here is a minimal example:
#include <SFML\Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(800, 600), "G-Glitch", sf::Style::Close);
sf::Texture tex; tex.loadFromFile("newpic.jpg");
sf::Sprite spr(tex);
sf::Event event;
while(window.isOpen()) {
while(window.pollEvent(event)) {
switch(event.type) {
case sf::Event::Closed:
window.close();
break;
}
}
window.clear();
window.draw(spr);
window.display();
}
return 0;
}
The weird thing is that the image displays just fine in my browser and native image viewer.. Can someone please explain this phenomenon?
I'm not linking debug code with release libraries or vice versa. I've been using SFML for a couple of years now. ;^)
~BZep
EDIT!:
Here is the original picture to actually prove that the other particular picture is causing misfits: