TexturePoly mod from Indiepath for DX9??

BlitzMax Forums/BlitzMax Programming/TexturePoly mod from Indiepath for DX9??

Matthew Smith(Posted 2011) [#1]
Hi,

Been playing with Tim's TexturePoly mod and wondering if anyone has been able to convert this to work with DX9?

I've taken a look but the DX7 and DX9 mods are quite different. I've managed to work out how to get the PrimaryDevice, but DrawPrimitive has differences, plus not sure how all this vertex stuff works.

Also I could just have no idea! Anyway hope someone may be able to help.


dmaz(Posted 2011) [#2]
Hey Matt, as you saw in the showcase post I did do a quick hack of Indie's texturedpoly for dx9 using Doug Stastny's driver. Mark's wasn't out then and anyway he shut his up pretty tight so I gave up the one time I tried to convert over. Doug's driver is slightly faster but running it now I notice certain anomalies when running under 9 that were not present when I originally released Rocks so I'm assuming my hack or doug's driver didn't stand up well with my video card driver updates...(?)

At one point I did do a quick glowline function that's completely driver independent but not as quick that I use now instead. Are you using it for textured poly or glowline?


Matthew Smith(Posted 2011) [#3]
dmaz,

Thanks for replying! I'm looking at using it for the glowline stuff. Haven't done any Blitz stuff for a while and wanted to look at doing a shooter of some sort.

Last edited 2011


Oddball(Posted 2011) [#4]
Check out my Odd2D module which has two textured poly routines that work with dx9, dx7 and ogl. The mod is in the public domain so you can either use it straight, rip the code you want or just look to see how it works. It's listed in my sig, but here are the relevant links in case you have sigs turned off.

Discussion thread
Direct download

Enjoy.


Matthew Smith(Posted 2011) [#5]
Oddball,

Thanks - I'll check that out!


dmaz(Posted 2011) [#6]
Nice Oddball... maybe you can add a primitive level glowline?

here is a high-level glowline
	Function GlowLine( x1:Float, y1:Float, x2:Float, y2:Float, s:Float=.6, ends:Int=True )
		Local length:Float = GetDistance2D(x1,y1,x2,y2)*.5
		Local angle:Float = GetAngle2D(x1,y1,x2,y2)

		SetRotation angle-90
		SetScale s,length
		DrawSubImageRect img,x1,y1,64,2, 0,35,64,1,img.width*.5,0
		
		If ends
			SetTransform angle-90,s,s
			DrawSubImageRect img,x1,y1,64,32, 0,0,64,32,img.width*.5,32
			SetTransform angle+90,s,s
			DrawSubImageRect img,x2,y2,64,32, 0,0,64,32,img.width*.5,32
		EndIf
		SetTransform 0,1,1
	End Function

	Function GetAngle2D:Float( X1:Float,Y1:Float,X2:Float,Y2:Float )
	         Local dx# = x2 - x1
	         Local dy# = y2 - y1
	         Return (ATan2(dy#,dx#)+360) Mod 360
	End Function

	Function GetDistance2D:Float( X1:Float, Y1:Float, X2:Float, Y2:Float )
		Local l1:Float = Abs(x1-x2)
		Local l2:Float = Abs(y1-y2)
		Return Sqr((l1*l1)+(l2*l2))
	End Function
here is the img needed.... in this function it can't just be the particle images that Indiepath used. image download

I quickly just ripped this out of my polygon library so you'll have to add an img param to the function.
here's an exe example.

Last edited 2011