Exemple #1
0
void texture_t::load_cube_map( vector<string> const & files_names )
{
   Magick::Image img;

   for (int i = 0; i < files_names.size(); ++i)
   {
      img.read(files_names[i]);

      int res_x = img.rows()
         ,res_y = img.columns();

      scoped_array<unsigned char> data(new unsigned char[res_x * res_y * 3]);

      if (i == 2 || i == 3)
         img.flip();
      else
         img.flop();

      img.write(0, 0, res_x, res_y, "RGB", CharPixel, data.get());

      glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

      glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16, res_x, res_y, 0, GL_RGB
                   ,GL_UNSIGNED_BYTE, data.get());
   }

   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
}
Exemple #2
0
// Orient an image's pixels as EXIF instructs
int base_orient(Exiv2::ExifData & exif, Magick::Image & img) {
	int orient = -1;
	try {
		orient = exif["Exif.Image.Orientation"].toLong();
		if (-1 == orient) {
			orient = exif["Exif.Panasonic.Rotation"].toLong();
		}
		if (-1 == orient) {
			orient = exif["Exif.MinoltaCs5D.Rotation"].toLong();
		}
	} catch (Exiv2::Error &) {}
	if (1 > orient || 8 < orient) {
		orient = 1;
	}
	switch (orient) {
		case 2:
			img.flop();
		break;
		case 3:
			img.rotate(180.0);
		break;
		case 4:
			img.flip();
		break;
		case 5:
			img.rotate(90.0);
			img.flip();
		break;
		case 6:
			img.rotate(90.0);
		break;
		case 7:
			img.rotate(270.0);
			img.flip();
		break;
		case 8:
			img.rotate(270.0);
		break;
		default:
		break;
	}
	return orient;
}
Exemple #3
0
void Magick::flopImage::operator()( Magick::Image &image_ ) const
{
  image_.flop( );
}