I'd like to compare the cards/machines from MGE and Grey's thread with this executable here.
http://www.ooeyug.com/files/pstest.exe
ok I expected more of a difference. I'm no opengl expert but point sprites -seem- pretty easy. I may be doing something wrong. the code below won't compile since I used some of my util includes... just remove that code if you want to modify.
my results (fast computer/card)
GL 2.0
1
63
4024 DrawPointSprites
3450 DrawImage
this test doesn't have any texture switching... maybe it's just not worth it on my card.... oh alphablended point sprites seem to do almost the same as DrawImage on my card.
http://www.ooeyug.com/files/pstest.exe
ok I expected more of a difference. I'm no opengl expert but point sprites -seem- pretty easy. I may be doing something wrong. the code below won't compile since I used some of my util includes... just remove that code if you want to modify.
my results (fast computer/card)
GL 2.0
1
63
4024 DrawPointSprites
3450 DrawImage
this test doesn't have any texture switching... maybe it's just not worth it on my card.... oh alphablended point sprites seem to do almost the same as DrawImage on my card.
SuperStrict Framework brl.GLMax2D Import pub.glew Import BRL.RamStream Import BRL.BMPLoader Import brl.random Include "..\..\includes\FixedRateRender.bmx" Include "..\..\includes\debugUtil.bmx" SetGraphicsDriver GLMax2DDriver() Graphics 800,600,0 glewInit Local out:String If GL_VERSION_1_1 If GL_VERSION_1_2 If GL_VERSION_1_3 If GL_VERSION_1_4 If GL_VERSION_1_5 If GL_VERSION_2_0 out = "GL 2.0" Else out = "GL 1.5" EndIf Else out = "GL 1.4" EndIf Else out = "GL 1.3" EndIf Else out = "GL 1.2" EndIf Else out = "GL 1.1" EndIf Else out = "GL ?.?" EndIf Local fSizes:Float[2] GLGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, fSizes) For Local i:Float = EachIn fSizes out :+ "~n"+i Next Notify out Graphics 800,600,32 FRR.ResetCounters dinfo.textscale = 1 AutoMidHandle True Incbin "particle.bmp" Local image:TImage = LoadImage("incbin::particle.bmp") SetTexturePoint image For Local i:Int = 0 To 1000 New TPS Next SetClsColor 0,0,0 Local txt:String[] = ["DrawImage","DrawPointSprite"] Local pointSprite:Int = 1 While Not KeyHit(KEY_ESCAPE) Cls If KeyHit(KEY_S) Then pointSprite = 1 - pointSprite If pointSprite SetTexturePoint image glEnable GL_POINT_SPRITE glTexEnvi GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE glPointSize 19.0 glBegin GL_POINTS For Local t:TPS = EachIn TPS.list t.Update DrawPointSprite image,t.x,t.y,0 Next glEnd Else SetScale .3,.3 For Local t:TPS = EachIn TPS.list t.Update DrawImage image,t.x,t.y,0 Next EndIf dinfo.AddText "FPS: " + FRR.GetFPS() dinfo.AddText "[S]"+txt[pointSprite] dinfo.Echo Flip 0 Wend Function DrawPointSprite( image:TImage,x#,y#,frame:Int=0 ) Local orx:Float Local ory:Float GetOrigin orx,ory glVertex2f x+orx,y+ory End Function Function SetTexturePoint( image:TImage ) glBindTexture GL_TEXTURE_2D, TGLImageFrame(image.Frame(0)).name glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR glEnable GL_TEXTURE_2D End Function Type TPS Global list:TList = New TList Field x:Float = Rnd(10,GraphicsWidth()-10) Field y:Float = Rnd(10,GraphicsHeight()-10) Field dx:Float = Rnd(-.02,.02) Field dy:Float = Rnd(-.02,.02) Method New() list.AddLast Self End Method Method Update() x :+ dx ; If x < 0 Or x > GraphicsWidth() Then dx = -dx y :+ dy ; If y < 0 Or y > GraphicsHeight() Then dy = -dy End Method End Type
