We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Pages: 1 ... 7 8 9 10 11 ... 17
controlP5 (Read 126736 times)
Re: controlP5
Reply #120 - Dec 13th, 2008, 11:04pm
 
rlfbckr wrote on Dec 12th, 2008, 9:46pm:
is there any workaround for the smoothed rendering in P3D now text looks ugly. i've read somewhere that it is related to the rendering of Pimages in P3D a solution would be very helpful
best,
ralf


I am also stuck here.I made a animation which I want to run using PGraphics3D.However, the text in my ControlP5 controls gets screwed up.

I get an error messages which tells me to include controlP5 draw method inside my processing draw method but its already there.

Any suggestions
Re: controlP5
Reply #121 - Dec 13th, 2008, 11:10pm
 
I just downloaded the latest version 0.3.6 and still face the same problem in PGraphics3D mode.

I am testing the code for Text Labels provided on the ControlP5 website itself.The text labels is still chopped along the edges and blurry.

ControlP5 controlP5;

Textlabel myTextlabel;

public static void main(String[] args){


PApplet.main(new String[]{"controls"});


}


public void setup() {

 size(400,400);

 frameRate(30);

 controlP5 = new ControlP5(this);


 Textlabel t = controlP5.addTextlabel("label","A SINGLE TESTLABEL.",20,134);

 t.setColorValue(0xffffff00);

 

 myTextlabel = new Textlabel(this,"a single textlabel.",20,100,400,200,0xffff0000,ControlP5.synt24);

 myTextlabel.setLetterSpacing(2);

}



public void draw() {

 background(0);

 myTextlabel.draw(this);

 controlP5.draw();

}
Re: controlP5
Reply #122 - Jan 3rd, 2009, 4:14pm
 
I discovered a bug when using the OPENNGL renderer and Control P5 Lib. By using hint(ENABLE_DEPTH_SORT) the MultiList Buttons+ Typography renders sliced / broken.

See: http://ve.sincerelyyours.de/opengl_p5_error.png for a Screenshot

Here's the original MultiList Example from sojamo.de /w OPENGL:

Quote:
import processing.opengl.*;
import controlP5.*;

ControlP5 controlP5;
MultiList l;

void setup() {
  size(400,400, OPENGL);
  hint(ENABLE_DEPTH_SORT);
  frameRate(30);
  controlP5 = new ControlP5(this);

  l = controlP5.addMultiList("myList",0,10,100,12);
  
  MultiListButton b;
  b = l.add("level1",1);

  b.add("level11",11).setLabel("level1 item1");
  b.add("level12",12).setLabel("level1 item2");

  b = l.add("level2",2);
  
  int cnt = 100;
  
  // add some more sublists.
  for(int i=0;i<10;i++) {
    MultiListButton c = b.add("level2"+(i+1),20+i+1);
    c.setLabel("level2 item"+(i+1));
    c.setColorBackground(color(64 + 18*i,0,0));
    
    if(i==4) {

    c.setWidth(100);
    c.setHeight(20);
    }
    cnt++;
    
    if(i==4) {
      for(int j=0;j<10;j++) {
        cnt++;
        MultiListButton d;
        d = c.add("level2"+i+""+j,250+j+1);
        d.setLabel("level2 item"+(i+1)+" "+"item"+(j+1));
        d.setColorBackground(color(64 + 18*j,(64 + 18*j)/2,0));
        d.setId(cnt);
        d.setWidth(200);
      }
    }
  }
  
  MultiListButton cc = (MultiListButton)controlP5.controller("level21");
  cc.setHeight(40);
}


void controlEvent(ControlEvent theEvent) {
  println(theEvent.controller().name()+" = "+theEvent.value());  
}


void draw() {
  background(0);
}

void keyPressed() {
  if(controlP5.controller("level23")!=null) {
    println("removing multilist button level23.");
    controlP5.controller("level23").remove();
  }
}




Any suggestions? Thanks.
Re: controlP5
Reply #123 - Jan 4th, 2009, 5:05am
 
hm, this seems to be a processing/opengl issue and how textures are rendered and sorted. if you try the LoadDisplayImage sketch from the processing examples in OPENGL mode and use hint(ENABLE_DEPTH_SORT) you get the same effect. all text in controlP5 is written and stored in PImages, hence rendered as textures.
from the reference:

Quote:
hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and lines in P3D and OPENGL. This can slow performance considerably, and the algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT).

any chance to get around the depth sorting?

Re: controlP5
Reply #124 - Jan 9th, 2009, 12:59pm
 
unfortunately I can't get around the depth  sorting as it is a vital part of my application. I just figured out an easy workaround: all text( ) elements (as well as lines, rects, ...) should always use a z-parameter. otherwise OPENGL is going render the described artefacts.

at least this is working for my app.

Re: controlP5
Reply #125 - Jan 26th, 2009, 2:26pm
 
Rather simple questions (I hope...):
Q1: can you set a Radio-element-list to start with none of the options selected at all?

Q2: How can I change the size of a textlabel, constructed with : Textlabel(theComponent, theValue, theX, theY)

Q3: How can I change the tab of a textlabel constructed with:
Textlabel(theComponent, theValue, theX, theY, theW, theH, theColor, theFont);

Q4: where can I find a list of possible fonts for 'theFont' of a textlabel mentioned in Q3?
Re: controlP5
Reply #126 - Jan 27th, 2009, 3:20am
 
@TVS:

A1: start elements at ID 1 instead of 0, then setValue to 0.

Code:

Radio r = controlP5.addRadio("letters", 10,10, 15,15, 20);
r.add("A", 1);
r.add("B", 2);
r.add("C", 3);
r.setValue(0);
Re: controlP5
Reply #127 - Jan 27th, 2009, 9:24am
 
@Eforman: thanks, could have guessed it myself, but luckily there are peopele that react fast here. Thanks again.

One 'strange' thing that occurs: I can not select the first option (so case (1) or value(1)) until I selected one of the other options first... Any idea why?
For some reason it seems all my radio-elements are already doing something in setup twice, since I get a double control-event for every radio-element... Howcome? And what does it do? I don't refer to the radio-elements in void draw() at all...

-------------------------------------------------------------
Code in void setup:
 re = controlP5.addRadio("radioExport",10,50);  
 println("Here-1");
 re.add("AutoCAD (.DXF)",1);
 re.add("Maya (.MEL)",2);
 re.add("Rhino (.rvb)",3);
 re.add("SketchUP (.rb)",4);
 re.setValue(0);
 println("Here-2");
 re.setTab(nameTab3);


Code in void radioExport:
void radioExport(int theValue) {
 switch(theValue) {
   case(1):
     exportFileType = "AutoCad (.DXF)";
     break;
   case(2):
     exportFileType = "Maya (.MEL)";
     break;
  case(3):
     exportFileType = "Rhino (.rvb)";
     break;
  case(4):
     exportFileType = "SketchUP (.rb)";  
     break;  
 }
 println("3D model will be exported as "+exportFileType);  
}


Result in TextArea:
Here-1
3D model will be exported as AutoCad (.DXF)
Some control event from radioExport
3D model will be exported as AutoCad (.DXF)
Some control event from radioExport
Here-2
--------------------------------------------------------------

Also I still wonder about Q2-4...
Re: controlP5
Reply #128 - Jan 29th, 2009, 12:57pm
 
TVS wrote on Jan 26th, 2009, 2:26pm:
Rather simple questions (I hope...):
Q1: can you set a Radio-element-list to start with none of the options selected at all

with version 0.3.9 use
Radio r = controlP5.addRadio("myRadioValue",10,340);
/* add your radio buttons*/
r.deactivateAll();

TVS wrote on Jan 26th, 2009, 2:26pm:
Q2: How can I change the size of a textlabel, constructed with : Textlabel(theComponent, theValue, theX, theY)

with version 0.3.9 you can do that with setWidth, setHeight

TVS wrote on Jan 26th, 2009, 2:26pm:
Q3: How can I change the tab of a textlabel constructed with:
Textlabel(theComponent, theValue, theX, theY, theW, theH, theColor, theFont);

how to move a textlabel that has been created with "new" to another tab than the default:
Code:

Tab myTab = controlP5.addTab("new");
Textlabel myTextlabel = new Textlabel(this,"a single textlabel.",20,100,400,200,0xffff0000,ControlP5.standard56);
myTab.addDrawable(myTextlabel);


TVS wrote on Jan 26th, 2009, 2:26pm:
Q4: where can I find a list of possible fonts for 'theFont' of a textlabel mentioned in Q3

ControlP5.standard56
ControlP5.standard58
ControlP5.synt24


Re: controlP5
Reply #129 - Jan 29th, 2009, 1:00pm
 
hi, with 0.3.9 the following has been fixed.

Controller
* added method setDecimalPrecision(int theNum) to set the decimal precision for floats when displayed as valueLabel e.g. for sliders. the precision does not apply to the returned float value.
* Controller.captionLabel().set("txt") is fixed.
* setColor ( -Label(), -Active(), -Value(), -Foreground(), -Background()) issues resolved and tested for slider, range, button, knob, sliderlist, multilist, toggle, radio

Range
defautValue for min shows correct value now.

Radio
added method deactivateAll() to deactivate all radio buttons.

Knob
issue with minimum value has been resolved.

TextLabel
added setWidth, setHeight

controlP5.setAutoDraw(true/false) issue is fixed.

controlWindow.post() has been deleted.


best,
andreas

Re: controlP5
Reply #130 - Jan 29th, 2009, 4:15pm
 
a few issues with 0.3.9:

- controlP5.setColorLabel still not global, only applies to Slider and Range, other types have to be set manually.

- setDecimalPrecision(0) should not display decimal point

- Range setDecimalPrecision incorrectly still shows extra decimal places on right value, until you use controller when it corrects itself

- Range still has some println debug statements in it

- Range sliderMode of FIX or FLEXIBLE shows extra bar to the left of x, and sometimes to right of x+max, until you use controller when it corrects itself

- Range sliderMode of FIX or FLEXIBLE starts controller value at min to max/2, but using neither mode starts controller value at min to max

- Range sliderMode of FLEXIBLE adds to max value in strange way inversely proportional to pixel width of slider, e.g. for range0-100, 100px max=111, 200px max=105, 300px max=103

- actually, what is the difference between FIX and FLEXIBLE?  

- Range controller method outputs default value upon initialization, but then only outputs 0.0 as controller as used

- Range controller use: when dragging over min or max points in slider,  control passes from min to max or vice versa, which is good, and one value becomes the other, but if you drag quickly the value you are dragging away from is left somewhere random mouse last tracked.  e.g. if you are dragging min and cross over max (and then begin dragging max), the min should always be left at exactly the old max.  this almost works when you go slow, but not if you go fast.  even when slow, it's not precise.  i.e. by definition, value has to pass up to max before crossing over it.
Re: controlP5
Reply #131 - Jan 29th, 2009, 4:58pm
 
I'm having problems having a controlP5 gui rendering properly on top of a P3D sketch, I am calling the controlP5.draw(). I'm also using the OCD library.  

Can I have a ControlCanvas rendering in P3D while I keep the sketch in 2D, how?

Re: controlP5
Reply #132 - Jan 29th, 2009, 6:13pm
 
also:

- setDecimalPrecision should round off, not floor, right?  e.g. 2.89 should display 2.9 not 2.8.  you can of course use floor in controller method too but it seems more likely people would want to round.

- speaking of which, why not just have setDecimalPrecision also effect the value passed to the controller method returned value?  or make that an option if you think some people will want option of keeping more precision hidden.

- keyEvent debug statements need to be removed

And:

- it would be great if slider/range/knob had an increment parameter (e.g. 0-100 by 5 gives 0,5,15... and control visually snaps)

sorry to be so demanding hours after you released new version!  Smiley
Re: controlP5
Reply #133 - Jan 30th, 2009, 11:59am
 
@NunoG
i think that has been asked before, but not sure. unfortunately i dont have a solution for having controlP5 stay on top of your renderings when using the OCD library, which does change the camera angle inside your sketch. this not only applies to your own visual content, but also the visual elements of controlP5. if you find a way to reset the camera properly before controlP5 is drawn, please let me know. other than that, you could use a controlWindow to do your controls.
best,
andreas
Re: controlP5
Reply #134 - Jan 30th, 2009, 12:24pm
 
@eforman
* thanks for finding all these little thinggies.
* 0.3.10 now.
* colors work now?
* setDecimalPrecision(0) does not display decimal point anymore. rounding of decimal numbers not implemented yet because what to do if i have 2.99? rounding for decimalPrecision(1) should then display 3.0. you prepare the code, i implement?
* snaps = soon
* behavior of the range controller is not ideal. for now range is therefore experimental. FIX and FLEXIBLE can be ignored for range, only applies for slider.

best,
andreas


Pages: 1 ... 7 8 9 10 11 ... 17