> > 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.
Unfortunately, as you have noticed, you can't provide change the plot memory once you've specified it. You basically do need to start from scratch each time as the memory is passed to the plot driver when the driver is initialized. I'm surprised that this is too slow, as I've used a similar approach (extcairo driver), and it seemed to work ok for me. One option might be to pass in an area as large as you think you will ever need, then just plot into and blit the sub-section of the area that matches the current window size? -Hazen ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general