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:
dbMakeMemblock(_MemblockNumber,12 + ((Width*Height)*4));
dbWriteMemblockByte(_MemblockNumber,0,Width);
dbWriteMemblockByte(_MemblockNumber,4,Height);
dbWriteMemblockByte(_MemblockNumber,8,ImageDepth);
... ... ... ...
int i = 0;
for (int Y = 0; Y < Height; Y++)
{
for (int X = 0; X < Width; X++)
{
Tiles[X][Y] = (Tiles[X][Y] < 0) ? 0 : Tiles[X][Y];
Tiles[X][Y] = (Tiles[X][Y] > 255) ? 255 : Tiles[X][Y];
dbWriteMemblockByte(_MemblockNumber,12 + i * 4,Tiles[X][Y]); //B
dbWriteMemblockByte(_MemblockNumber,13 + i * 4,Tiles[X][Y]); //G
dbWriteMemblockByte(_MemblockNumber,14 + i * 4,Tiles[X][Y]);//R
dbWriteMemblockByte(_MemblockNumber,15 + i * 4,255);//A
i++;
}
}
dbMakeImageFromMemblock(ImageNumber,_MemblockNumber);
dbPasteImage(ImageNumber,10,10);
dbSprite(1,10,10,ImageNumber);
dbSizeSprite(1,300,300);
dbSaveImage("TerrainHeightMap.bmp",ImageNumber);
dbDeleteMemblock(_MemblockNumber);
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.