Perplexing Problem with Annotation Overwriting Itself When No External Monitors

Hello,

I am using vtkCornerAnnotation to display image coordinates as the user moves the mouse over an image in the vtkRenderWindow. It works nicely when I have an two external monitors connected to my Windows laptop. However, perplexingly, when I do not have any external monitors attached to my laptop, and am running my Python/vtk script, the annotations overwrite themselves as I move the mouse around the image! This doesn’t make sense to me. Has anyone else encountered this behavior?

Here is what the annotations look like when they update correctly during mouse movement, and when I am using external monitors:

And here is what the annotations look like when I move my mouse around, and when I am using only my laptop display - no external monitors:

Any insights would be greatly appreciated.

Best wishes,
Michelle

Hi Michelle,

I don’t have experience with
vtkCornerAnnotation , but I could think of two things that might be going wrong:

  • The annotations are being drawn in a 2D overlay, probably - maybe the overlay needs to be cleared before the annotations are drawn, otherwise they just draw on top.

  • The mouse move is accidentally creating several vtkCornerAnnotation objects, and they are all drawing on top of each other. I think this would be detected if you build VTK with VTK_DEBUG_LEAKS turned on.

It does seem very strange that the issue is ‘fixed’ when you use external monitors. Hopefully someone may have a more specific suggestion.

Regards,

Aron

Thanks, Aron.

I agree with your suspicions. I am pretty sure that a new vtkCornerAnnotation object does not get created during mouse move. I don’t understand what you are saying about the 2D overlay, but I will read the documentation and try to understand.

But in the meantime, just moments ago, I did a test. I changed my laptop settings to always use my NVIDIA graphics card (instead of automatically choosing between NVIDIA and Intel Integrated Graphics). And that solved* the problem!

Michelle

* Solved isn’t actually the right word here. If I cannot properly display vtk annotation when my laptop is using integrated graphics, I still have a problem. But at least now I have a clue as to where the problem actually lies.