Game Development Community

TGEA 1.8.1: (Texture profiles) KeepBitmap and Dynamic = Crash

by Stefan Lundmark · in Torque Game Engine Advanced · 02/28/2009 (7:03 am) · 5 replies

If you set a texture to be dynamic while also keeping the bitmap, you'll run into an assert when resetting the device. The surface which is passed when rebuilding the texture turns out to be invalid.

Taking away the KeepBitmap flag, and keeping a GBitmap object outside of the texture that is used to rebuild the texture upon reset, works. Should be the same with KeepBitmap, unless I'm misunderstanding how it works. :)

(To test, head into gFont and change the Static flag to Dynamic - resize the Window ingame and whoala)

#1
03/07/2009 (3:43 pm)
I'm not sure I'd call this a bug. What would the behavior of a dynamic texture which keeps its bitmap be anyways? Why would you use such a thing? If you have a dynamic texture, it should be changing at least once every frame, and the bitmap quickly becomes incorrect. And if you're changing it as frequently as you should, rebuilding the whole thing shouldn't be hard to do. Besides, once you work around the D3D9 assert, GFX itself will assert on "Inconsistent profile flags". I'm tempted to say the fix is to assert when you even try to create a texture profile which is Dynamic and KeepBitmap.
#2
03/08/2009 (1:05 am)
I'm not saying it should be either way, just that passing both of these params crashes the game simulation. ;-) And the otherwise verbose comments in the section about profile flags didn't mention it.

In our case, it was used for a terrain painter. If you don't paint anything, I can't see why it would have to change every frame. I'm probably misunderstanding the intended use of it, no problem.
#3
01/26/2010 (4:22 pm)
Can you explain this:

"keeping a GBitmap object outside of the texture that is used to rebuild the texture upon reset"

How do you rebuild the texture?
I have a GBitmap that I update, but I don't know how to get it into the existing texture object. Even if I use keepBitmap, the bitmap pointer in the texture object will no longer point to my GBitmap.

This is so much easier in Delta3d, Ogre3d, etc, etc... cmon Torque. You cost money, you should be easier to use.
#4
06/11/2010 (2:19 pm)
@#1 It is 100% a bug. Are you for real? You don't want to allocate new memory every frame just because you're changing the content of the buffer every frame!!!!!!!!
#5
06/11/2010 (2:20 pm)
@everyone including myself from January. I fixed this problem once in T3d 1.1 alpha... now it's back in t3d 1.1 beta 1. That's a pretty awesome improvement...