texture to beginShape(QUAD_STRIP)
in
Programming Questions
•
9 months ago
In setup() I load the image data into the img global object, but I don't know to apply the image on the texture. This function wasn't created by me.
- void drawFunction(){
- float x, y, z;
- int i = 0, j = 0;
- float in_steps = 1.0 / steps;
- float[][] matrix = new float[steps+1][steps+1];
- beginShape();
- texture(img);
- for (y = 0.0, j = 0; y <= 1.0; y+=in_steps, j++)
- for (x = 0.0, i = 0; x <= 1.0; x+=in_steps, i++)
- matrix[i][j] = function(x, y);
- for (j = 0, y = 0.0; j < steps; j++, y+=in_steps) {
- beginShape(QUAD_STRIP);
- for (i = 0, x = 0.0; i <= steps; i++, x+=in_steps) {
- vertex(x, y, matrix[i][j]);
- vertex(x, y + in_steps, matrix[i][j+1]);
- }
- endShape();
- }
- endShape();
- }
1