Game Development Community

GUI bitmap values good pointer goes bad

by Andy Hawkins · in Torque Game Engine Advanced · 04/22/2008 (6:38 am) · 2 replies

I'm trying to add some bitmaps to the GuiReticleHud Gui control but when I try to add the bitmap to the texture object I get a bad pointer. I've copied the code from GuiRadarCtrl and checked it against GuiBitmapCtrl and they seem the same.

When the function starts the mRecticleBitmapName is populated with the string to the bitmap as expected, but the moment it sets the mRecticleTextureObject it becomes a bad pointer - but the radar one doesn't. What do I need to do to make it "stick". See pic below for watch window and code. The strange thing is, I can see the bitmap in the game, but it crashes when I try to go to the GUI editor (F10)

www.drewfx.com/Torque/BadPointerGUI.JPG

#1
04/23/2008 (4:09 pm)
Some of the TextureProfile's will delete the bitmap after it uploads the data to GFX/D3D and some won't. I suspect you are running into this issue. Either that or you never had a valid bitmap (somehting wrong with the bitmap name or path).
#2
04/23/2008 (5:13 pm)
Is there an idea place to store the images for GUI? Maybe I should start from scratch by creating a new ctrl based on the BitmapCtrl and see where it starts deleting the bitmap