Add overlay grid option to GLSurfacePlotItem#3349
Conversation
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
|
It should be possible to use a single GLLinePlotItem in "lines" mode (default is "line-strip") to draw the entire grid. GLGridItem, GLGraphItem use this technique. This is equivalent to the "pairs" mode of PlotCurveItem. |
I will look into this and will try to come up with a version which only calls |
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
|
@pijyoi I changed the default setting for anti-aliasing for the grid lines to False. Is there anything else that needs to be addressed/changed/fixed in this PR from your pov? |
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
|
Thanks for the PR @swvanbuuren (and thanks for the review @pijyoi ). My apologies for letting this sit for so long. Diff looks great, merging! |
This PR adds the possibility to overlay rectangular grids on 3D surfaces as provided by
GLSurfacePlotItem. It also extends the current example of 3D surface plots to showcase the rectangular grids.Here's a screenshot of the updated example:

The current implementation already features adding a wireframe to a 3D surface plot, but unfortunately the grid lines don't look nice and it's only possible to show the actual triangle mesh wireframes and not rectangular grids, which IMO is useful to visualize and analyze data.
To nicely overlay the grid, the only feasible I could find, is to create additional
GLLinePlotItems that are added to the scene. To have this working, I added the_setViewmethod, to make sure the view is available. As soon as this is the case, the grid lines are added to the scene. For proper display, certain OpenGL options need be set for theGLMeshItemandGLLinePlotItem.Not sure if there would be a better way to handle this, but at least this seems to do the trick. I am open for suggestions for improvements or alternatives to this approach.
Also note, that adding rectangular grids to animated surfaces imposes a serious performance drop. Because of this, I didn't add the grid to animated surface in the example. Maybe we should a note about this somewhere, although I am note sure where.(With the latest changes, this doesn't seem to be an issue anymore)