Problem with Blitz 2D code running in Blitz Plus
BlitzPlus Forums/BlitzPlus Programming/Problem with Blitz 2D code running in Blitz Plus
| ||
I have a 2d app that I wrote in Blitz 3D, it doesn't use any of the 3D code. It runs in widowed mode. Techinally it should run in all versions of Blitz. Anyway, when I run it in Blitz plus, the graphic speed is so slow, it's literally like a frame a second. If I run the same app in blitz 3D, it runs at full speed. Has anyone experienced this? This is frustrating. |
| ||
Blitzplus uses a different format for images that is not as fast (managed images I think was the name). Someone worked around it by creating a hidden canvas and storing graphics on that. Search the forums for something like the word canvas and you should find it. |
| ||
dynaman is right. BlitzPlus loads images to a different area of memory, and as a result image manipulations can be slow. However, canvases are still fast (in fact they should be faster than Blitz2d), so you should use them instead. The next update to Blitz, according to marks worklog, should enable you to store the image in memory appropriate to what you intend to do with it. i.e. you'll be able to request that an image is in memory that makes it as fast as canvases. |
| ||
I had that experience last week when doing some r-type style thingy, in windowed mode (using graphics mode) it was nice 'n fast, but when running fullscreen it was really very slow! |
| ||
I haven't found B+ faster than B3d (2d mode), if anything it's considerably slower in canvas mode, not talking about the new pixel writing routines(haven't tried these yet). Although speed is OK for aplications and games. Also Mark S. is doing something about this. Also most games will run in full screen mode. But one frame a second seems ludicrous, are you sure you have turned debug off? |
| ||
yep |
| ||
@Craig, any chance to have a small piece of code that replicates the behaviour you are claiming ? It's really hard to guess what's going on without a code example. Sergio. |
| ||
Heres a fps test program I`ve written in B+ . With background of 600 Drawblock Tiles and 600 Sprite drawn with DrawImage I get 77Fps. Turn off the Drawblock routine and I get 120fps. This is on an 850Amd / 512mb / Geo2. ;Fps Test using canvas w=GadgetWidth(Desktop()) h=GadgetHeight(Desktop())-40 w2=640 h2=480 If w2 > w Then w2 = w If h2 > h Then h2 = h x1 = (w-w2)/2 y1 = (h-h2)/2 frametimer=CreateTimer(600) mainwindow=CreateWindow("Test Gfx",0,0,w,h,0,15) menu=WindowMenu(mainwindow) File = CreateMenu("File",0,menu) CreateMenu "Start",1,File CreateMenu "Exit",2,File UpdateWindowMenu mainwindow can=CreateCanvas(x1,y1,w2,h2,mainwindow) SetBuffer CanvasBuffer(can) Cls Repeat Select WaitEvent() Case $1001 Select EventData() Case 1 Exit Case 2 Notify "bye" End End Select Case $803 End End Select Forever Color 255,0,0 Rect 1,1,18,18,1 gfx=CreateImage(20,20,701) GrabImage gfx,0,0,1 Cls Color 0,0,255 Rect 0,0,20,20,1 GrabImage gfx,0,0,2 Cls For n = 3 To 200 Color 255,n,255-n Rect 1,1,18,18,1 GrabImage gfx,0,0,n Next Cls For n = 201 To 400 Color 450-n,n-150,66 Rect 1,1,18,18,1 GrabImage gfx,0,0,n Next Cls For n = 401 To 600 Color n-350,66,650-n Rect 1,1,18,18,1 GrabImage gfx,0,0,n Next MaskImage gfx,0,0,0 Cls x=50:y =50 Type sprite Field x Field y Field lr Field ud Field s End Type For n = 1 To 3 For x = 1 To 20 For y = 1 To 10 alien.sprite = New sprite alien\x = x*30 alien\y = y*40 alien\lr = (Rnd(0,2)-1) alien\ud = (Rnd(0,2)-1) alien\s = Rnd(1,2) Next Next Next Gosub drawscreen Repeat id= WaitEvent() If (KeyHit(205) Or KeyDown(205)) And x < w2-20 Then x = x + 1 If (KeyHit(203) Or KeyDown(203)) And x > 0 Then x = x - 1 If (KeyHit(200) Or KeyDown(200)) And y > 0 Then y = y - 1 If (KeyHit(208) Or KeyDown(208)) And y < h2-20 Then y = y + 1 If KeyHit(1) Then Exit Select id Case $1001 Select EventData() Case 2 Notify "bye" End End Select Case $803 End Case $4001 If EventSource() = frametimer Then Gosub drawscreen End Select Forever End .drawscreen If MilliSecs() > fpstime Then fpstime = MilliSecs()+1000 fpss=fps fps=1 Else fps=fps+1 EndIf ;Draw a tiled background made of 600 tiles Cls For xx = 1 To 30 For yy = 1 To 20 DrawBlock gfx,xx*(w2/32),yy*(h2/24),2 Next Next ;Draw 600 sprites on screen i = 2 For alien.sprite = Each sprite i = i +1 If alien\lr = 1 Then alien\x = alien\x + alien\s If alien\x >(w2-20) Then alien\x=w2-20 : alien\lr = -1 Else alien\x = alien\x - alien\s If alien\x < 0 Then alien\x = 0 : alien\lr = 1 EndIf If alien\ud = 1 Then alien\y = alien\y + alien\s If alien\y >(h2-20) Then alien\y=h2-20 : alien\ud = -1 Else alien\y = alien\y - alien\s If alien\y < 0 Then alien\y = 0 : alien\ud = 1 EndIf DrawImage gfx,alien\x,alien\y,i Next DrawImage gfx,x,y,1 SetStatusText mainwindow,"Fps "+fpss FlipCanvas can Return p.s how do I insert code in one of them cool scrolly window thingy`s ? |
| ||
reaper>> nice, I get 130 with drawings, 305 without Athlon 1Ghz // 512 meg RAM // Gforce4 MX |
| ||
I've just updated my graphics card drivers to the latest nVidia ones, and I get 15fps! on my AtlonXP2100, 512mb DDR333 Ram, GF4 Ti4600, and a test program I was writing before the upgrade now runs almost 7.5 times slower even with debug turned off. Can't wait for the update. |
| ||
The latest Nvidia drivers do not seem to like 2d text in blitz. Mark is looking into it. |
| ||
Nvidia drivers. Hmmm. here the older seem to work better than the newer ones. Nvidia here seems to have made a good job at making their drivers worse and worse with time. Maybe it's a cool idea to make you buy their latest card. |
| ||
I was under the impression the image manipulation slowdown occurred mostly when you want to draw to an ImageBuffer. But in my 2D code I've just started messing around with, I am trying to draw some very large bitmaps onto the screen and everything slows down to 1-2 FPS when any part of those images are drawn, when they are scrolled offscreen everything is fast again. The slowdown occurs with even just 1 pixel of the large bitmaps showing... Will canvasses help this or is this something else that will be improved when Mark implements the image storing flags? |
| ||
That is weird... I have written this game and compiled it. But, I have just downloaded the Blitz Plus Demo and ran the game from within the IDE. And and appears to be running much faster than the compiled B3D one. I will have to check out, add an FPS indicator to the game; but, as far as I can tell just by looking at it, it runs MUCH faster. The sound doesn't work, thou. By te wau, any ideas why the sound is not working ? /R |
| ||
Well, B+ is faster with it's graphics if you're not doing anything too tricky ;] As far as the sound is concerned... it's my understanding that LoopSound no longer works, an optional flag has been added to PlaySound instead. There are other posts around here somewhere that will explain it better. Go huntin ;] |
| ||
I heard that Nvidia know about this problem with their graphics drivers and are soon going to be releasing a new set of drivers to rectify the problem. |
| ||
I believe one or two or maybe three (minor) driver updates have been released since they said that and the problem remains ;] |
| ||
I had the problem with the full screen thing, it kept flashing making my eyes go funny, so I got rid of some viewport stuff and it stopped :D |
| ||
>> I believe one or two or maybe three (minor) driver updates have been released since they said that and the problem remains ;] No drivers have been released archive or otherwise since the initial 43.45 March 27 release. Perhaps your thinking of unofficial ones, but those shouldn't contain the fix anyway since only nVidia was mailed about it. |
| ||
OK, well, that explains that then =] |