Problem with Scale and OpenGL
Posted: 2007-12-31T08:18:31-07:00
I have a little OpenGL application which uses ImageMagick for loading images. The only problem is that after scaling the image looks really strange. Without scaling it works perfectly.
I know it's no imagemagick error, because if I write the scaled version into a new file it looks ok. But maybe somebody knows what the scaling function does - because I have no idea why it doesn't work after the scaling.
My code:
And here the images (first not scaled, second scaled):
I know it's no imagemagick error, because if I write the scaled version into a new file it looks ok. But maybe somebody knows what the scaling function does - because I have no idea why it doesn't work after the scaling.
My code:
Code: Select all
Magick::Image image;
image.read(Magick::Geometry(info->new_size, info->new_size), info->file_info.absoluteFilePath().toStdString());
image.scale(Magick::Geometry(info->new_size, info->new_size));
Magick::Blob blob;
image.magick("RGBA");
image.write(&blob);
image.write("c:/testtest.jpg");
glBindTexture(GL_TEXTURE_2D, info->texture_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8 , image.columns(), image.rows(), 0, GL_BGRA, GL_UNSIGNED_BYTE, blob.data());