2 #include <msp/gl/extensions/ext_texture3d.h>
4 #include "pixelformat.h"
5 #include "pixelstore.h"
12 PixelStore::PixelStore():
21 PixelStore PixelStore::from_image(const Graphics::Image &img)
24 unsigned stride = img.get_stride();
25 unsigned ncomp = get_component_count(pixelformat_from_graphics(img.get_format()));
26 pstore.set_canvas_size(img.get_stride()/ncomp, 0);
27 pstore.set_alignment(min(stride&~(stride-1), 8U));
31 void PixelStore::update_parameter(int mask) const
38 glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
40 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, image_height);
44 glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
45 glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
47 glPixelStorei(GL_UNPACK_SKIP_IMAGES, skip_images);
50 glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
53 void PixelStore::set_canvas_size(unsigned w, unsigned h)
57 update_parameter(SIZE);
60 void PixelStore::set_origin(unsigned x, unsigned y, unsigned z)
63 static Require _req3d(EXT_texture3D);
67 update_parameter(ORIGIN);
70 void PixelStore::set_alignment(unsigned a)
73 update_parameter(ALIGNMENT);
76 void PixelStore::bind() const