Possible createtexture bug in blitz

Blitz3D Forums/Blitz3D Programming/Possible createtexture bug in blitz

Matty(Posted 2008) [#1]
Good Morning, (or day/evening whatever time it is wherever you are)

I thought it more appropriate to post this here, rather than in the showcase
area.

The following code looks like it doesn't work on some machines. Could people
please test this, and let me know if it works or falls over, preferably
running in debug mode. All it should do is create a texture, write to that texture
then exit. If nothing happens when you run the code that is good, and as
it should be.

If it gives an error, can you show which line it did so on, and also what
your graphics hardware is - intel on board video do not seem to like this.

Further - if this is a bug in blitz3d, not in my code, then I will post
this in the bugs thread.

Am I doing something the wrong way/or a way I shouldn't be doing it in?

Thanks,

Matt


graphics3d 800,600,32
AlphaTexture=createTexture(256,256,2+16+32)
setbuffer texturebuffer(AlphaTexture)
lockbuffer
For Y=0 To 255
	For X=0 To 255
		WritePixelFast x,y,0
		If y>180 And y<212 Then 
			If x>112 And x<144 Then
				distance#=Sqr((x-128)^2+(y-196)^2)
				If distance<=10 Then 
					WritePixelFast x,y,127 Shl 24
				Else
					If distance<=16 Then 
						WritePixelFast x,y,63 Shl 24
					Else
						If distance<=18 Then
							WritePixelFast x,y,31 Shl 24
						Else
							WritePixelFast x,y,0
						EndIf 
					EndIf 
				EndIf 
			EndIf 
		EndIf 	
	Next
Next
UnlockBuffer
SetBuffer BackBuffer()

end



Stevie G(Posted 2008) [#2]
Works fine here in debug mode and code looks solid enough. Intel Core 2 Duo, 2gb ram, WinXp Pro, Gforce8600gt.

If I remember correctly, there may be known issues when creating alpha flag set on some cards. I think you have to include the 1=colour flag also.

Stevie


Ross C(Posted 2008) [#3]
You should give lockbuffer a buffer to lock. That may cause problems with different graphics hardware. Same with unlockbuffer. I know it's optional, but i've seen the same thing happen with copyrect command, if you don't set buffers in that.


Buggy(Posted 2008) [#4]
Doesn't work, even when fixing the locking/unlocking. Must be the alpha flag.


Matty(Posted 2008) [#5]
I think I've worked it out, thanks for your help - it seems to be the alpha flag when not combined with the color flag.


Gabriel(Posted 2008) [#6]
Yep, the problem goes away here if you set the color flag too.


PowerPC603(Posted 2008) [#7]
Here the same problem, "buffer does not exist" when not using the color flag.
AlphaTexture=createTexture(256,256,2+16+32)

must be
AlphaTexture=createTexture(256,256,1+2+16+32)

for the createtexture command to work properly.

Graphics card: ATI X800XT Platinum Edition 256Mb.