Recent

Author Topic: Mixing LazMapViewer and OpenGL  (Read 601 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8364
Mixing LazMapViewer and OpenGL
« on: March 25, 2025, 01:26:34 pm »
If mixing LazMapViewer and OpenGL, specifically with one or more OpenGL panes sitting in the corners of the map, is there an advantage to switching from the standard engine to e.g. BGRA?

If so, how is this done in practice?

Apologies if this is close to an FAQ, but I've got very poor Internet access ATM (upstream fibre issue).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 16781
  • Ceterum censeo Trump esse delendam
Re: Mixing LazMapViewer and OpenGL
« Reply #1 on: March 25, 2025, 04:05:24 pm »
In the wiki entry is stated that the level of abstraction is such that "basically any graphics library" can be used, what to my ears sounds like yes.
https://wiki.lazarus.freepascal.org/LazMapViewer#Map_Providers
Scroll down a bit.

(E.g. I suppose the OpenGL canvas could be used, a compatible canvas with GL acceleration.)

I remember vagely that I experimented a bit with such a construct. Will have a look.
« Last Edit: March 25, 2025, 04:11:37 pm by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

wp

  • Hero Member
  • *****
  • Posts: 12756
Re: Mixing LazMapViewer and OpenGL
« Reply #2 on: March 25, 2025, 04:12:31 pm »
is there an advantage to switching from the standard engine to e.g. BGRA?

If so, how is this done in practice?
Install the BGRA drawing engine addon. Drop the component on the form and assign it to the DrawingEngine property of the mapviewer. Then all drawing commands will be handled by BGRA.

Note that the current LazMapviewer package distributed by OPM has several issues. There have been great advances in the new version which is still on CCR/Sourceforge, however (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/lazmapviewer/). So, I'd recommend that you install the CCR version, or wait a few days until the new version will be in OPM

MarkMLl

  • Hero Member
  • *****
  • Posts: 8364
Re: Mixing LazMapViewer and OpenGL
« Reply #3 on: March 25, 2025, 06:10:29 pm »
Install the BGRA drawing engine addon. Drop the component on the form and assign it to the DrawingEngine property of the mapviewer. Then all drawing commands will be handled by BGRA.

Thanks, I think that's the important bit: I was stuck on where to get the "true name".

In your opinion, is it something which /should/ be done when mixing in OpenGL?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

wp

  • Hero Member
  • *****
  • Posts: 12756
Re: Mixing LazMapViewer and OpenGL
« Reply #4 on: March 25, 2025, 07:00:00 pm »
What do you understand as "mixing"? Draw in the map with OpenGL? I don't know if this is possible (naively I would say: no), but the buffer used by the BGRABitmap drawer is a TBGRABitmap, I am aware that BGRA contains some kind of OpenGL access, but don't know the details.

Ideally "someone" should write an "OpenGLDrawingEngine" for the mapviewer...

BTW, in the ccr version the mapviewer can parent other controls. So, when you insert a TOpenGLControl into the map you can perform OpenGL in that part while the map itself is drawn by any drawer availabe.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8364
Re: Mixing LazMapViewer and OpenGL
« Reply #5 on: March 25, 2025, 07:45:53 pm »
I could see from the wiki that the BGRA backend had at least some OpenGL capability, and now that I'm adding some OpenGL controls which are actually overlaying some of the corners and edges of the map I was wary in case /not/ using it could in some way be unstable.

So far, now that I know how to switch to it, things look OK.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018