PDA

View Full Version : CL_PixelBuffer::get_pixel() weird results...



Otto (Strange) Halmén
11-19-2006, 01:32 PM
I have attached a screenshot of a strange result when using the function CL_PixelBuffer::get_pixel(). To the right there is a CL_Surface object drawn with CL_Surface::draw(), in the middle you can see a bit of the blue background, and to the left there's the pixelbuffer drawn with this code:


for (int i = 0; i < buffer.get_height(); i++)
{
for (int j = 0; j < buffer.get_width(); j++)
{
gc->draw_pixel(j, i, buffer.get_pixel(j, i));
}
}

...where gc is a pointer to the graphic context and buffer is a CL_PixelBuffer object obtained from the surface by CL_Surface::get_pixeldata(). I've called CL_PixelBuffer::lock() before getting the pixels, as told in the reference manual. I've even tried calling unlock(), and calling neither lock() nor unlock(), but the results are the same: CL_Surface::draw() shows the original PNG image as it appeared when I saved it, but CL_PixelBuffer::get_pixel() gives strange results. Is this a bug or have I done something wrong?

BTW, the image was edited from Super Mario 64 textures.

Seth
11-20-2006, 01:35 AM
Hmm, interesting. Sounds like a bug - are you using the latest SVN 0.8?

Could you possibly attach a sample app source zip showing the problem? (could use the Basic2D example as the base..)

Otto (Strange) Halmén
11-20-2006, 05:48 AM
I am using the latest stable version of ClanLib 0.8 (no SVN, downloaded it from ClanLib's home page). Attached is a zip with the source file (containing the code that I already quoted) and the PNG texture file.

Seth
11-20-2006, 06:29 AM
I ran it and it works correctly here. (winxp, radeon 800 XL) (both images look identical, not washed out or weird alpha values)

If possible, please try it with the SVN 0.8, when I added the BMP loader I did fix some long standing pixel conversion issues...

If that doesn't fix it, it may be a specific video card issue.

PS: A file called ".bricks.png" was included in your zip in the __MACOS dir, I tried it too, but the PNG loader asserted it was a bad png.

Otto (Strange) Halmén
12-06-2006, 07:36 AM
Trying to download the latest SVN 0.8 gives me an error:


Safari ei voi avata kohdetta ”svn://esoteric.clanlib.org/ClanLib/Development/ClanLib-0.8”, koska Mac OS X ei tunnista internet-osoitteita, jotka alkavat ”svn:”.

That is:


Safari is unable to open the location ”svn://esoteric.clanlib.org/ClanLib/Development/ClanLib-0.8”, because MacOS X is unable to identify paths beginning with ”svn:”.