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.

Dark GDK / Odd problem with dbMakeImageFromMemblock with images above 256x256 reso

Author
Message
Fatal Berserker
13
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 20th Jan 2012 21:23 Edited at: 21st Jan 2012 02:11
Ok so, i am generating a heightmap.
Now for all resolutions below 255, it works.

What i have atm is im storing all the pixels in a 2d array, then converting it into a memblock once ive set up the array. Then turning the array to an image.

Now like i said for all resos below 255 it works.
But when i make it 256+, it compiles, no errors, but the image is corrupt or smth, and is very small and doesnt open.
Now when i look in the array, it is storing all the information 100% perfect.

So either GDK is being lame or its my array to memblock conversion.

Heres the code:




Its ment to be a shade of gray, thats why RBG are all the same.

Heres a pic:
On the left is 256x256, on the right is 255x255

(Nodes == Pixels btw, idk why i called it nodes)



Its funny how many bugs you fix when you arnt even trying to fix them, well im not closer to figuring this out, it looks like its a problem with the GDK.

Attachments

Login to view attachments
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jan 2012 04:47
Try changing this:
dbWriteMemblockByte(_MemblockNumber,0,Width);
dbWriteMemblockByte(_MemblockNumber,4,Height);
dbWriteMemblockByte(_MemblockNumber,8,ImageDepth);
to:
dbWriteMemblockDword(_MemblockNumber,0,DWORD(Width));
dbWriteMemblockDword(_MemblockNumber,4,DWORD(Height));
dbWriteMemblockDword(_MemblockNumber,8,DWORD(ImageDepth));


The way WORD and DWORD are stored are kinda weird. It has to do with high-order bits.... Basically, the number looks reversed going from the left to right low to high.

The fastest code is the code never written.
Fatal Berserker
13
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 21st Jan 2012 04:53
You sir, are a gentleman and a scholar.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Jan 2012 05:05
Ahh I see you did

Login to post a reply

Server time is: 2024-04-20 07:51:27
Your offset time is: 2024-04-20 07:51:27