I've been considering Verlet integration and thought I'd set up a test to see how it compared with Euler. The below code initially looked to compare the Euler calculation (the red line) to Verlet (the blue). Given how horrendously awful Euler is supposed to be I was expecting to see an immediate visible result but they tracked accurately together.
I added the println calculating the accurate offset value (referred to as "Newtonian") and compared it at regular time steps to the comparable Euler and Verlet values. When I run this sketch both Euler and Verlet show largely identical (the small differences down to float precision?) errors compared to the newtonian value until the Verlet value eventually, and inexplicably, starts to deviate more dramatically.
I thought Verlett was supposed to be more accurate? I'm guessing it's a code error but not sure where I've gone wrong on this one. Any help appreciated.
Just downloaded 2.0b9 and excitedly fired it up to see how some of my sketches ran and... nothing. Tried another sketch... nothing. Tried an empty sketch with just basic size(500,500) definition and background(255,0,0) in draw()... nothing. Tried one of the example files... nothing.
Thought it might be a java issue so quitted, installed latest java update, rebooted machine, fired up processing and... nothing.
Yellow play icon lights up but no sketch window opens. I can stop the app by pressing the stop button but there's no evidence of anything stopping.
I hesitate to post it as a bug so soon as it seems pretty, um, significant! Any pointers to other hardware/configuration/software updates that could be reponsible?
I'm running Vista on a Dell XPS with Nvidia hardware. All previous Betas ran just fine :-(
I've read a couple of forum posts that come close to this topic but no explicit examples. I'm trying to mask the contents of one PGraphic with a mask image generated dynamically in another. I've put together some simple test code below. I'd expect to see a red circle moving over a black background but I just get a sea of red. Enabling/Disabling the commented lines gets a bit closer inasmuch as you can see some black fringing around a red circle on a red background, so something is going on!
Any pointers as to why this isn't working or how to achieve the desired effect?
displayGraphic.beginDraw(); displayGraphic.background(255, 0, 0); //displayGraphic.mask(maskGraphic); //implementing the mask line here reveals the mask shape but doesn't exclude the background red displayGraphic.endDraw();
displayGraphic.mask(maskGraphic); //I'd expect the line here to work but it doesn't mask anything
I'm working on some basic 3D physics and I'm trying to get a point to bounce off an inclined plane. After scouring the web I think I've got a reliable way of detecting when the point's velocity vector intersects the plane defined by the three vertices of the triangle. I also think I've got a working way of detecting if that velocity/plane intersection point lies within the triangle defined by the three vertices. I think I've also got a working way of calculating the reflection vector of the velocity against the plane. So far so good. What I don't have working reliably is when the point has reliably collided with the plane. As you can see from the code below I'm doing a comparison on the y axis values and confirming that the velocity vector points downward. While this test largely works it triggers a false positive at the apex of the bounce forcing an unnatural return trajectory.
So, the question is, what is the best way to test for the point/plane intersection conditions being true? And I guess secondly, have I made a stupid mistake somewhere else that's leading to this behaviour? I'd like to allow for perfectly elastic collisions in the first instance with the opportunity to apply a coefficient of restitution ultimately.
Happy to take hints rather than outright solutions as I'd prefer to solve myself if possible...but this has been bugging me for a few days now!
Thanks in advance for any assistance
Cheers
Matt
PS I know this can all be done with toxilibs but I'd like to try and roll my own solution out of curiosity's sake in the first instance.
PVector gravity; InclinedPlane inclinedPlane; int moverCount; Mover[] moverList;
if (velocity.y<0&&location.y < intersectionPoint.y) {//is this the best test? if (inclinedPlane.isPointInTriangle(intersectionPoint)) { velocity = inclinedPlane.getReflectionVector(velocity); } } }
I'm having difficulty getting Twitter4j (v3.0.3) working under Processing 2.0b7. I've downloaded, unzipped, copied and renamed the files correctly (I think) into the sketchbook's libraries folder. Using the code below from the tutorial at
I get a 'Cannot find a class or type named "Configuration Builder"' error. I'm pretty sure I've imported the library correctly because if I rename the import line to import twitter5j.* or some other non-existent library it throws an error.
I've created some complex geometry using a class which I'd like to render to an off screen buffer using PGraphics in order to capture the image and use it as a texture that I then map to lower complexity geometry in the main draw function. I've been having problems getting the class to display within the PGraphics object.
I've boiled it down to the simplified code below. As you can see I'm trying to display two ellipses. One that is drawn simply using the ellipse() function from within the PGraphics context displays just fine. But my object that attempts to render its output using exactly the same code doesn't display. I've tried prefixing the object instantiation and render() call with 'offscreen.' but these throw an error.
Any ideas on how I can use a class to output to a PGraphics display area? I'm using 2.0b7 by the way.
Anyone know why the retained mode code below doesn't apply the fill colours appropriately as per the non-retained mode version? Is this a bug or is there a different syntax for per-vertex fill settings in retained mode?
I posted a question a week or so ago about Gouraud shading which (thanks to help from amonon.owed) was happily resolved. I've now run into some weird lighting issues when applying a texture which I'm generating procedurally at runtime. I've posted 2 screengrabs here showing how things should look and how they end up looking...
Basically I'm reading in a low res heightmap in order to generate height values for my mountain model. I'm then recursively subdividing the vertex values in order to generate higher resolution vertex normals in order to calculate angles to the vertical which allows me to determine snow distribution before using this to create the higher res texture stored as a PImage. I'm then applying this texture to the lower res geometry, together stored as a retained mode object.
Here's the behaviour I see:
If I don't subdivide the basic height array values at all in order to generate the texture then everything is fine, albeit with a blocky texture
As soon as I apply any level of subdivision I start to see this blocky black error in the lighting of the model.
The black area creeps over the image based on viewing angle and can vary from being invisible (the firstscreenshot), through partial (the second) to completely covering the model.
The error appears with custom settings for both point and directional lights and the default 'lights()' setting. It doesn't appear if I specify no lights or just an ambient value.
I don't think its a UV mapping issue as my texture is appearing correctly as I'd expect over the model. I don't think it's a geometry issue as it works just fine with a low res texture and I don't think its an error in my lighting set up as it appears with lights() too. All told it's got me a bit stumped!
So does anyone recognise this visual glitch? It looks like some issue with the P3D renderer but I've been wrong on that one before so I'm hoping someone has some ideas that might point me in the right direction of a resolution. I'd post my source code but, as you can appreciate from the above, its fairly lengthy so thought I'd start with a description.
Really hope someone can help with this one, I'd hate not to be able to use my lovely procedural textures!
I'm a relative newbie to Processing so apologies if this has been covered elsewhere (I have searched though!) I'm trying to implement a Gouraud shader in my processing sketch and have had no luck trying to create external GLSL files in my sketch's Data folder. I've copied source code from various sample files (found by searching for "GLSL Gouraud") and saved them as glsl files, either individually or as seperate Vertex and Fragment glsl files. Using the following syntax...
void draw(){
shader(gouraud);
//retained mode PShape and other vertex data follows
}
... I generally get an empty grey window when I run the sketch. So. Three questions...
1. Does anyone know of a working gouraud shader glsl file and appropriate syntax for inclusion in Processing?
2. If not, are there any plans to include one with the included Examples in a future Beta release? (would seem like a useful shader!)
3. Are there alternate methods using lower-level OpenGL calls that would achieve this aim? (I'm aware that in principle I could roll my own gouraud shader using vertex normals and per vertex fill settings but I was hoping for an out of the box solution - I have enough programming fish to fry with my project! ;-) )