From: Vicente P. M. <vmi...@gm...> - 2010-04-23 16:09:28
|
Dear Micha, as suggested, let us continue the conversation via this list. Due to that mess in my posts, I do not know if you were able to see the link to an youtube video I just uploaded. One that shows the proble ocurring. Click here <http://www.youtube.com/watch?v=ut85B-w6iy4> if you have not seen it yet. I'll paste here again the codes I am using the update the 3D plot. Note that below are posted 3 methods. One of them is the SLOT that is responsible for the updating, which is the updt() method. The other two are only methods I used to organize the code itself, which are called by the updt() slot. A signal is emmited to this slot about every 0.5 seconds after some real hard processing done by the emmiting thread. /*This method set all scaling parameters the will be used to adjust the scales in the adjustScales() call.*/ void SurfacePlotter::setParameters(){ FieldROI *roi = info->getFieldROI(); numColumns = roi->getXNumPoints(); numRows = roi->getYNumPoints(); xMin = roi->getXFirst(); xMax = roi->getXLast(); yMin = roi->getYFirst(); yMax = roi->getYLast(); zMax = info->getSpPeak(); zMin = info->getSpMin(); int xDelta = xMax - xMin; int yDelta = yMax - yMin; double xS, yS; if(xDelta > yDelta){ xS = (double)xDelta / (double)yDelta; yS = 1.0; } else{ yS = (double)yDelta / (double)xDelta; xS = 1.0; } xScale = xS*1./(xMax-xMin); yScale = yS*1./(yMax-yMin); zScale = 2./(zMax-zMin); } /*This method adjust all scales that are needed to plot a visually correct 3D surface.*/ void SurfacePlotter::adjustScales(){ ParallelEpiped hull = this->hull(); d = (hull.maxVertex - hull.minVertex).length(); setScale(xScale, yScale, zScale); setZoom(d / (2*sqrt(3.0))); coords->axes[Z1].setTicLength(3*xScale, xScale); coords->axes[Z2].setTicLength(3*xScale, xScale); coords->axes[Z3].setTicLength(3*xScale, xScale); coords->axes[Z4].setTicLength(3*xScale, xScale); coords->axes[X1].setTicLength(3*yScale, yScale); coords->axes[X2].setTicLength(3*yScale, yScale); coords->axes[X3].setTicLength(3*yScale, yScale); coords->axes[X4].setTicLength(3*yScale, yScale); coords->axes[Y1].setTicLength(3*xScale, xScale); coords->axes[Y2].setTicLength(3*xScale, xScale); coords->axes[Y3].setTicLength(3*xScale, xScale); coords->axes[Y4].setTicLength(3*xScale, xScale); } /*This method updates the 3D plot with new data regarding the given instant of time. This is done by setting the scaling parameters, loading the data, adjusting the scales, and drawing.*/ void SurfacePlotter::updt(ResultsInfo *info){ this->info = info; this->setParameters(); this->loadFromData(info->getSpPowers(), numColumns, numRows, xMin, xMax, yMin, yMax); this->adjustScales(); this->updateGL(); saveLastImage(); } If you need any extra part of my code, such as the thread that emmits the signal, please let me know. Thank you very much in advance. -- Vicente Peruffo Minotto |
From: Vicente P. M. <vmi...@gm...> - 2010-04-28 23:06:59
|
Hi Micha, first of all, please ignore the last e-mail I sent to kri...@us.... I thought you had not answered, but I did not know the reply appeared only at the SF mailing list page. I thought it would come to my mail box. Sorry about that :-( Ok, so now for your question about my environment. QwtPlot3D version: v0.2.7 OS: Windows 7 Profession x64 Qt version: 4.6.2 Compiler: Microsoft Visual Studio 2008 Professional My GPU is a NVIDIA GeForce *GTS 360M*<http://www.notebookcheck.net/NVIDIA-GeForce-GTS-360M.24058.0.html> All drivers, softwares, and libraries, that interfere in qwtplot3d's compiling/running, are up-to-date (at least I think so :)). Althought my OS is 64 bits, I have compiled all libraries I use in 32 bits mode (MVS has a really easy way of doing that), including qwtplot3d and Qt itself. I have done that in order to avoid incompatibility issues, and also because qmake does not have a mkspec for x64 windows. Any extra info you may need, pleast let me know. Thank you for your effort in trying to help me!! Best regards, Vincent. |
From: Micha B. <kri...@us...> - 2010-05-02 15:47:28
|
@Vicente I cannot reproduce the behavior here. I have the very same system, except ATI replacing the NVIDIA card. But this shouldn't cause the problem, I think. What kind of threading model is it, that is used in your code? Qt threads? I haven't to much experience with them, but could it be, that your slot misses some kind of Mutex, preventing paint events between updated scaling values but before new data are completely read. Or some similar inconsistency. The things I mean, are mentioned here: http://doc.trolltech.com/4.6/threads-qobject.html#accessing-qobject-subclasses-from-other-threads etc. How about serializing the code, what happens then? A small issue: Could it be, you mix X and Y in the following code sequence: > coords->axes[X1].setTicLength(3*yScale, yScale); > coords->axes[X2].setTicLength(3*yScale, yScale); > coords->axes[X3].setTicLength(3*yScale, yScale); > coords->axes[X4].setTicLength(3*yScale, yScale); > > coords->axes[Y1].setTicLength(3*xScale, xScale); > coords->axes[Y2].setTicLength(3*xScale, xScale); > coords->axes[Y3].setTicLength(3*xScale, xScale); > coords->axes[Y4].setTicLength(3*xScale, xScale); Micha |