Quantcast
Channel: Processing Forum
Viewing all 1768 articles
Browse latest View live

Re : frameRate() can crash 2.0b7

$
0
0
Andres, I almost wonder if it's 30fps.  It reports faster than 30fps, and I can get it to report faster than 60fps, but I can tell that it is not - it's not smooth at all.  My primary sketch is jumpy, even though it reports 60fps (or more when I unsync).  Hovering over controlP5 buttons gives a delayed response.

I've ran a profiler on it and most of the time (a good 50%) is spent in the gl.Flush().

The sampler breaks down another 50% spend on Thread.sleep(), which is directly in the  PApplet.run().  I'm not sure why it would delay that because it's running (or so it claims) at around 60fps.  Removing that bit of code in PApplet, doesn't appear to improve the performance any.  So it expect it's something else.. I have no idea what though... it's dragging.

Re : frameRate() can crash 2.0b7

$
0
0
Ok, thanks for the feedback. I don't know what could be the cause of the sluggish animation you are observing. I will take a look at this. Let me know of anything else you find out by profiling and testing.

Re : [2.0xx] How to set P2D/P3D PGraphics pixels to transparent via the pixel array?

$
0
0
andres, it seems a lot of the problems were fixed with your recent alterations to the source code. I just downloaded and compiled the latest svn-build 0216. And then I re-tested the three code examples from this thread with my WinXP+Radeon system. Good news. All three of them work correctly now!

Example 1
Setting transparent pixels works now under all smooth() and noSmooth() settings. Subsequent calls to begin-endDraw also leave both the transparant and opaque pixels intact.

Example 2
The drawing is cumulative when no background() call is made under all smooth() settings and for both opaque and transparent backgrounds.

Example 3
As you mentioned the mirror pixel issue has been solved, so this example now draws correctly.

Re : Amplifying a certaing part of a visualization

how to import megamu.mesh.*; in eclipse?

$
0
0
i had a processing program,
in which i typed

  import megamu.mesh.*;
now i'd like to edit it in eclipse, after i did  follow what the guide said.. like.. import ' core.jar ' and add it to java program build path..
i find i can't import this package into my program in eclipse.

maybe i should import some other files into my eclipse java program ..like xxx.jar
but i don't know what should i do excatly?

thank you all > <

Re : How to port old PGraphicsOpenGL code to Processing 2 alpha - Additive Blending

$
0
0
hey guys i'm porting over some code from processing 1 -> 2 and running into a funny additive blending issue...



  1. //in my main draw i'm calling

  2.   PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
  3.   GL2 gl = pgl.beginPGL().gl.getGL2();

  4.   gl.glDisable(GL2.GL_DEPTH_TEST);
  5.   gl.glEnable(GL2.GL_BLEND);
  6.   gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE);

  7.  //...

  8.   //and then drawing a particle system that involves a bunch of
  9. void render() {

  10.     pushMatrix();
  11.     translate(loc.x, loc.y, loc.z);

  12.     noStroke();

  13.     beginShape(TRIANGLE_FAN);
  14.     fill(255, 255, 255, 50);
  15.     vertex(0, 0);
  16.     fill(171, 124, 78, 0);
  17.     for (float j=0; j<=TWO_PI; j+=TWO_PI/12) {
  18.       vertex( 0+lineWidth*cos(j), 0+lineWidth*sin(j) );
  19.     }
  20.     endShape();

  21.     popMatrix();
  22. }

  23. //...

  24. //and then ending the main draw with
  25. pgl.endPGL();

has anyone run into this before and/or do you have any idea what might be causing the issue? maybe i need to switch to an image and use the new blend() function? 

Processing 2.0b7 DirectoryList example not working on Windows Visa/7

$
0
0
When I try to run the DirectoryList example sketch in Processing 2.0b7, I get an error message: Cannot find a class or type named "File" at line 24 which contains the following code: File[] files = listFiles(path);

Any thoughts on getting the Example to run?

Re : Processing 2.0b7 DirectoryList example not working on Windows Visa/7

$
0
0
Add the following statement to the beginning of the example.

  1. import java.io.File;

Re : Processing 2.0b7 DirectoryList example not working on Windows Visa/7

$
0
0
Yes, perfect, thanks quarks.  But now I get the error message: Cannot find a class or type named "Date" at line 30 which has the following code: String lastModified = new Date(f.lastModified()).toString();

I suppose there is another import that I am missing, is it?  

Re : Processing 2.0b7 DirectoryList example not working on Windows Visa/7

Re : Processing 2.0b7 DirectoryList example not working on Windows Visa/7

Processing serial/Arduino libraries

$
0
0
Hello, I am having some issues that I cannot figure out. I tried posting on the Arduino forums, but they suggested posting here instead.

I have an Arduino Uno (the basic one) and am running this code:

Arduino:
  1. void setup(){
  2.   Serial.begin(9600);
  3. }

  4. void loop(){
  5.   float a = -4.56789;
  6.   a /= random(10);
  7.   Serial.println(a, 5);
  8.   delay(500);
  9. }

Processing:
  1. import processing.serial.*;
  2. Serial myPort;
  3. float value;

  4. void setup()
  5. {
  6.   myPort = new Serial(this, Serial.list()[0], 9600);
  7. }

  8. void draw()
  9. {

  10. void serialEvent(Serial p) {
  11.   // get message till line break (ASCII > 13)
  12.   String message = myPort.readStringUntil(13);
  13.   if(message != null){
  14.     value = float(message);
  15.     println(value);
  16.   }
  17. }

This works fine. Processing will print the float coming in from Arduino/Serial. I have also tried uploading StandardFirmata to the Uno board and then running a Processing sketch with Serial/Arduino libraries which also worked fine.

I then unplug my Uno board and plug in my new Arduino Micro board in, upload the Arduino code, and run the Processing code. It is strange because there are no errors or anything, it just reacts as if there are no SerialEvents at all. Just nothing happens. I can print to the console Serial.list() and the correct port comes up, but nothing is read on Processing's side from Arduino.

I cannot figure out why this would be. Anyone have any ideas?

Thanks.

Re : save a single frame from Webcam

$
0
0
how about something like this function appended to the gettingStartedCapture from the 1.5.1 examples:


void mouseReleased(){
  
  save("/Users/yourhomedir/desktop/capture"+(capCount+1)+".jpg");
  capCount++;
  
}

Add the capCount variable as a global for taking multiple captures without overwriting, otherwise skip the capCount+1 part:

void mouseReleased(){
  
  save("/Users/yourhomedir/desktop/capture.jpg");
  capCount++;
  
}

also need to change the path to your desktop depending on your os.

hope this helps!
Tim

Re : save a single frame from Webcam

[2.0xx] How to set multiple render targets for a fragment shader?

$
0
0
I've been looking for a way to get the depth map of the scene. If there are alternatives to my current method let me know. For now I am now using shaders to get it. Once I get to the fragment shader I have both the color (vertColor) that you would normally use and the depth (depthColor) which I want for my depth map. Of course gl_FragColor only outputs a single color.

On the internet people say it is possible with GLSL while other say it is not possible with GLSL ES 2.0.

Is it possible in Processing 2.0xx to output to multiple render targets from a fragment shader?

Fragment shader
  1. varying vec4 vertColor;
  2. varying vec4 depthColor;

  3. void main()
  4. {
  5.     gl_FragColor = depthColor;
  6. }

Re : [2.0xx] How to set multiple render targets for a fragment shader?

$
0
0
From looking at the source I've learned how to connect a PImage or PGraphics to a uniform sampler2D:
  1. yourShader.set("textureNameInShader", yourTexture);
Good to know. However it seems this only works as an input texture, not as an output render target.

JavaSound Minim Errors

$
0
0
Hi All,

I'm recording some sound in a Processing sketch.  It seems to be working fine but I get the errors below.  Any idea what is going on?  My sketch is working but I don't like seeing these errors.  I'm running Fedora 17 Linux and Processing from processing-2.0b7-linux64.tgz

==== JavaSound Minim Error ====
==== Couldn't open the line: line with format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.

==== JavaSound Minim Error ====
==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian

Re : JavaSound Minim Errors

$
0
0
It means you are trying to read a sound file whose format (they are numerous!) isn't supported by Minim. You should try and use another file or use a software like ffmpeg to re-encode it to a format compatible with Minim.

Re : How to port old PGraphicsOpenGL code to Processing 2 alpha - Additive Blending

$
0
0
ok, my guess is that this is an OpenGL zNear and zFar clipping plane issue in the processing code... http://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm   especially because when i just translate my particles in void render using

  1. translate(loc.x, loc.y);
i don't see the image border artifact in the image above.  i'm guessing this may fit into the "this is not supported, in the sense that if you get weird problems with a GL-based sketch that uses this method, you're on your own" category... a hackish work around is to fake the 3D by still calculating z values, but instead of translating in z, just have that z value affect the visuals (i.e. diameter * z )...

Re : JavaSound Minim Errors

$
0
0
The strange thing is that this sketch worked fine (with no errors) on the same computer before I upgraded from Fedora 16 to 17...
Viewing all 1768 articles
Browse latest View live