Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, alibaba, Quad), 761 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bmap_fill crashes on- and bmap_save doesnt save huge bitmaps #421023
04/08/13 17:08
04/08/13 17:08
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi,

I want to create and save a huge skybox texture, but I noticed that for heights > 1024px bmap_fill crashes and bmap_save doesn't save the bitmap. With the following example code you can reproduce it:

Code:
int main ()
{
	wait(3);
	
	int w = 2048; // works for 1024 and less!
	
	BMAP* b = bmap_createblack(w * 6, w, 8888); // or 24, format doesn't matter here
	if (b != NULL)
	{
		// bmap_fill(b, COLOR_BLUE, 100); // error: "Script crash in main"
		bmap_save(b, "bigblue.tga"); // nothing is saved
	}
}


Last edited by HeelX; 04/08/13 17:08.
Re: bmap_fill crashes on- and bmap_save doesnt save huge bitmaps [Re: HeelX] #421053
04/09/13 07:23
04/09/13 07:23
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
you nedd 3 tricks and it works (I had a lot of problems with where to use waits in image manipulations...):

Code:
#include <acknex.h>

int main ()
{
	level_load(NULL);
	wait(3);
	d3d_texlimit = 2048 * 6;
	
	int w = 2048; 
	BMAP* b = bmap_createblack(w * 6, w, 888); // or 24, format doesn't matter here
	wait(1);
	if (b != NULL)
	{
		bmap_fill(b, COLOR_BLUE, 100); 
		wait_for(bmap_fill);
		bmap_save(b, "bigblue.tga"); 
	}
}



but d3d_texlimit is 3d card dependent...

Last edited by sivan; 04/09/13 07:29.

Free world editor for 3D Gamestudio: MapBuilder Editor
Re: bmap_fill crashes on- and bmap_save doesnt save huge bitmaps [Re: sivan] #421059
04/09/13 09:28
04/09/13 09:28
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Sivan, thanks - I didn't thought about the impact of maximum texture size the 3D card. Though, d3d_texlimit is initialized with the highest possible texture resolution anyway. For my card it is 8192. So, when setting it to 6 * 2048 = 12288 it is obvious, that leads to an error, when bmap_save or bmap_fill are executed on such a huge bitmap.

Though, your code doesn't changed the behaviour of the script on my computer; bmap_fill still crashes and bmap_save doesn't produce any output file.

At least bmap_fill should check the bitmap dimensions first, in my opppinion. And the manual should refer to d3d_texlimit as constraint for both functions. At least it is written about bmap_save that the image size must be a multiple of 8.

Re: bmap_fill crashes on- and bmap_save doesnt save huge bitmaps [Re: HeelX] #421060
04/09/13 09:54
04/09/13 09:54
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
the strange thing is that my card gives also a max value of 8192, but setting it higher in this case works...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: bmap_fill crashes on- and bmap_save doesnt save huge bitmaps [Re: sivan] #421070
04/09/13 14:16
04/09/13 14:16
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
We'll look into this. If the texture dimensions are exceeded, it should give an error message, but not crash.

- BTW, it's always nice to randomly insert wait(3) calls in the code, especially after level_load(). Your PC certainly appreciates a 3 frame holiday after loading a heavy file. Players of my age will also be glad when the game doesn't start so fast. wink

Re: bmap_fill crashes on- and bmap_save doesnt save huge bitmaps [Re: jcl] #421071
04/09/13 14:55
04/09/13 14:55
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
apparently that wait is accidently there after copying and removing some lines


Free world editor for 3D Gamestudio: MapBuilder Editor

Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1