I have a Bitmap of size 3750x1407, it is loaded as Bitmap into memory with a padding of 2 bytes, so it is of length (3752*1407) bytes in memory. When using PixelUnpackBuffer to fill my textures, do I need to copy the padding bytes as well or can I just skip them?
GL.BindTexture(TextureTarget.Texture2D, texId);
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, pboId[currentIndex]);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bitmap.Width, bitmap.Height, PixelFormat.Luminance,
PixelType.UnsignedByte, IntPtr.Zero);
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, pboId[nextIndex]);
BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.ReadOnly, bitmap.PixelFormat);
GL.ColorTable(ColorTableTarget.ColorTable, PixelInternalFormat.Luminance, _colorTable.Length, PixelFormat.Luminance, PixelType.Byte, new IntPtr(_colorTable[0]));
IntPtr buf = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly);
if (buf != IntPtr.Zero)
{
//---------------------------------------- Currently copying padding bytes--------------------------------------------- //
memcpy(buf, bitmapData.Scan0, new UIntPtr((uint)(bitmapData.Stride * bitmap.Height)));
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
}
bitmap.UnlockBits(bitmapData);
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);