FI_TRIANGLELIST bugged ?

Blitz3D Forums/Blitz3D Userlibs/FI_TRIANGLELIST bugged ?

Bobysait(Posted 2011) [#1]
It seems that we can't use FI_TRANGLELIST ( from FastImage )

It just renders nothing

Include "D:\Program Files\Blitz3D\bbSDK\INC\FastImage.bb"

Graphics3D 800, 600, 0, 2
InitDraw

Camera =	CreateCamera()

;MyPoly =	CreatePoly		( FI_NOWRAP, FI_TRIANGLELIST )
MyPoly =	CreatePoly		( FI_NOWRAP, FI_TRIANGLESTRIP )
			PolyPushPoint	( MyPoly, 100,100, $FFFF0000, 0,0 )
			PolyPushPoint	( MyPoly, 700,100, $2000FF00, 1,0 )
			PolyPushPoint	( MyPoly, 400,500, $200000FF, .5,1 )
			
			PolyPushPoint	( MyPoly, 700,100, $20FFFFFF, 0,0 )
			PolyPushPoint	( MyPoly, 100,100, $20FFFFFF, 1,0 )
			PolyPushPoint	( MyPoly, 400,500, $20FFFFFF, .5,1 )

Function CreatePoly(WrapStyle%, TriStyle%)
	Local Poly = CreateBank ( 20 )
			; start with no vertices
			PokeInt		( Poly, 00, 0 )
			; Set Wrap Style
			PokeInt		( Poly, 04, WrapStyle )
			; Set the Triangle render style
			PokeInt		( Poly, 08, TriStyle )
	Return Poly
End Function

Function FreePoly ( Poly% )
	FreeBank Poly
	Return 0
End Function

Function PolyAddPoint(poly, id%, x#,y#, c%, u#=0.0, v#=0.0)
	Local size = BankSize(poly)
	If size<20+20*id Then ResizeBank(poly, 20+20*id)
	If PeekInt(poly,0)<id+1 Then PokeInt(poly,0,id+1)
	Local f=20+20*id
	PokeFloat	(poly, f+00, x)
	PokeFloat	(poly, f+04, y)
	PokeInt		(poly, f+08, c)
	PokeFloat	(poly, f+12, u)
	PokeFloat	(poly, f+16, v)
End Function

Function PolyPushPoint(poly, x#,y#, c%, u#=0.0, v#=0.0)
	Local id=PeekInt(poly,0)
	PokeInt(poly,0,id+1)
	ResizeBank	(poly, 20*(id+2))
	Local f=20+20*id
	PokeFloat	(poly, f+00, x)
	PokeFloat	(poly, f+04, y)
	PokeInt		(poly, f+08, c)
	PokeFloat	(poly, f+12, u)
	PokeFloat	(poly, f+16, v)
End Function


While Not KeyHit (1)
	
	RenderWorld
	
	StartDraw
		
		SetBlend FI_ALPHABLEND
		
		SetAlpha 1.0
		drawpoly 50,50, MyPoly
		
	EndDraw 
	
	Flip
	
Wend

FreePoly MyPoly
DeinitDraw
End



Try this ( change FastImage include )
Run the code, then modify to
MyPoly =	CreatePoly		( FI_NOWRAP, FI_TRIANGLELIST )
;MyPoly =	CreatePoly		( FI_NOWRAP, FI_TRIANGLESTRIP )

and run again

vertices are declared, and the vertexcount is ( in theory ) good
... but nothing happend