A simple problem

bingweb's icon

I am designing an interface for a pluggo pluggin I have been working on - I want to modify the behaviour of the JSUI 3dDial, so that as it turns: rather than splitting and displaying two sets of colours it just rotates like a conventional dial.

This JPEG illustrates what I mean:

I have no experience of JS so I am hoping someone has a simple solution to this problem.

Best

bingweb

Thijs Koerselman's icon

If you just want a rotating fixed picture for your dial, you might as well
use pictctl (I think it's a lot cheaper in terms of cpu usage too). You
could also draw something in js, capture it to an image and rotate that. Or
load a texture into js, as opposed to pictctl. There is an example that
should get you started, called "jsui_imagestuff-example.pat". Pictctl is by
far the easiest option though.

To me it doesn't make much sense to calculate and draw a new dial on every
rotation if it's not changing its appearance along the way. You'll be
wasting your precious cpu cycles;-)

Best, Thijs

bingweb's icon

Thanks for your reply,

That's a valid point about the CPU - the only other problem is that I am a PC user and have no pict file editor. Also creating all the different pict files will be time consuming - I am on a strict time scale, this will be a submission for an MIT degree in a month, so the less time I have to spend getting the solution the better. Some of the other JSUI dials simply rotate so I would have hoped there was a simple tweak I can make to the code of 3ddial to make it perform like this. - Anyone?

jasch's icon

ok here's your tweak:
i just commented out the drawing commands you don't want:

/*j

>
> I would have hoped there was a simple tweak I can make to the code
> of 3ddial to make it perform like this.

default: // 3d sphere
        with (sketch) {
            glenable("depth_test");            
            shapeslice(40,10);
            glcullface("back");        
            // wireframe on/off
            if (vwire) {    
                glpolygonmode("front","line");            
                glpolygonmode("back","line");            
            } else {
                glpolygonmode("front","fill");            
                glpolygonmode("back","fill");            
            }
            // erase background
            glclearcolor(vbrgb);
            glclear();            
            // fill bg sphere            
            glcolor(vrgb2);
            moveto(0,0,0);
            sphere(0.8,0,360,0,90);                        
            // fill fg arc
             glclear("depth");            
             glcolor(vfrgb);
            /* sphere(0.8,-90-val*360,-90,0,90);                    
            // draw arc outline
            gldisable("depth_test");            
            glenable("line_smooth");            
            shapeslice(80,1);
            glcolor(0,0,0,1);
             framecircle(0.8,-90-val*360,-90); */
            glcolor(0,0,0,1);
            moveto(0,0);
            /* lineto(0,-0.8);
            moveto(0,0); */
            theta = (0.75-val)*2*Math.PI;
            lineto(0.8*Math.cos(theta),0.8*Math.sin(theta));