3d animation. performance issues

edited February 2014 in Using Processing

from here

I'm having a couple of performance issues: as you can see from the image below, the cube edges are REALLY bad looking (I tryed to use smooth(8) but it won't get better)

http://www37.zippyshare.com/v/80640020/file.html

also, before displaying this cube, I have a black empty screen (lasts for 4 sec) and after that I will call the draw_cube function..when I call the draw_cube the screen will blink (white) a for a very short time (less than a second), like if it was the time needed to "calculate" the cube and the dots..How can I avoid this? I'm using a quite good pc (3,4 ghz, 16 gb ram, video: gt 650M 4gb vram) I tried to reduce the number of spheres or to use ellipses instead but I couldn't get any better

here you can download the full sketch http://www12.zippyshare.com/v/44774793/file.html

thank you

P.

Answers

  • Answer ✓

    I haven't tried your sketch, but I have the same issue, even with the simplest 3D sketches, because my video card badly support the OpenGL version needed in Processing 2.0.

  • Answer ✓

    The reason the cube edges look bad is because you have a noSmooth() call in your Star class's fly() method. So you are calling noSmooth() 2000 times per draw(). Instead you should call it... never. In other words, remove the line, then your cube will look smooth.

    The main reason you have performance issues is because your whole sketch uses immediate mode drawing, instead of using the possibilities and performance enhancements of retained mode drawing through a PShape. See:

    http://www.processing.org/tutorials/pshape/

    http://codeanticode.wordpress.com/2012/03/26/opengl-in-processing-2-0-alpha-5/

  • you have a noSmooth() call in your Star class's fly() method

    yay!! cube is wonderful now :)

    your whole sketch uses immediate mode drawing, instead of using the possibilities and performance enhancements of retained mode drawing through a PShape.

    this is EXACTLY what I was looking for! I thought the problem was something like this but I didn't know about Pshape..so thanks!! I'll let you know if I solve :)

    P.

Sign In or Register to comment.