[Magick++] flop() corrupts glTexture

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dennis2society

[Magick++] flop() corrupts glTexture

Post by dennis2society » 2006-12-13T12:47:43-07:00

i am using magick++ to load images, add some text-label to the image
and finally loading this image as a texture into an opengl program.
while this worked really fine in linux, i am currently experiencing
the problem that the flop-function corrupts my texture.

this code works great, also with loading the texture:

Code: Select all

Magick::Image texImage("bricks.png");
texImage.strokeWidth(1);
texImage.strokeColor("black");
texImage.draw( Magick::DrawableText(1, 25, "my text") );
//texImage.flop();
texImage.magick("RGB");
texImage.write(&textureBlob);
 
the result looks like this:
Image

but when i flop() the image to have the text in the right orientation
the result looks like this:
Image

what is wrong inside the flop-function? the same code works great in
linux and the resulting image can be written to disk correctly. only the
texture itself seems to be corrupted.
i am confused :?:

User avatar
magick
Site Admin
Posts: 10865
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-12-13T13:02:16-07:00

glTexture may be expecting 8-bit pixels. When you flop() the pixels may be promoted to 16-bits per pixel assuming you are using the Q16 version of ImageMagick. Use the Q8 version or set your image depth back to 8 after you flop() it.

dennis2society

Post by dennis2society » 2006-12-13T13:13:56-07:00

thanks.
that did it.
:)

Post Reply