# Coding Questions

**URL:** https://discourse.processing.org/c/processing/processing-questions/15.md?page=28

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 29

---

## [Loop with function](https://discourse.processing.org/t/loop-with-function/37261)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 3\
**Last updated:** [June 2, 2022, 5:13pm UTC](https://discourse.processing.org/t/loop-with-function/37261 "2022-06-02T17:13:16Z")

</div>

Howdy! I am trying to do a loop with these lines that I have created on function “brush” but I only can draw it once. Could you please tell me how repeat this line with a loop? void setup(){ size(1000,1000); backgrou…

---

## [Text drawing seems to be happening out of order, compared to a filter(BLUR)](https://discourse.processing.org/t/text-drawing-seems-to-be-happening-out-of-order-compared-to-a-filter-blur/37224)

<div class="topic-metadata">

**Author:** [@interstar](https://discourse.processing.org/u/interstar)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 11:26pm UTC](https://discourse.processing.org/t/text-drawing-seems-to-be-happening-out-of-order-compared-to-a-filter-blur/37224 "2022-05-31T23:26:36Z")

</div>

I’m trying to generate a static image with a blurred background and some unblurred text in front of it. Here’s my code void drawIt() { background(0); strokeWeight(4); pushMatrix(); for (int j=0; j\<20…

---

## [How can I have my background change colors when I move my mouse across it?](https://discourse.processing.org/t/how-can-i-have-my-background-change-colors-when-i-move-my-mouse-across-it/10608)

<div class="topic-metadata">

**Author:** [@karatecake](https://discourse.processing.org/u/karatecake)\
**Replies:** 15\
**Last updated:** [May 31, 2022, 3:01pm UTC](https://discourse.processing.org/t/how-can-i-have-my-background-change-colors-when-i-move-my-mouse-across-it/10608 "2022-05-31T15:01:31Z")

</div>

I’m trying to make a background that changes color when the mouse moves around the screen. I’ve found some code that works but when I try pasting the working parts into my code it stops working The working parts: fill(…

---

## [createFont() – how to forcefully remove unused fonts from memory?](https://discourse.processing.org/t/createfont-how-to-forcefully-remove-unused-fonts-from-memory/37237)

<div class="topic-metadata">

**Author:** [@disuye](https://discourse.processing.org/u/disuye)\
**Replies:** 7\
**Last updated:** [May 31, 2022, 9:24am UTC](https://discourse.processing.org/t/createfont-how-to-forcefully-remove-unused-fonts-from-memory/37237 "2022-05-31T09:24:40Z")

</div>

(I’ll share MRE in a follow-up post, trying to think how best to summarise my code) I have an art project which runs the createFont() function several times per frame – pulling random TTF/OTF files out of a folder conta…

---

## [Celular automata won't wrap around the window](https://discourse.processing.org/t/celular-automata-wont-wrap-around-the-window/37229)

<div class="topic-metadata">

**Author:** [@rafalou38](https://discourse.processing.org/u/rafalou38)\
**Replies:** 1\
**Last updated:** [May 31, 2022, 6:01am UTC](https://discourse.processing.org/t/celular-automata-wont-wrap-around-the-window/37229 "2022-05-31T06:01:47Z")

</div>

I have partially implemented the Huegene cellular automata with processing, but I still have an issue: it wraps around the screen but stops just after, and I have no idea why code: color\[\]\[\] grid; int MUTATION\_RATE = …

---

## [I need help at my beginner idle game](https://discourse.processing.org/t/i-need-help-at-my-beginner-idle-game/26432)

<div class="topic-metadata">

**Author:** [@Dialias](https://discourse.processing.org/u/Dialias)\
**Replies:** 4\
**Last updated:** [May 30, 2022, 11:53am UTC](https://discourse.processing.org/t/i-need-help-at-my-beginner-idle-game/26432 "2022-05-30T11:53:32Z")

</div>

Hey there, iam a beginner at coding and i wanted to code a clicker game but then this text showed up in the console: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at processing.core.PApplet.r…

---

## [Multidimensional array](https://discourse.processing.org/t/multidimensional-array/37212)

<div class="topic-metadata">

**Author:** [@mvb](https://discourse.processing.org/u/mvb)\
**Replies:** 3\
**Last updated:** [May 30, 2022, 11:21am UTC](https://discourse.processing.org/t/multidimensional-array/37212 "2022-05-30T11:21:02Z")

</div>

I have the following code and I want to achieve the final picture. Can anyone help me to complete it? (this is not homework or anything like that, I am learning at home through examples.) float width\_columns, height\_r…

---

## [Can I stop the animation but still change amount of tiles?](https://discourse.processing.org/t/can-i-stop-the-animation-but-still-change-amount-of-tiles/37209)

<div class="topic-metadata">

**Author:** [@friedadedoncker](https://discourse.processing.org/u/friedadedoncker)\
**Replies:** 2\
**Last updated:** [May 30, 2022, 4:32am UTC](https://discourse.processing.org/t/can-i-stop-the-animation-but-still-change-amount-of-tiles/37209 "2022-05-30T04:32:52Z")

</div>

Can I, in this example of code, somehow stop the animation of the tiles changing but still be able to change the amount of tiles (with an Arduino pot)? If yes, how? Right now, when I stop the loop, the ability to chang…

---

## [PShape setStrokeWeight setStroke error](https://discourse.processing.org/t/pshape-setstrokeweight-setstroke-error/37147)

<div class="topic-metadata">

**Author:** [@Erif](https://discourse.processing.org/u/Erif)\
**Replies:** 7\
**Last updated:** [May 29, 2022, 7:46pm UTC](https://discourse.processing.org/t/pshape-setstrokeweight-setstroke-error/37147 "2022-05-29T19:46:17Z")

</div>

Hi all. I’ve come across an issue where after creating a PShape shape: .setStroke, .setStrokeWeight, shape.Stroke() and shape.strokeWeight() were throwing a GLException: GLBufferObjectTracker.mapBuffer() error. Here’s t…

---

## [Code for foreground window](https://discourse.processing.org/t/code-for-foreground-window/37148)

<div class="topic-metadata">

**Author:** [@Andry](https://discourse.processing.org/u/Andry)\
**Replies:** 10\
**Last updated:** [May 28, 2022, 11:31am UTC](https://discourse.processing.org/t/code-for-foreground-window/37148 "2022-05-28T11:31:24Z")

</div>

Hi there is a code to put window in the foreground, like: SetWindowsPos (0)?

---

## [Halftone dots patterns](https://discourse.processing.org/t/halftone-dots-patterns/36948)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 12\
**Last updated:** [May 28, 2022, 2:33am UTC](https://discourse.processing.org/t/halftone-dots-patterns/36948 "2022-05-28T02:33:49Z")

</div>

Hi there! I am experimenting with pointillism as you can see on my code. I have done a pattern with random sizes of dots but I actually would like to imitate a halftone patterns, where size of dots depends on nears dots…

---

## [Variations of color on a loop](https://discourse.processing.org/t/variations-of-color-on-a-loop/37069)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 12\
**Last updated:** [May 28, 2022, 2:31am UTC](https://discourse.processing.org/t/variations-of-color-on-a-loop/37069 "2022-05-28T02:31:52Z")

</div>

Hi there! I have been working on this loop recently and it is almost perfect, but I want to make little variations between points and when I use random on hue, or saturation or brightness all of them are the same. Could …

---

## [Sketch stops working when I switch to P2D](https://discourse.processing.org/t/sketch-stops-working-when-i-switch-to-p2d/37120)

<div class="topic-metadata">

**Author:** [@friedadedoncker](https://discourse.processing.org/u/friedadedoncker)\
**Replies:** 7\
**Last updated:** [May 26, 2022, 9:06pm UTC](https://discourse.processing.org/t/sketch-stops-working-when-i-switch-to-p2d/37120 "2022-05-26T21:06:30Z")

</div>

Hi, I’m making a grid that would later be interactive. I wanted to try out some things with shaders so switched my sketch to P2D. The second I do this I get a NullPointerException and I’m wondering why. I’m thinking t…

---

## [P2D/P3D causes image flickering and disappearing from draw() loop?!](https://discourse.processing.org/t/p2d-p3d-causes-image-flickering-and-disappearing-from-draw-loop/36877)

<div class="topic-metadata">

**Author:** [@AstroPeng](https://discourse.processing.org/u/AstroPeng)\
**Replies:** 4\
**Last updated:** [May 26, 2022, 5:27pm UTC](https://discourse.processing.org/t/p2d-p3d-causes-image-flickering-and-disappearing-from-draw-loop/36877 "2022-05-26T17:27:16Z")

</div>

void setup(){ PImage flower = loadImage("bloom.jpg"); size(897, 565, P2D); //Line in Question image(flower, 472+26,86, 189,189); } causes flickering but the second does not, however my main project uses createGrap…

---

## [How to improve the performance of Processing?](https://discourse.processing.org/t/how-to-improve-the-performance-of-processing/36577)

<div class="topic-metadata">

**Author:** [@IpNeNaEcRe](https://discourse.processing.org/u/IpNeNaEcRe)\
**Replies:** 9\
**Last updated:** [May 26, 2022, 5:02pm UTC](https://discourse.processing.org/t/how-to-improve-the-performance-of-processing/36577 "2022-05-26T17:02:27Z")

</div>

Recently I code the reaction-diffusion algorithm, following Daniel Shiffman’s tutorial. I use processing to code instead of P5.js in the tutorial. When I run the sketch, I found the frame rate is so low when the sketch …

---

## [3D flocking simulation with two types of boids and octree optimization](https://discourse.processing.org/t/3d-flocking-simulation-with-two-types-of-boids-and-octree-optimization/36992)

<div class="topic-metadata">

**Author:** [@m.codeeee](https://discourse.processing.org/u/m.codeeee)\
**Replies:** 6\
**Last updated:** [May 26, 2022, 1:29pm UTC](https://discourse.processing.org/t/3d-flocking-simulation-with-two-types-of-boids-and-octree-optimization/36992 "2022-05-26T13:29:08Z")

</div>

Hiii, I’m trying to do a 3D flocking simulation with two types of boids and octree optimization. I would like to have two octrees one for each flock in order to then insert an interaction between the two flocks as a met…

---

## [Multiple objs distorting (perspective?)](https://discourse.processing.org/t/multiple-objs-distorting-perspective/37045)

<div class="topic-metadata">

**Author:** [@jimjimmer](https://discourse.processing.org/u/jimjimmer)\
**Replies:** 3\
**Last updated:** [May 26, 2022, 12:36pm UTC](https://discourse.processing.org/t/multiple-objs-distorting-perspective/37045 "2022-05-26T12:36:02Z")

</div>

Hi I’m curious. I adapted the obj example to try and show 10 rockets in a row… The code works but the width of the rockets seem uneven… They are fatter towards the edges can anyone help?\`\` /\*\* \* Load and Display an OBJ…

---

## [My Pictures disapear when using other commands](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996)

<div class="topic-metadata">

**Author:** [@Katharina](https://discourse.processing.org/u/Katharina)\
**Replies:** 3\
**Last updated:** [May 26, 2022, 11:46am UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996 "2022-05-26T11:46:46Z")

</div>

Before giving the Problem + code let me tell you my Programm. Im trying to create a dress up game for my schoolwork. You click on a bar and the game starts. I’ve created 3 lines of arrows (pfeil) for that: \<–(left) a…

---

## ['Error creating webgl context' in j5.ps](https://discourse.processing.org/t/error-creating-webgl-context-in-j5-ps/37096)

<div class="topic-metadata">

**Author:** [@Jess](https://discourse.processing.org/u/Jess)\
**Replies:** 0\
**Last updated:** [May 26, 2022, 3:22am UTC](https://discourse.processing.org/t/error-creating-webgl-context-in-j5-ps/37096 "2022-05-26T03:22:32Z")

</div>

I was trying to run code but kept encountering this error - Can anyone help me understand why it’s happening? What do I need to do to fix it? Is Webgl able to run in p5.js? Thank you!

---

## [Weird fill for a composite 3d PShape](https://discourse.processing.org/t/weird-fill-for-a-composite-3d-pshape/37092)

<div class="topic-metadata">

**Author:** [@gwenroote](https://discourse.processing.org/u/gwenroote)\
**Replies:** 0\
**Last updated:** [May 25, 2022, 10:15pm UTC](https://discourse.processing.org/t/weird-fill-for-a-composite-3d-pshape/37092 "2022-05-25T22:15:07Z")

</div>

I am trying to fill in this shape made of bezier curves, and one of the surfaces has an extra plane when I “fill” it. The flat part of the white plane is the one I’m trying to get rid of. (see side4) I sort of get why i…

---

## [Color 2D texture with noise](https://discourse.processing.org/t/color-2d-texture-with-noise/37049)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 5\
**Last updated:** [May 24, 2022, 4:12pm UTC](https://discourse.processing.org/t/color-2d-texture-with-noise/37049 "2022-05-24T16:12:11Z")

</div>

Howdy! I am doing a background with noise adapting a code from here and I would like to control color to do something as you can see on my pictures, but I don’t understand it as good as I need for that. I can get some cr…

---

## [Constellation with noise](https://discourse.processing.org/t/constellation-with-noise/36965)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 29\
**Last updated:** [May 24, 2022, 2:26am UTC](https://discourse.processing.org/t/constellation-with-noise/36965 "2022-05-24T02:26:39Z")

</div>

Hi there! I am trying to make a loop of points with different distances and sizes beetween them, but something softer that I can get with random. I have started to use noise function, but it is my very first time, so I …

---

## [How to create Vertex to connect points like a line](https://discourse.processing.org/t/how-to-create-vertex-to-connect-points-like-a-line/37030)

<div class="topic-metadata">

**Author:** [@miguelandradebr](https://discourse.processing.org/u/miguelandradebr)\
**Replies:** 6\
**Last updated:** [May 24, 2022, 1:39am UTC](https://discourse.processing.org/t/how-to-create-vertex-to-connect-points-like-a-line/37030 "2022-05-24T01:39:42Z")

</div>

Hello I would like to create a vertex to join the points creating an equal line in the image… How can I do it? I’m using p5.js Thanks

---

## [My pictures in array don't disappear, they overlap](https://discourse.processing.org/t/my-pictures-in-array-dont-disappear-they-overlap/37020)

<div class="topic-metadata">

**Author:** [@Katharina](https://discourse.processing.org/u/Katharina)\
**Replies:** 5\
**Last updated:** [May 22, 2022, 10:12pm UTC](https://discourse.processing.org/t/my-pictures-in-array-dont-disappear-they-overlap/37020 "2022-05-22T22:12:39Z")

</div>

so I made a programm. I dress up game to be excact. I’ve programmed it but there’s one problem: The pictures I use in arrays,when executed only overlap themselves not disappear. Meaning when I click the button “blush” …

---

## [How can i determine which shift/ctrl/alt key is being pressed? \[SOLVED\]](https://discourse.processing.org/t/how-can-i-determine-which-shift-ctrl-alt-key-is-being-pressed-solved/36579)

<div class="topic-metadata">

**Author:** [@RedDeath](https://discourse.processing.org/u/RedDeath)\
**Replies:** 4\
**Last updated:** [May 22, 2022, 4:23pm UTC](https://discourse.processing.org/t/how-can-i-determine-which-shift-ctrl-alt-key-is-being-pressed-solved/36579 "2022-05-22T16:23:36Z")

</div>

Currently trying to figure out how to capture keys which have multiple locations on a typical US layout keyboard, this is just some code I’ve been using to test if this idea can work, and how I should do it. import java…

---

## [Infinite scrolling images](https://discourse.processing.org/t/infinite-scrolling-images/36967)

<div class="topic-metadata">

**Author:** [@oli7er](https://discourse.processing.org/u/oli7er)\
**Replies:** 1\
**Last updated:** [May 22, 2022, 1:10am UTC](https://discourse.processing.org/t/infinite-scrolling-images/36967 "2022-05-22T01:10:39Z")

</div>

Hi everyone, I have been attempting a sketch, which scrolls through images, each image has an 2 more images placed both on top and below it ( visually similar to how an instagram post will have the username/profile phot…

---

## [Pictures in for loop disappear when using other command(redraw();)](https://discourse.processing.org/t/pictures-in-for-loop-disappear-when-using-other-command-redraw/37000)

<div class="topic-metadata">

**Author:** [@Katharina](https://discourse.processing.org/u/Katharina)\
**Replies:** 1\
**Last updated:** [May 21, 2022, 2:20pm UTC](https://discourse.processing.org/t/pictures-in-for-loop-disappear-when-using-other-command-redraw/37000 "2022-05-21T14:20:56Z")

</div>

Before giving the Problem + code let me tell you my Programm. Im trying to create a dress up game for my schoolwork. You click on a bar and the game starts. I’ve created 3 lines of arrows (pfeil) for that: \<–(left) and -…

---

## [Circle Packing. Trying to implement on my project](https://discourse.processing.org/t/circle-packing-trying-to-implement-on-my-project/8368)

<div class="topic-metadata">

**Author:** [@agitcelik](https://discourse.processing.org/u/agitcelik)\
**Replies:** 21\
**Last updated:** [May 21, 2022, 12:56am UTC](https://discourse.processing.org/t/circle-packing-trying-to-implement-on-my-project/8368 "2022-05-21T00:56:07Z")

</div>

Hi, Came here from below youtube discussion, I am working on my final thesis and I watched your video related to circle packing (https://www.youtube.com/watch?v=pF0cadg2mg0). I have some question on my mind. Github li…

---

## [3D Flocking simulation with two species and octree optimisation](https://discourse.processing.org/t/3d-flocking-simulation-with-two-species-and-octree-optimisation/36984)

<div class="topic-metadata">

**Author:** [@m.codeeee](https://discourse.processing.org/u/m.codeeee)\
**Replies:** 0\
**Last updated:** [May 20, 2022, 10:01pm UTC](https://discourse.processing.org/t/3d-flocking-simulation-with-two-species-and-octree-optimisation/36984 "2022-05-20T22:01:27Z")

</div>

Hi, I’m trying to set up a flocking simulation with two species of boids and octree optimization. My problem here is that I want the two species to run on different octrees, and I don’t really understand how to do that …

---

## [Sampler2D doesnt show the exact PImage, but the average color of the PImage](https://discourse.processing.org/t/sampler2d-doesnt-show-the-exact-pimage-but-the-average-color-of-the-pimage/36972)

<div class="topic-metadata">

**Author:** [@Sevval](https://discourse.processing.org/u/Sevval)\
**Replies:** 2\
**Last updated:** [May 20, 2022, 10:54am UTC](https://discourse.processing.org/t/sampler2d-doesnt-show-the-exact-pimage-but-the-average-color-of-the-pimage/36972 "2022-05-20T10:54:28Z")

</div>

I’m trying to write a simple shader where I just copy the current frame of the program into the shader via the shader.set function: PShader shader; PImage screen; void setup(){ size(1000, 1000, P2D); shader = new …

[Previous page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=27)

[Next page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=29)
