Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / make memblock from image uses wrong image size

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Mar 2008 00:58 Edited at: 22nd Mar 2008 01:00
As reported in the following thread by Joseph

http://forum.thegamecreators.com/?m=forum_view&t=126356&b=1

when a non-power-of-two image is loaded without the texture flag set DBP rescales the image sizes to the next highest powers-of-two (this is standard DBP behaviour). However, if the make memblock from image command is then used in the usual way the the new image is used with the original image sizes. This means that the image is clipped even though the re-scaled image can be saved and used correctly in other ways.

The following code illustrates the problem: the program loads a 100x200 image and automatically rescales it to 128x256 and saves this as "memblockimage1.png". The same loaded image is then converted to a memblock and back again to an image which is then saved as "memblockimage2.png". If you compare the images you will see that the second saved version is a clipped version of the new scaled image, i.e. make memblock from image uses the top left section of the image corresponding to the size of the original image. It should be using the new re-scaled version of the image.



A test image is attached - but any non-power of two image will give the bug.

[Edit: corrected link.]

Attachments

Login to view attachments
trogdor
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: Portsmouth, VA, USA
Posted: 9th May 2008 04:30 Edited at: 16th Oct 2008 20:44
Works fine on my home machine Nvidia 7800 GS.
But fails on my work machine Quadro 1000, and work laptop ATI X300.

I also tried a 3280x3280 png and that one failed on my work machines and worked fine on my home computer. So I dont know what that means for the power-of-two images.

Edit:
I was happy coding at home, everything worked fine. Now I know if I deploy my game, lots of people will have bugs

Edit2:
Just tested on ATI Radeon HD 2400 Pro, and like my Nvidia 7800 GS works fine.

If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th May 2008 13:44
It means that a lot of graphics cards have lower limits - your card probably has a limit of 4096x4096 for textures while others have 2048x2048, or if they are really old cards, maybe even lower.

Pixel Paint
16
Years of Service
User Offline
Joined: 15th Sep 2007
Location:
Posted: 12th May 2008 00:51
It happened to me in a program that I made, so I had to make a function that added black to btm and right edges of the image so it wouldn't resize while it was being modified. Then I modified Ian's "save bitmap()" function to save it without the black. The problem with that was that the user could only save in bitmaps. If this was fixed then that would be really nice.

Login to post a reply

Server time is: 2024-04-26 21:52:06
Your offset time is: 2024-04-26 21:52:06