Issue with CreateTexture with no color flag

Archives Forums/Blitz3D Bug Reports/Issue with CreateTexture with no color flag

Zethrax(Posted 2012) [#1]
I'm getting a 'Buffer does not exist' runtime error when using 'CreateTexture' without the color flag set and then calling 'SetBuffer TextureBuffer( tex )'. The return value from 'CreateTexture' is non-zero in this case, so the error can't be trapped.

I also couldn't find anything in the docs to say that the color flag is an absolute requirement and that texture creation would fail without it, so I'm assuming this is some sort of bug.

Tested with debug mode turned on in Windows 7. Video card is a Radeon 5770.


This code doesn't set a color flag for 'CreateTexture'.
This terminates with a 'Buffer does not exist' runtime error when the 'SetBuffer TextureBuffer( tex )' line is processed.
If texture creation failed then the return value from 'CreateTexture' should have been a zero so that the issue could be handled by the program, but that doesn't seem to be the case.
[bbcode]
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

ClearTextureFilters

tex = CreateTexture( 64, 64, 2 )
If tex = 0 Then RuntimeError "ERROR: CreateTexture failed."

SetBuffer TextureBuffer( tex ) ; The runtime error occurs on this line.

Print "OK - The texture was successfully created."

WaitKey : End
[/bbcode]


This code sets a color flag for 'CreateTexture' and doesn't terminate with a runtime error.
[bbcode]
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

ClearTextureFilters

tex = CreateTexture( 64, 64, 1 + 2 )
If tex = 0 Then RuntimeError "ERROR: CreateTexture failed."

SetBuffer TextureBuffer( tex ) ; No runtime error occurs on this line.

Print "OK - The texture was successfully created."

WaitKey : End
[/bbcode]


-

Last edited 2012


Yasha(Posted 2012) [#2]
No crash for me. I think this is one of those things that turned out to be hard to predict in practice, and doesn't fit into B3D's nice model of everything being unifiable under a simple interface.

The plus side is that at least there's an obvious immediate-term fix at the application level: if you want a monochrome texture, you can always load it with the colour flag anyway but then manipulate the pixels by hand to force it to be monochrome.


_PJ_(Posted 2013) [#3]
Are you using an actual ATi Radeon 5770 card, or is it an OEM Radeon 5770 GPU card or a 5770 chipset?