I’m having trouble with the surfaceTouchEvent in the Responding to touch interaction recipe from the Processing 2 Creative programming cookbook source code on GitHub.
I’ve worked through the Troubleshooting, Discussion and Known issues, Common problems, Understanding changes to processing.core sections of the Android page of the Processing Wiki, but still no success.
Unsurprisingly, someone else posted a similar issue with Android Multitouch on Processing 2.0.X on the Android Processing Forum. Unfortunately their solution (import. android.view.motionEvent) doesn’t seem to resolve my issue.
Time to sort this one out.
Making my way through the Mixing 2D and 3D objects recipe from the Processing 2 Creative programming cookbook source code on GitHub.
In this recipe I learned how to use the ENABLE_DEPTH_TEST and the DISABLE_DEPTH_TEST parameter inside the hint function at the beginning and end of the draw function to to enable and disable the z buffer. This means the first black square intersects the coloured 3D cubes, while the second white square is drawn on top of the coloured 3D cubes. The DISABLE_DEPTH_TEST parameter would be useful if you wanted to display user interface elements such as buttons, banners or instructional text on top of the 3D environment.
Making my way through the Drawing curves recipe from the Processing 2 Creative programming cookbook source code on GitHub.
In this recipe I learned how to use the bezier and curve functions to draw Bezier curves and Catmull-rom splines in the display window. For the Bezier curves in this example, 0 and 20 are the coordinates for the first anchor point. 50 and 10 are the coordinates for the first control point. 80 and 100 are the coordinates for the second control point, and the 30 and 200 are the coordinates for the second anchor point. The bezierDetail and curveDetail functions are used to change the detail of the curves and the curveTightness function is used to set the tightness of the curve. Use a value of 0.0 to connect the points of the curve with straight lines and values between -5.0 and 5.0 to create curves with varying tightness.
In this recipe I also learned how to use the translate function with a for loop to create multiple curves and then translate (position) them from left to right (x parameter) at a specified distance apart (20) in the display window. The pushMatrix and the popMatrix functions are also somehow involved in the translation of the curves, but I’m not quite sure how just yet. The Processing 2.0+ reference for these two functions functions provides a description and an example, but I’m not sure when to pop and when to push and why. I guess I’ll play around with them both and figure it out!
Worth noting, since this recipe was created the OpenGL library has been included as part of Processing 2.0. That means you no longer have to import the library. Nice!
Oh yeah, gradually increasing the tightness of the curve by moving the mouse from left to right (current horizontal coordinate of the mouse) is also pretty cool!