how do I make this solid using fill()?
in
Programming Questions
•
2 years ago
Hi everyone, I've got an array full of data that I'm trying to represent in 3D using vertex. I am able to construct 2D representations that fill() without any trouble (see image 1 below) but I'm having trouble finding a way of making these representations have any 3D depth. I really want these flat, 2D representations to be say 10 pixels deep (along the z axis). I cant use strokeWeight() because I want to preserve detail. I tried to make the following work around which constructs 3D rectangles along the sides of the image using vertex, as shown in the image below the code, however the rectangles are not responding to fill() and I would also like to fill in the sides and the bottom of the 3D shape. Am I going about this all wrong?
Here's the code, the pictures are below that:
- stroke(0);
- fill(0);
- beginShape();
- //-------------------------------------------------------//Draw from array
- for(int i = 1; i < myArrayList.size(); i++){
- float x = map((Float)myArrayList.get(i), 0.0, 0.05, 0, 100);
- float minusx = map((Float)myArrayList.get(i-1), 0.0, 0.05, 0, 100);
- vertex(i-1, minusx-minusx-minusx);
- vertex(i-1, minusx-minusx-minusx, -10);
- vertex(i, x-x-x, -10);
- vertex(i, x-x-x);
- vertex(i-1, minusx-minusx-minusx);
- }
- endShape();
My work around looks something like this:
You can see the rectangles along the side, but they are not responding to fill() anymore and I need to fill the sides and bottom.
Any suggestions or comments would be very welcome!
1