Forums > Jitter

jit.gl.sketch and CPU consumption

January 14, 2011 | 4:02 pm

Hi Jitter’s

I need to draw several thousands of colored arcs in a jitter window. Right now, I am using a the GL environment and a combination of a jit.gl.sketch and jit.gl.render to achieve this. I send all the vertices for each arc in GL format to the (same) jit.gl.sketch object.
However, with several thousands of arcs, it gets really heavy on the CPU (30% of CPU without, around 100% with, measure with "Activity Monitor" on my MBP).

Here is an example of the visual result.

I would really need to make this lighter. Do you see a way to achieve this?
Would it be more efficient to use one jit.gl.sketch per arc ? What about switching to jit.gl.mesh or using jit.gl.multiple? Would it be less heavy on the CPU ?

Currently, my rendering options are :
jit.gl.render: @auto_material 0 @depth_enable 0 @two_sided 0 @blend_enable 1
jit.gl.sketch: @auto_material 0 @depth_enable 0 @two_sided 0 @pushstate 0 @blend_enable 1

Any idea is welcome…

Thank’s


January 26, 2011 | 12:55 pm

Hi vanille béchamel,

Thank’s for your reply.
I actually found another way to drastically reduce the CPU consumption of the drawing with enabling the "displaylist" option of jit.gl.sketch. As I understand it, it creates a cache of the elements to display. In my system I only add static arcs. So the cache seems very efficient.
I went down from about 100% to 12% !!!

Cheers


February 15, 2011 | 2:56 pm

Is there another way to minimize the load when drawing a few thousands of objects?
I’m writing a drawing program where spheres are drawn on a jit.gl.sketch.
I need to be able to change the viewpoint so I’m drawing spheres one next to another to draw a line, but it chokes really fast.
I can’t use the lineto command because I can’t control the individual width of each linesegment (I think)

best

pieter


February 16, 2011 | 8:37 am

Hi Pieter,

I think the lineto drawing can be affected by a thickness (I don’t remember the command though). You may have a ligther way to draw your line if I’m right about that. Have look in the doc for OpenGL commands. Or even in the doc of OpenGL itself.

Cheers

BenCello


February 16, 2011 | 9:30 am

Hi BenCello,

indeed the gllinewidth does exactly that, unlike the line_width message.
Now up to the anti-aliasing

thx

pieter


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