Unable to create texture

BlitzMax Forums/BlitzMax Beginners Area/Unable to create texture

TAS(Posted 2012) [#1]
The map image is very large (4416x1860) and the canvas is relatively small. There's no notification, but the canvas remains blank and the output area generates a "D3DERR: Unable to create texture" for every Update_screen() call. I am assuming there's an image size limitation? What is it, does it depend on hardware? The code works fine with a smaller image or in BlitzPlus.

map_image=LoadImage("H:\bardia\media\BardiaMap.jpg")
If map_image=Null Then Notify("Map image failed to load")


col(Posted 2012) [#2]
Hiya,

Yeah, I'd look into the specs of your gpu card to see the Dx level supported then look for the maximum texture size. Dx9 cards only have to support up to a max of 4096x4096, however you may find newer cards that have a higher DirectX support will also support bigger textures under Dx9.


GfK(Posted 2012) [#3]
That image is insanely big, and an odd size. When loaded that will actually take up the same space as an image 8192 pixels wide, and at least 2048 pixels high.

A trick I use to get around things like this, it to use LoadAnimImage instead. For example, I have a 1024x768 image, and load and draw it in 256x256 segments. The upshot of this, is that you have a series of smaller tiles instead of one oddly-sized big-ass image.

Whether LoadAnimImage will work on an image of the size you're using, I don't know. But it's probably the way to go, before looking into alternatives.


Nice_But_Dim(Posted 2012) [#4]
Power of 2 textures to be safe on all graphics cards,and systems.


GfK(Posted 2012) [#5]
Power of 2 textures to be safe on all graphics cards,and systems.
...and square textures if you have any interest in supporting ancient hardware such as old Voodoo cards.


Nice_But_Dim(Posted 2012) [#6]
If someone has a Voodoo card these days that is ANCIENT.


Nice_But_Dim(Posted 2012) [#7]
Damn im chatting with the enema (i mean enemy).


TAS(Posted 2012) [#8]
Thanks all,
I adapted tesuji's BigImage.bmx code to handle it all in the background and automatcially so I am code now. It just would have been nice to get an error message rather than a black screen but the cause was easy to guess.