using openGL on figures

  • Follow


Hi.

I am plotting 3D points, about 10000 of them, and the figure is very sluggish when I rotate it.

I read in the help on figure properties that openGL is by default on.

I was wondering if matlab is using my graphics card and if not how can I make it use it?

when I type "opengl info" I get the following:

***************
Version         = 3.2.0
Vendor          = NVIDIA Corporation
Renderer        = GeForce 8400M G/PCI/SSE2
MaxTextureSize  = 8192
Visual          = 07 (RGB 32 bits(08 08 08 00) zdepth 24, Hardware Accelerated, Opengl, Double Buffered, Window)
Software        = false
# of Extensions = 180

Driver Bug Workarounds:
OpenGLBitmapZbufferBug    = 0
OpenGLWobbleTesselatorBug = 0
OpenGLLineSmoothingBug    = 0
OpenGLDockingBug          = 0
OpenGLClippedImageBug     = 1
OpenGLEraseModeBug        = 1
****************

Is there something I can do to accelerate figure performance?

Thanks in advanced
0
Reply Amit 4/22/2010 10:10:19 AM

"Amit " <snufkinvic@yahoo.com> wrote in message 
news:hqp7ab$hb5$1@fred.mathworks.com...
> Hi.
>
> I am plotting 3D points, about 10000 of them, and the figure is very 
> sluggish when I rotate it.

Are you plotting the ten thousand points individually (i.e. creating 10000 
individual line objects) or are you plotting them in groups (i.e. creating 1 
or a small number of line objects)?

If the former, try to modify your code to plot in groups (or if they all 
have the same marker shape, size, and color in one single line) and see if 
that performs any better.

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 


0
Reply Steven 4/22/2010 1:42:50 PM


"Steven Lord" <slord@mathworks.com> wrote in message <hqpjoi$h24$1@fred.mathworks.com>...
> 
> "Amit " <snufkinvic@yahoo.com> wrote in message 
> news:hqp7ab$hb5$1@fred.mathworks.com...
> > Hi.
> >
> > I am plotting 3D points, about 10000 of them, and the figure is very 
> > sluggish when I rotate it.
> 
> Are you plotting the ten thousand points individually (i.e. creating 10000 
> individual line objects) or are you plotting them in groups (i.e. creating 1 
> or a small number of line objects)?
> 
> If the former, try to modify your code to plot in groups (or if they all 
> have the same marker shape, size, and color in one single line) and see if 
> that performs any better.
> 
> -- 
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 
> 

Hi Steve.

I'm not sure if I understand you...

I'm plotting the points using "plot3" function inside a "for" loop as following:

         plot3(X(i),Y(i),Z(i),'b*');

where i runs on the vectors X,Y and Z, in this case they are of the size 10,000 

Is there a better, more efficient way of doing that?
0
Reply Amit 4/22/2010 4:39:05 PM

"Amit " <snufkinvic@yahoo.com> wrote in message 
news:hqpu39$bs1$1@fred.mathworks.com...
> "Steven Lord" <slord@mathworks.com> wrote in message 
> <hqpjoi$h24$1@fred.mathworks.com>...
>>
>> "Amit " <snufkinvic@yahoo.com> wrote in message 
>> news:hqp7ab$hb5$1@fred.mathworks.com...
>> > Hi.
>> >
>> > I am plotting 3D points, about 10000 of them, and the figure is very 
>> > sluggish when I rotate it.
>>
>> Are you plotting the ten thousand points individually (i.e. creating 
>> 10000 individual line objects) or are you plotting them in groups (i.e. 
>> creating 1 or a small number of line objects)?
>>
>> If the former, try to modify your code to plot in groups (or if they all 
>> have the same marker shape, size, and color in one single line) and see 
>> if that performs any better.
>>
>> -- 
>> Steve Lord
>> slord@mathworks.com
>> comp.soft-sys.matlab (CSSM) FAQ: 
>> http://matlabwiki.mathworks.com/MATLAB_FAQ
>
> Hi Steve.
>
> I'm not sure if I understand you...
>
> I'm plotting the points using "plot3" function inside a "for" loop as 
> following:
>
>         plot3(X(i),Y(i),Z(i),'b*');
>
> where i runs on the vectors X,Y and Z, in this case they are of the size 
> 10,000

So you are in fact creating 10,000 lines.

> Is there a better, more efficient way of doing that?

Either plot all the points at once after the loop is complete:

plot3(X, Y, Z, 'b*')

or, if you need the plot to update inside the loop, preallocate X, Y, and Z 
to be vectors of NaNs, replace the appropriate element of X, Y, and Z inside 
the loop and use REFRESHDATA to tell the plot to update to reflect the new 
non-NaN elements of X, Y, and Z.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/refreshdata.html

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 


0
Reply Steven 4/22/2010 5:40:06 PM

"Steven Lord" <slord@mathworks.com> wrote in message <hqq1ld$gi2$1@fred.mathworks.com>...
> 
> "Amit " <snufkinvic@yahoo.com> wrote in message 
> news:hqpu39$bs1$1@fred.mathworks.com...

> 
> So you are in fact creating 10,000 lines.
> 
> > Is there a better, more efficient way of doing that?
> 
> Either plot all the points at once after the loop is complete:
> 
> plot3(X, Y, Z, 'b*')
> 
> or, if you need the plot to update inside the loop, preallocate X, Y, and Z 
> to be vectors of NaNs, replace the appropriate element of X, Y, and Z inside 
> the loop and use REFRESHDATA to tell the plot to update to reflect the new 
> non-NaN elements of X, Y, and Z.
> 
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/refreshdata.html
> 
> -- 
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 
> 

Thanks for the suggestion. I moved the plotting to be outside of the "for" loop but unfortunately I don't notice any improvement. I even tried plotting only 1500 points but its still not as smooth as I expect it to be.

Any other suggestions? 
What about the openGL functionality? How can I know its on?
0
Reply Amit 4/24/2010 12:43:07 AM

4 Replies
199 Views

(page loaded in 0.048 seconds)

Similiar Articles:













7/27/2012 1:17:39 AM


Reply: