Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
DirectX Error: TXFORM2 #403473
06/20/12 20:51
06/20/12 20:51
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
I am getting the error message "DirectX Error: TXFORM2" at runtime when i try to lock a bitmap with bmap_lock.

Heres what im doing:

BMAP* letter_bmap;

function main()
{ letter_bmap = bmap_create("georgia_font2.jpg");
wait(1);
bmap_to_format(letter_bmap,8888);
bmap_lock(letter_bmap,0);
}

Does anyone know what this error means?

Last edited by Caermundh; 06/20/12 20:52.
Re: DirectX Error: TXFORM2 [Re: Caermundh] #403479
06/21/12 03:27
06/21/12 03:27
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
I don't know what that error means exactly, but check if bmap_to_format actually worked.
If it returns 0, then the conversion failed.

Also, as you can read in the manual under "file formats", the use of the jpg is discouraged:
Quote:
JPG images should not be used for textures in realtime games. They combine all disadvantages of the other formats, plus the additional disadvantage of slow loading, high video memory consumption, and bad texture quality. Their only advantage is small file size.


Also:
Quote:
Also supported, but not recommended are BMP, PNG and JPG images - they are read through the DirectX library and thus depend on the DirectX version, and have other shortcomings. The selected image format does matter because all formats have their specific advantages and disadvantages:

So maybe DirectX loads them in a way so that you can't use bmap lock and other manipulation functions. You might want to try the same code with another file format.

Quote:
Recommended image formats are TGA, DDS, PCX and WAD.


Hope this helped.

Re: DirectX Error: TXFORM2 [Re: SchokoKeks] #403535
06/21/12 17:03
06/21/12 17:03
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
ok - did some testing. The bmap_to_format is not failing - its converting the bmap successfully. I also converted the file to .tga format - no luck, i still get the DirectX Error: TXFORM2.

Re: DirectX Error: TXFORM2 [Re: Caermundh] #403545
06/21/12 20:07
06/21/12 20:07
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
as it is described in the manual at bmap_lock page, it's not allowed to use bmap_lock before the first frame, and in your code there is no level loaded. put a level_load(NULL); in the beginning and a wait(1); it should work fine.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: DirectX Error: TXFORM2 [Re: sivan] #403546
06/21/12 20:09
06/21/12 20:09
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Originally Posted By: sivan
as it is described in the manual at bmap_lock page, it's not allowed to use bmap_lock before the first frame


He put a wait(1) in the code above.

Originally Posted By: sivan
and in your code there is no level loaded. put a level_load(NULL); in the beginning and a wait(1); it should work fine.


That is really not needed as it should not have any effect on the 2D functions.

Re: DirectX Error: TXFORM2 [Re: sivan] #403547
06/21/12 20:17
06/21/12 20:17
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
Im loading a level, and doing a wait(1); after loading it. I just didnt include that code or the other things im doing in main as they didnt seem pertinent to the problem.

Re: DirectX Error: TXFORM2 [Re: Caermundh] #403548
06/21/12 20:35
06/21/12 20:35
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
hummmm....well i found a fix - but its a strange one. I put the bmap_lock in a subroutine with the bmap its locking passed as a parameter and now it works fine.

Heres the code:

function my_bmap_lock_func(BMAP* letter_bmap)
{ bmap_lock(letter_bmap,0);
....
<bitmap manipulation code goes here>
....
return;
}

function main()
{ BMAP* letter_bmap;
level_load("my_level.wmb");
wait(1);
letter_bmap = bmap_create("georgia_font2.tga");
wait(1);
bmap_to_format(letter_bmap,8888);
my_bmap_lock_func(letter_bmap);
}

so very very odd.....

Re: DirectX Error: TXFORM2 [Re: Caermundh] #403549
06/21/12 20:39
06/21/12 20:39
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
are you unlocking it?

Cause: "A bitmap must be unlocked for being visible on the screen."

This could cause the crash.

Re: DirectX Error: TXFORM2 [Re: Rei_Ayanami] #403551
06/21/12 21:07
06/21/12 21:07
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
yeah, im unlocking it later, at the end of the subroutine - or rather, before i was using a subroutine, i was unlocking it at the end of main, but seeing as how it was crashing on the bmap_lock() command, unlocking it seemed like a moot point.

Last edited by Caermundh; 06/21/12 21:08.
Re: DirectX Error: TXFORM2 [Re: Caermundh] #403570
06/22/12 07:39
06/22/12 07:39
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
strange. but I never had any reason to lock a bmap in main function laugh


Free world editor for 3D Gamestudio: MapBuilder Editor

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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