[QGIS-Developer] PYQGIS - OpenGL in QgsPluginLayer
Martin Dobias
wonder.sk at gmail.com
Wed Mar 3 08:00:21 PST 2021
Hi Eric
On Wed, Mar 3, 2021 at 3:48 PM Eric Younkin - NOAA Federal <
eric.g.younkin at noaa.gov> wrote:
> Looking for some advice. We have a need to use OpenGL to draw the
> symbology associated with some vector data. All of our code uses OpenGL
> 1.x. I was thinking we could use the QOpenGLWidget and the QgsPluginLayer
> to add our OpenGL rendered symbology to a QgsMapCanvas as a new layer.
>
> Is this possible? Is there an example anyone knows of that is kind of
> similar to this idea? Or is there a better way to approach this problem?
>
Could you please provide some more details regarding the symbology you
would like to get rendered? A screenshot would help a lot...
If you plan to use mesh-based weather data, maybe what you are trying to do
is already possible with the mesh layer in QGIS out of the box (e.g.
display of arrows, streamlines, trace animation), or there is only small
amount of extra work do be done in QGIS core to achieve that.
As for OpenGL approach (it looks like you already have some existing code
you would like to adapt to QGIS)... are you looking just at 2D rendering or
3D rendering as well? I know some time ago for QGIS 2.x Vincent Mora has
created a plugin layer that used OpenGL to render to offscreen image and
then draw it in map canvas [1] which involved some hacks. With
QOpenGLWidget approach I would be quite cautious as it may not work well,
or have some strange issues on different platforms. For example, I _think_
the QOpenGLWidget can't be semi-transparent (but I may be wrong), so mixing
its content with the rest of the map could be quite tricky...
Regards
Martin
[1] https://github.com/Oslandia/meshlayer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210303/25071ec4/attachment-0001.html>
More information about the QGIS-Developer
mailing list