slow drawing

BlitzMax Forums/BlitzMax Programming/slow drawing

slenkar(Posted 2008) [#1]
whenever I draw a few sprites that are about 200x200 pixels my program slows down, this is especially true for 200x200 sized particles where the game slows to a crawl.

I tried switching the driver to opengl but the image masks become visible and I think its even slower.

Is there a free alternative 2d engine?


Thareh(Posted 2008) [#2]
I'd say either your code is wrong, or you're drawing ALOT of particles :P


ziggy(Posted 2008) [#3]
Can you post a simple example code in order for us to help you find what's wrong?


slenkar(Posted 2008) [#4]
SetGraphicsDriver D3D7Max2DDriver () 

Graphics 640,480



wall=LoadImage("wallwood1.bmp")


While Not KeyHit(KEY_ESCAPE)
Delay(1)

curTime =MilliSecs()
If curTime > checkTime Then
	checkTime = curTime + 1000
	curFPS = fpscounter
	fpscounter = 0
Else
	fpscounter = fpscounter + 1
End If


'SetBlend(LIGHTBLEND)
Cls

For x=1 To 10
For y=1 To 10
DrawImage wall,x*50,y*50
Next
Next
DrawText"FPS: "+curfps, 0,0
Flip False
Wend
End



I get about 40FPS with directx
and 33fps with openGL
(I used an image that is 144x200)


Thareh(Posted 2008) [#5]
I get 332 FPS with DirectX and around 500 with OpenGL driver :P


Jesse(Posted 2008) [#6]
first:
why do you have a delay in your loop?
how fast is you computer? I get 330fps in debug mode with the delay and 555 without the delay in debug mode. I didn't even try it in release mode.


Thareh(Posted 2008) [#7]
Delay is to spare the CPU some I guess ;)


slenkar(Posted 2008) [#8]
I have the delay to return processing power back to the OS.


Ive got a 2.5GHZ processor and a 64MB intel graphics card
the PC is about 5 years old but enough to draw those images I would hope.


ziggy(Posted 2008) [#9]
Try removing the Delay(1) for starters.


Jesse(Posted 2008) [#10]
I think your graphics card is the cause of your problem. you need a more capable card. trash it and get a newer one :)


slenkar(Posted 2008) [#11]
I just tried irrlicht for 2d and its just as slow(!)


xlsior(Posted 2008) [#12]
341 FPS on my computer...

When you say "64MB intel graphics card", do you mean "integrated video adapter with 64MB of shared memory"?

If so -- those are dead slow.


slenkar(Posted 2008) [#13]
shame, sprite candy could probably handle it


Jake L.(Posted 2008) [#14]
If B3D (SpriteCandy) runs faster, you're having a problem with OpenGL. I guess your OpenGL driver isn't worth it's name or -worse- OpenGL runs in sofware emulation mode. Try to update it or use "Setgraphicsdriver DX3D7Max2DDriver()" to force Blitzmax to use DirectX and see if that helps.

You can't blame the software if drivers and/or hardware are crap...


Dreamora(Posted 2008) [#15]
BM needs a 3D card as does Blitz3D with Sprite Candy ... sadly you have a 2D card (intel still tells different, its feature table as well. but features with no acceptable performance are kind of pointless) and that makes it hard to do that kind of stuff ... on an intel it might even fallback to microsoft 1.1 opengl emulation


Jake L.(Posted 2008) [#16]
@Dreamora: My office PC has a Intel GM965 and it performs quite well with Blitzmax. But I had to install OpenGL drivers, they don't came with the box.


Dreamora(Posted 2008) [#17]
Only till you come up with the idea to do particles or something else that does a fair amount of overdraw ... then the low bandwidth CPU to VGA/DVI adapter from intel will die and if not directly due to the bandwidth then because it does not have any usefull / performant alpha early drop mechanism as ATI / NVIDIA for 2+ generations now.


MGE(Posted 2008) [#18]
200x200 is pretty big for particles or sprites. Especially on older machines. Try using a much smaller size.


slenkar(Posted 2008) [#19]
thank ill give it a try


K@li(Posted 2008) [#20]
blitzmax is very slow


better use irrlicht


GfK(Posted 2008) [#21]
blitzmax is very slow


better use irrlicht
You dug up a 7 month old thread just to satisfy your urge for a spot of Blitzmax hatemongering?

What's the point? Go away if you don't like it.


smilertoo(Posted 2008) [#22]
Blitzmax is quite fast at 2d if youre using a decent/recent system.


MGE(Posted 2008) [#23]
There is nothing in bmax to make it faster or slower than any other raw "2d via 3d" system. You're at the mercy of the DX7 , OGL driver. Plain and simple....


Gabriel(Posted 2008) [#24]
blitzmax is very slow
better use irrlicht


Given that - according to this thread ( http://www.blitzbasic.com/Community/posts.php?topic=63890 ) - you've spent a year waiting for an answer on how to make "matriced terrain", I'm not entirely convinced that your experience with Irrlicht is extensive enough for me to consider you an authority on the subject. I also wonder whether - given your predicament - you really want to be throwing stones with "slow" written on them.


Retimer(Posted 2008) [#25]
There is nothing in bmax to make it faster or slower than any other raw "2d via 3d" system. You're at the mercy of the DX7 , OGL driver. Plain and simple....

^
What he said.
And you are certainly few on that opinion, K@li.


slenkar(Posted 2008) [#26]
i did a test with Irrlicht and it was a lot slower than blitzmax for 2d


K@li(Posted 2008) [#27]
a simple tile engine was 1000% faster in irrlicht (using 2d commands) than blitzmax 1.30 !!!

Tested !

ps : il like blitzmax for the rad system
but the graphical engine is poor in execution time

i tryed irrlicht in C++ (veru butiful engine) and contunu to work with in blitzmax


plash(Posted 2008) [#28]
^ The jist of it: learn English..

BTW the delay call has almost no effect on the speed of the application, it just insures your computer doesn't become unresponsive.


MGE(Posted 2008) [#29]
"a simple tile engine was 1000% faster in irrlicht (using 2d commands) than blitzmax 1.30 !!!"

I'd say that was your fault, not Bmax. ;)


K@li(Posted 2008) [#30]
???

the SAME engine, only replaced the DRAW command by DrawRect (irrlicht drax command)

and.......... hop !!

1000% gain !!!! (twice in Directx mode)

AND you ask this is not the fault of BLitzmax 2d engine ????

Please, test before speak.


MGE(Posted 2008) [#31]
Could you post the source and the .exe for both versions so we can test them? Thanks!


tonyg(Posted 2008) [#32]
I'd be interested to see the Bmax source as well.


MGE(Posted 2008) [#33]
Let's keep in mind Irrlicht does not support DX7 rendering. It uses DX8, DX9, OGL. (Plus software rendering fall back support.)

Dx8 and especially Dx9 is faster than DX7, which is what BMax uses. So in that respect, sure there will be a speed increase.


K@li(Posted 2008) [#34]
DX9 is used, yes.

the finality, is to have a engine fastest as possible (300fps irrlicht) 30 fps blitz (!)

understand that i find Blitzmax VERY POWEFULL but as a poor (OLD of course) graphic engine

why no upgrade th blitz engine to DX9 ?


Gabriel(Posted 2008) [#35]
Please, test before speak.

Sure. Please provide the test, and I will.


RiK(Posted 2008) [#36]
I got something in the region of 830fps.

If that's not quick enough then I guess we've got big problems ;)


Kurator(Posted 2008) [#37]
aprox. 330 with delay(1)
aprox. 660 without delay(1)

aprox. 510 with delay(1) - GLMax2DDriver()
aprox. 2500 (!!) without delay(1) - GLMax2DDriver()

nv 8800 gts, Q6600, xp32


RiK(Posted 2008) [#38]
Taking out the delay I get between 2800 and 3100 fps.


plash(Posted 2008) [#39]
aprox. 330 with delay(1)
aprox. 660 without delay(1)

aprox. 510 with delay(1) - GLMax2DDriver()
aprox. 2500 (!!) without delay(1) - GLMax2DDriver()
o.O


RiK(Posted 2008) [#40]
Ooh, scratch that, was a debug build.

Take that out and I'm getting something in the region of 3400 now ;)

I <3 my Mac :)


plash(Posted 2008) [#41]
240 DX -delay
300 DX -no delay

490 OGL -delay
1170 OGL -no delay

1 millisecond.. I guess I was wrong!


MGE(Posted 2008) [#42]
What test are you guys using?!?!


Kurator(Posted 2008) [#43]
The short code from Jeremy some postings above :)


tonyg(Posted 2008) [#44]
I'd take a guess at 'Jeremy Paxman - Yeeeeeeeees 's original code.


smilertoo(Posted 2008) [#45]
Delay
-----
969 fps in dx.
986 fps in opengl.

No Delay
--------
3057 fps in dx.
2983 fps in opengl.


MGE(Posted 2008) [#46]
That test is useless. Here's a more useful blit test, complete with layers and alpha.
SetGraphicsDriver D3D7Max2DDriver () 
'
Graphics 640,480
'
wall=LoadImage("tile.jpg") ' make sure it's a solid 32x32 tile
'
While Not KeyHit(KEY_ESCAPE)
 Delay(1)
 curTime =MilliSecs()
 If curTime > checkTime Then
  checkTime = curTime + 1000
  curFPS = fpscounter
  fpscounter = 0
 Else
  fpscounter = fpscounter + 1
 End If
 SetBlend(ALPHABLEND)
 Cls
 For layerstested = 1 To 10
  SetAlpha(.5)
  For x=0 To 19
   For y=0 To 14
    DrawImage wall,(layerstested*3) + (x*32),(layerstested*3) + y*32
   Next
  Next
 Next
 DrawText"FPS: "+curfps, 0,0
 Flip(0) ' False
Wend
'
End



Retimer(Posted 2008) [#47]
a simple tile engine was 1000% faster in irrlicht (using 2d commands) than blitzmax 1.30 !!!


Learn how to code a simple tile engine properly in blitzmax then.