Forums > MaxMSP

lcd / ui and cpu usage


f.e
August 12, 2006 | 2:22 pm

I’m writing (trying to) a timeline of max messages with lcd and i’m on
the grid display functions. These functions :

public void zoom_h(float f)
{
if (f>=1)
{
zoom_x = f;
if (grid) showgrid(1);
}
wind_r = (int) (lcd_x/f);
//outlet(1, wind_l+" "+wind_r);
}

public void showgrid(int g)
{
grid = (g != 0);
if (grid)
{
outlet(0, "getsize");
float l_x = 0;
for (int i=0;i< (lcd_x/grid_unit)+1;i++)
{
l_x = (i * grid_unit)*zoom_x;
outlet(0, "recordsprite");
outlet(0, "linesegment "+(l_x)+" "+0+" "+(l_x)+"
"+lcd_y+" "+42);
outlet(0, "closesprite "+"grid"+(i+""));
outlet(0, "drawsprite "+"grid"+(i+"")+" 0 0");
}
}
}

are used to zoom the grid. I’ve noticed (and i’ve expected it) a jump of
~50% of my cpu usage while redrawing the sprites used in my grid. Yet,
the timeline is empty, but what will happen when it’ll be full of
objects ? I wonder if there’s a way to manage this or if i have to live
with. The use of speedlim / qlim didn’t made the trick…

best

f.e


f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|


August 12, 2006 | 4:08 pm

I was planning to try something similar…
lcd is quite slow when you ask him to redraw all the sprites.
I think you should have better results with OpenGL accel in Jitter as your CPU
only has to give the commands to the GPU, when with lcd, it does it all.

‘hope that helps
//yac

> I’m writing (trying to) a timeline of max messages with lcd and i’m on
> the grid display functions. These functions :
>
> public void zoom_h(float f)
> {
> if (f>=1)
> {
> zoom_x = f;
> if (grid) showgrid(1);
> }
> wind_r = (int) (lcd_x/f);
> //outlet(1, wind_l+" "+wind_r);
> }
>
> public void showgrid(int g)
> {
> grid = (g != 0);
> if (grid)
> {
> outlet(0, "getsize");
> float l_x = 0;
> for (int i=0;i< (lcd_x/grid_unit)+1;i++)
> {
> l_x = (i * grid_unit)*zoom_x;
> outlet(0, "recordsprite");
> outlet(0, "linesegment "+(l_x)+" "+0+" "+(l_x)+"
> "+lcd_y+" "+42);
> outlet(0, "closesprite "+"grid"+(i+""));
> outlet(0, "drawsprite "+"grid"+(i+"")+" 0 0");
> }
> }
> }
>
> are used to zoom the grid. I’ve noticed (and i’ve expected it) a jump of
> ~50% of my cpu usage while redrawing the sprites used in my grid. Yet,
> the timeline is empty, but what will happen when it’ll be full of
> objects ? I wonder if there’s a way to manage this or if i have to live
> with. The use of speedlim / qlim didn’t made the trick…
>
> best
>
> f.e
>
> –
> f.e chanfrault | aka | personal computer music
>> >>>>>> http://www.personal-computer-music.


August 12, 2006 | 6:13 pm


August 12, 2006 | 6:37 pm


August 12, 2006 | 9:54 pm


August 14, 2006 | 3:23 pm


August 14, 2006 | 4:39 pm

If you don’t want to use jsui, you can draw to a named jit.pwindow using js
instantiated jit.gl objects. then attach a jitterlistener to the pwindow if
you want mouse callback functions. There are some examples on how to do this
with a normal jit.window.

-thijs

On 8/14/06, apalomba@austin.rr.com wrote:
>
> Is there a way I can use OpenGL and javascript to emulate
> the LCD object?
>
>


August 14, 2006 | 4:48 pm

I do not have jitter, is there a way I can do this
in MSP. Or does anyone know if someone who has already
come up with a javascript/OpenGL LCD emulator?

—– Original Message —–
From: Thijs Koerselman

Date: Monday, August 14, 2006 11:43 am
Subject: Re: [maxmsp] lcd / ui and cpu usage

> If you don’t want to use jsui, you can draw to a named jit.pwindow
> using js
> instantiated jit.gl objects. then attach a jitterlistener to the
> pwindow if
> you want mouse callback functions. There are some examples on how
> to do this
> with a normal jit.window.
>
> -thijs
>
>
> On 8/14/06, apalomba@austin.rr.com wrote:
> >
> > Is there a way I can use OpenGL and javascript to emulate
> > the LCD object?
> >
> >
>


August 14, 2006 | 5:23 pm

You don’t need Jitter to use JSUI. You will need to spend some time
with the Javascript in Max PDF to get started. The OpenGL drawing
commands used in JSUI code are very similar to LCD. It shouldn’t be too
difficult to port your LCD commands over to Javascript.

Andrew B.


August 14, 2006 | 6:36 pm

yes, JSUI was what I had in mind. I was wondering
if anyone had already come up with an LCD like interface
using JSUI.

Anthony

—– Original Message —–
From: Andrew Benson
Date: Monday, August 14, 2006 12:35 pm
Subject: Re: [maxmsp] lcd / ui and cpu usage

> You don’t need Jitter to use JSUI. You will need to spend some
> time
> with the Javascript in Max PDF to get started. The OpenGL drawing
> commands used in JSUI code are very similar to LCD. It shouldn’t
> be too
> difficult to port your LCD commands over to Javascript.
>
> Andrew B.
>


August 14, 2006 | 9:01 pm

On Aug 14, 2006, at 8:29 PM, Ali Momeni wrote:

>
> isn’t it that jsui’s graphic processing is all done in software, on
> the cpu, regardless of what you’re drawing and how?
> perhaps that has changed; that’d be cool.

You can use GPU if you use jit.gl.sketch with jit.pwindow and a
jitter listener (attached to the pwindow for mouse events) instead of
jsui. With the exception of text and the need to reset the command
list each frame, otherwise commands are very similar to the JSUI
sketch object.

-Joshua


August 15, 2006 | 3:29 am

isn’t it that jsui’s graphic processing is all done in software, on
the cpu, regardless of what you’re drawing and how?
perhaps that has changed; that’d be cool.

a

On Aug 14, 2006, at 10:23 AM, Andrew Benson wrote:

> You don’t need Jitter to use JSUI. You will need to spend some
> time with the Javascript in Max PDF to get started. The OpenGL
> drawing commands used in JSUI code are very similar to LCD. It
> shouldn’t be too difficult to port your LCD commands over to
> Javascript.
>
> Andrew B.


Viewing 12 posts - 1 through 12 (of 12 total)