Stuck again

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
timofimo
Posts: 7
Joined: November 27th, 2012, 9:02 pm

Stuck again

Post by timofimo » March 9th, 2013, 3:42 pm

I'm busy with lesson 20.
I followed every step but somehow my code reads the pixel data wrong.
It reads the whole file instead of just one pixel. It gives a blue red and green value of 3435973836.
please help!
Attachments
Sprite - TUT.rar
here is my code
(6.22 MiB) Downloaded 164 times

Conflictus
Posts: 53
Joined: January 7th, 2013, 8:09 am

Re: Stuck again

Post by Conflictus » March 10th, 2013, 1:42 pm

Code: Select all

//inside Bitmap.h

struct Pixel24
{ //all these unsigned int should be unsigned char
     unsigned int blue;
     unsigned int green;
     unsigned int red;
}
There may still be more wrong with it.

User avatar
Nosferatu
Posts: 36
Joined: July 25th, 2012, 7:08 am
Location: Slovakia

Re: Stuck again

Post by Nosferatu » March 10th, 2013, 2:15 pm

I think it is because of the padding. Don't know in which tut Chili mentioned, that *almost* every picture has padding at the end of one row. You need to jump over this padding because it's just some junk data and you don't want to load it. Maybe it is explained in the next tut.

Conflictus
Posts: 53
Joined: January 7th, 2013, 8:09 am

Re: Stuck again

Post by Conflictus » March 10th, 2013, 3:02 pm

The padding is mentioned in this tutorial, but i wasn't sure how far along he was in the video. The image should still load without padding.. it would just be distorted.

User avatar
Nosferatu
Posts: 36
Joined: July 25th, 2012, 7:08 am
Location: Slovakia

Re: Stuck again

Post by Nosferatu » March 10th, 2013, 5:07 pm

Yeah, I was judging by the look of drawn picture and the loading code.

Post Reply