Recent

Author Topic: Faster panning and zooming  (Read 2554 times)

big_M

  • New Member
  • *
  • Posts: 12
Re: Faster panning and zooming
« Reply #15 on: October 11, 2020, 01:51:24 pm »
Okay, so I have tried some things. StrechDraw is indeed very fast, however it seems like I found the real culprit, which looks to be the reading speed. The problem is that reading even only a small portion of a big image takes very long, at least with TCanvas. Tiling the image into 200x200px tiles, and reading only the needed ones looks promising so far.

Can I suggest you try the OpenGL demo texture.lpr
  https://github.com/neurolabusc/Metal-Demos/tree/master/texture
by default, it loads the small. Coral and ClownFish bitmaps, but you can change these to be very large bitmaps. Dragging the mouse pans the images, and the scroll wheel adjusts the zoom. The nice thing about OpenGL is that the bitmap is stored in the GPU RAM, not the CPU RAM. This means that panning and zooming does not face the memory wall of slow transfer speeds.

The font_gl project demonstrates how to have nice scaleable fonts with OpenGL:
  https://github.com/neurolabusc/Metal-Demos/tree/master/font
Interesting links, thank you.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8903
  • FPC developer.
Re: Faster panning and zooming
« Reply #16 on: October 11, 2020, 03:36:20 pm »
I use opengl for that, and also draw on top of that.

An awful ugly and old but functional demo is posted in this thread: https://forum.lazarus.freepascal.org/index.php/topic,30556.msg194627.html#msg194627


 

TinyPortal © 2005-2018