Which one is faster for you, run this code and tell me your FPS for each of the Tests:
The test are as follows:
my results are:
EDIT: I should say I have a really crapy Graphics Card (sapphire ATI 9600)
I ask because I want to know which one is fastest on a rage of different computers.
BTW if you find anything in the code that looks like it would make it an unfair test, can you please post the fixed code. Thx
' ////////////////////////////// ' // OpenGL V DirectX ' ______________________________ Global mapWidth% = 100 Global mapHeight% = 100 Global myMap:Int[,] = New Int[mapWidth, mapHeight] Global frameCount%, frameTimer%, fps% Global testImage:TImage ' TESTING RECT DRAWING ' ____________________ ' First test DirectX SetGraphicsDriver(D3D7Max2DDriver()) Graphics 1024, 768, 32, -1 While Not KeyHit(KEY_SPACE) Cls SetColor 0, 100, 0 For x% = 0 To mapWidth - 1 For y% = 0 To mapHeight - 1 DrawRect x * 6, y * 6, 5, 5 Next Next frameCount:+ 1 If frameTimer < MilliSecs() fps = frameCount frameTimer = 1000 + MilliSecs() frameCount = 0 EndIf SetColor 255, 255, 255 DrawText "FPS By DirectX = " + fps, 10, 10 DrawText "Press spacebar to test OpenGL", (GraphicsWidth() / 2) - (TextWidth("Press spacebar to test OpenGL") / 2), 750 Flip if keyhit(KEY_ESCAPE) then end Wend EndGraphics() ' Second test OpenGL frameCount = 0 SetGraphicsDriver(GLMax2DDriver()) Graphics 1024, 768, 32, -1 While Not KeyHit(KEY_SPACE) Cls SetColor 0, 100, 0 For x% = 0 To mapWidth - 1 For y% = 0 To mapHeight - 1 DrawRect x * 6, y * 6, 5, 5 Next Next frameCount:+ 1 If frameTimer < MilliSecs() fps = frameCount frameTimer = 1000 + MilliSecs() frameCount = 0 EndIf SetColor 255, 255, 255 DrawText "FPS By OpenGL = " + fps, 10, 10 DrawText "Press spacebar to test DirectX image drawing", (GraphicsWidth() / 2) - (TextWidth("Press spacebar to test DirectX image drawing") / 2), 750 Flip if keyhit(KEY_ESCAPE) then end Wend EndGraphics() ' TESTING IMAGE DRAWING ' _____________________ ' First test DirectX frameCount = 0 SetGraphicsDriver(D3D7Max2DDriver()) Graphics 1024, 768, 32, -1 testImage = CreateImage(5, 5) SetColor 0, 100, 0 DrawRect 0, 0, 10, 10 GrabImage(testImage, 0, 0) SetColor 255, 255, 255 While Not KeyHit(KEY_SPACE) Cls For x% = 0 To mapWidth - 1 For y% = 0 To mapHeight - 1 DrawImage testImage , x * 6, y * 6 Next Next frameCount:+ 1 If frameTimer < MilliSecs() fps = frameCount frameTimer = 1000 + MilliSecs() frameCount = 0 EndIf DrawText "FPS By DirectX = " + fps, 10, 10 DrawText "Press spacebar to test OpenGL", (GraphicsWidth() / 2) - (TextWidth("Press spacebar to test OpenGL") / 2), 750 Flip if keyhit(KEY_ESCAPE) then end Wend EndGraphics() ' Second test OpenGL frameCount = 0 SetGraphicsDriver(GLMax2DDriver()) Graphics 1024, 768, 32, -1 testImage = CreateImage(5, 5) SetColor 0, 100, 0 DrawRect 0, 0, 10, 10 GrabImage(testImage, 0, 0) SetColor 255, 255, 255 While Not KeyHit(KEY_SPACE) Cls For x% = 0 To mapWidth - 1 For y% = 0 To mapHeight - 1 DrawImage testImage , x * 6, y * 6 Next Next frameCount:+ 1 If frameTimer < MilliSecs() fps = frameCount frameTimer = 1000 + MilliSecs() frameCount = 0 EndIf DrawText "FPS By OpenGL = " + fps, 10, 10 DrawText "Press spacebar to End", (GraphicsWidth() / 2) - (TextWidth("Press spacebar to End") / 2), 750 Flip if keyhit(KEY_ESCAPE) then end Wend End
The test are as follows:
Test1 - Tests shape drawing Test2 - Tests image drawing
my results are:
TEST 1: DirectX = 41 OpenGL = 102 TEST 2: DirectX = 41 OpenGL = 62
EDIT: I should say I have a really crapy Graphics Card (sapphire ATI 9600)
I ask because I want to know which one is fastest on a rage of different computers.
BTW if you find anything in the code that looks like it would make it an unfair test, can you please post the fixed code. Thx