The example DrawPixel code has this for 16 bpp:
bufp = (Uint16 *)screen->pixels + y*screen->pitch/2 + x;
Why pitch? What exactly is pitch? I have an idea but it’s been awhile
since I did graphics.
Why can’t you just use the w member?
bufp = (Uint16 *)screen->pixels + y*screen->w + x;--
Marc A. Lepage
http://www.antimeta.com/
Minion open source game, RTS game programming, etc.
“Marc A. Lepage” wrote:
The example DrawPixel code has this for 16 bpp:
bufp = (Uint16 *)screen->pixels + y*screen->pitch/2 + x;
Why pitch? What exactly is pitch? I have an idea but it’s been awhile
since I did graphics.
Pitch is the width of the memory buffer, which can be larger than the
width of the surface. For instance, if the hardware internally has
640x480 buffers, but you ask for 128x128, the width would be 128, but
the pitch is 640. You’d only want to draw in your 128x128 patch, so
you have to use width to figure out how much space you can draw in,
but pitch for figuring out where in memory to draw in.
HTH.
Why can’t you just use the w member?
bufp = (Uint16 *)screen->pixels + y*screen->w + x;
Tim aka “Manax”–
“Though you die, La Resistance lives on” - SP:BL&U