PureBasic Forum
http://forums.purebasic.com/english/

DisplayTransparentSprite is taking too long to process
http://forums.purebasic.com/english/viewtopic.php?f=16&t=74887
Page 1 of 1

Author:  ricardo_sdl [ Tue Mar 17, 2020 9:01 pm ]
Post subject:  DisplayTransparentSprite is taking too long to process

Hi!
In this particular computer, here are the specifications:
Operating System
Windows 10 Pro 64-bit
CPU
Intel Core i5 3330 @ 3.00GHz
Ivy Bridge 22nm Technology
RAM
8,00GB Dual-Channel DDR3 @ 798MHz (11-11-11-28)
Motherboard
PEGATRON CORPORATION IPMH61P1 (SOCKET 1155)
Graphics
DELL E1911 (1440x900@64Hz)
Intel Adaptador de Vídeo Básico da Microsoft (Unknown)

PureBasic 5.71 LTS (Windows - x64)

I'm drawing a map that is 20x15 tiles, each tile is 16x16 pixels. The tiles are zoomed by a factor of 2 (making them 32x32 pixels), and the screen resolution is 640x480 pixels. Drawing the 300 tiles in the screen is taking on average 10 ms, which is making the movement sluggish. Here is a link with the source code for download:
https://drive.google.com/open?id=1B5u6MRaNEcqbXcaUC4M4IHLxLOmJL7nr

You can move the sprite with the arrow keys. Why would DisplayTransparentSprite take so long to draw the tiles?
Thanks.

Author:  Mijikai [ Tue Mar 17, 2020 9:30 pm ]
Post subject:  Re: DisplayTransparentSprite is taking too long to process

Are u sure u have the debugger disabled?
For me its faster than 1 ms !

My quick test:
Code:
Procedure Draw()
  Protected clk.q
  TimeTaken = 0
  clk = ElapsedMilliseconds()
  For i.a = 0 To MapWidthInTiles - 1
    For j.a = 0 To MapHeightInTiles - 1
      DungeonMapSprites(i, j)\DrawSprite(@DungeonMapSprites(i, j))
     
    Next j
  Next i
  SetWindowTitle(0,Str(ElapsedMilliseconds() - clk))
  Heroine\DrawSprite(@Heroine)
  For i.a = 0 To 1
    For j.a = 0 To 1
      PaddlesSprites(i, j)\DrawSprite(@PaddlesSprites(i, j))
    Next j
  Next i
EndProcedure

Author:  Fred [ Tue Mar 17, 2020 9:32 pm ]
Post subject:  Re: DisplayTransparentSprite is taking too long to process

the integrated GFX card is probably very slow, as this is a very basic drawing operation and should be very very fast. Or may be a driver issue. You could try to switch to OpenGL subsystem to see if it does a difference

Author:  Bisonte [ Tue Mar 17, 2020 10:06 pm ]
Post subject:  Re: DisplayTransparentSprite is taking too long to process

he has no driver installed... Normally it's Intel HD Graphics 2500.

Driver (Intel) : https://downloadcenter.intel.com/de/dow ... duct=65509 (Sorry ... german language)

Author:  ricardo_sdl [ Wed Mar 18, 2020 1:03 am ]
Post subject:  Re: DisplayTransparentSprite is taking too long to process

@Mijikai: Debugger or not debugger I got more or less the same result.

@Fred and @Bisonte: It could be some weak ass onboard graphic with no driver issue! I'll try to install the drivers and report back.

Thank you all for now!

Author:  ricardo_sdl [ Wed Mar 18, 2020 1:43 pm ]
Post subject:  Re: DisplayTransparentSprite is taking too long to process

It was a driver issue! I installed the video drivers as suggested and the rendering is fast now. From now on I might be able to suggest this if someone complains about the slowness. Thanks :D

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/