Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
-
joessu
- Posts: 5
- Joined: 2015-06-09T14:47:27-07:00
- Authentication code: 6789
Post
by joessu »
Very simple thing.
I am getting an odd result.
Code: Select all
Magick::Image im;
im.magick("PNG");
im.read(std::string(TEXTURE_DIRECTORY).append(desc.filename)); //"image.png"
w = im.columns();
h = im.rows();
unsigned char* data = new unsigned char[w*h*3];
im.write(0,0,w,h,"RGB", CharPixel, data);
tex.widths.push_back(w);
tex.heights.push_back(h);
tex.texData.push_back(data);
Here is the result in OGL:
looks like the format remains PNG? what am i missing?
-
magick
- Site Admin
- Posts: 11064
- Joined: 2003-05-31T11:32:55-07:00
Post
by magick »
Perhaps the image has an alpha channel. Try w*h*4 and RGBA.
-
joessu
- Posts: 5
- Joined: 2015-06-09T14:47:27-07:00
- Authentication code: 6789
Post
by joessu »
Ah, i thought that by declaring RGB in write that i could exclude the alpha channel?
EDIT: that didn't do it. the result is different but has same artifacts.
-
joessu
- Posts: 5
- Joined: 2015-06-09T14:47:27-07:00
- Authentication code: 6789
Post
by joessu »
When i write it to a png using im.write("test.png"), It writes it perfectly!!!
-
joessu
- Posts: 5
- Joined: 2015-06-09T14:47:27-07:00
- Authentication code: 6789
Post
by joessu »
Sorry for spamming, another bit of info. I know my texture code in opengl works because i was using SOIL to do the same exact thing before this
-
joessu
- Posts: 5
- Joined: 2015-06-09T14:47:27-07:00
- Authentication code: 6789
Post
by joessu »
So the issue appears to be in my use of the pixel data after this function exits.