Hello all.
After having tried quite a few different different options I feel I'm
running out of ideas how to achive my goal, so I decided to ask around.
Apologies if this is a trivial issue ...
What I'm trying to do is get plplot to render a graph into a memory
buffer, which is then blitted to a window whenver i) that window changes
in size, ii) the window needs to be updated after being invalidated or
iii) the data underlying the graph changes.
A small test application I prepared (platform: Windows X64) worked well
enough, I set the driver to "memcairo", passed a frame buffer memory
block via plsmem(), issued the plotting commands and then dumped the
buffer to inspect its contents. Right enough, it was rendered just the
way I need it, ready to be displayed.
But my attempts to incorporate that approach into the real application
failed. I was planning to have one plstream per window, created and
initialized upon window creation. A new memory buffer is passed in by
plsmem() whenever the window size changes, to reflect the current
drawing surface. In the window paint routine, I'm trying to simply
render the plot, then blit the buffer.
However that only works exactly once, all subsequent paint calls fail
with an access violation in a pl...() command.
The rendering commands were stripped down to
plenv0(...)
plline()
But that doesn't seem to make any difference. Basically any call to
plenv() seems to change something in an unwanted way, causing subsequent
calls to write to invalid memory.
Do I need to skip plenv(), and replace it with individual calls for
drawing a box and setting a viewport?
I played with pladv(), but to no avail.
calling plinit(...) for each render cycle to set up a new enviroment
seems to work, but that is so slow as to be unusable, so that's no option.
Is there anything I'm doing wrong, or are there some examples I failed
to notice? Help is appreciated.
TIA
best,
Dietmar
|