# Coding Questions

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

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

**Page:** 10

---

## [Applying a texture to a .obj shape in P3D](https://discourse.processing.org/t/applying-a-texture-to-a-obj-shape-in-p3d/43225)

<div class="topic-metadata">

**Author:** [@Sayoregg](https://discourse.processing.org/u/Sayoregg)\
**Replies:** 5\
**Last updated:** [November 16, 2023, 5:06pm UTC](https://discourse.processing.org/t/applying-a-texture-to-a-obj-shape-in-p3d/43225 "2023-11-16T17:06:44Z")

</div>

Hello, I am trying to load in a model with a texture in processing. I managed to load in the shape itself, but even after applying a texture to it the model is just fully black. I followed the setTexture() example with…

---

## [How to make multiple enemies affect health](https://discourse.processing.org/t/how-to-make-multiple-enemies-affect-health/43209)

<div class="topic-metadata">

**Author:** [@3xotic109](https://discourse.processing.org/u/3xotic109)\
**Replies:** 4\
**Last updated:** [November 16, 2023, 5:32am UTC](https://discourse.processing.org/t/how-to-make-multiple-enemies-affect-health/43209 "2023-11-16T05:32:17Z")

</div>

//Declared Global Variables final static float MOVE\_SPEED = 7.5; final static float SPRITE\_SCALE = 50.0/64; final static float SPRITE\_SCALE1 = 50.0/1920; final static float SPRITE\_SCALE2 =50.0/45; final static float SPRI…

---

## [How to animate properly arcs according to time with millis()? (draw letters animation)](https://discourse.processing.org/t/how-to-animate-properly-arcs-according-to-time-with-millis-draw-letters-animation/42986)

<div class="topic-metadata">

**Author:** [@lolonulu](https://discourse.processing.org/u/lolonulu)\
**Replies:** 38\
**Last updated:** [November 14, 2023, 1:57pm UTC](https://discourse.processing.org/t/how-to-animate-properly-arcs-according-to-time-with-millis-draw-letters-animation/42986 "2023-11-14T13:57:39Z")

</div>

Hello, Here is my attempt to animate arcs with millis(). It is not smooth, it jumps… Not what it should be! Thanks a lot in advance. Best, L float startTime; void setup() { size(400, 400); startTime=millis(); }…

---

## [How to reduce an abstract 2D trajectory to segments between points in a given set?](https://discourse.processing.org/t/how-to-reduce-an-abstract-2d-trajectory-to-segments-between-points-in-a-given-set/43159)

<div class="topic-metadata">

**Author:** [@amundsen](https://discourse.processing.org/u/amundsen)\
**Replies:** 9\
**Last updated:** [November 13, 2023, 7:45am UTC](https://discourse.processing.org/t/how-to-reduce-an-abstract-2d-trajectory-to-segments-between-points-in-a-given-set/43159 "2023-11-13T07:45:00Z")

</div>

Hello, I am looking for the right tools/algorithms to code some movements/trajectories in 2D. The idea is to have abstract movements and translate them to sequences of line segments (polylines?) linking points selected …

---

## [Two problems in code (table sheet)](https://discourse.processing.org/t/two-problems-in-code-table-sheet/43181)

<div class="topic-metadata">

**Author:** [@kusspuss](https://discourse.processing.org/u/kusspuss)\
**Replies:** 14\
**Last updated:** [November 11, 2023, 7:08pm UTC](https://discourse.processing.org/t/two-problems-in-code-table-sheet/43181 "2023-11-11T19:08:39Z")

</div>

Table table; int numRows = 30; // Number of rows int numCols = 7; // Number of columns float cellWidth = 100; // Adjustable cell width float cellHeight = 27; // Adjustable cell height float tableWidth, tableHeight; // …

---

## [Ellipse Loop + Animation (raining color lines)](https://discourse.processing.org/t/ellipse-loop-animation-raining-color-lines/43174)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 29\
**Last updated:** [November 11, 2023, 1:03pm UTC](https://discourse.processing.org/t/ellipse-loop-animation-raining-color-lines/43174 "2023-11-11T13:03:41Z")

</div>

Hi there! I am trying to draw a lot of drops falling across the screen, from diferents heights. I can draw a loop with many drops and I can animate one drop, but I can not mix both :sweat\_smile: could you please help m…

---

## [Cull faces in P3D](https://discourse.processing.org/t/cull-faces-in-p3d/43127)

<div class="topic-metadata">

**Author:** [@Noodlybanan](https://discourse.processing.org/u/Noodlybanan)\
**Replies:** 4\
**Last updated:** [November 10, 2023, 10:04pm UTC](https://discourse.processing.org/t/cull-faces-in-p3d/43127 "2023-11-10T22:04:02Z")

</div>

Hi! I was wondering if it is possible to set a face, to only be visible from one angle, as it would increase performance also known as culling faces. Thanks for all your advice :slight\_smile: Im programming a voxel engi…

---

## [Halftone like effect](https://discourse.processing.org/t/halftone-like-effect/43172)

<div class="topic-metadata">

**Author:** [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Replies:** 1\
**Last updated:** [November 9, 2023, 11:59am UTC](https://discourse.processing.org/t/halftone-like-effect/43172 "2023-11-09T11:59:25Z")

</div>

Hallo, i saw this image, and i wonde how can it be achieved I mean, it is NOT following any grid / matrix pattern or wave pattern so to follow and test the images brightness on every spot, so to draw bigger / smaller wh…

---

## [Simple animation displaying inconsistently](https://discourse.processing.org/t/simple-animation-displaying-inconsistently/43116)

<div class="topic-metadata">

**Author:** [@MKCreating](https://discourse.processing.org/u/MKCreating)\
**Replies:** 3\
**Last updated:** [November 7, 2023, 7:47pm UTC](https://discourse.processing.org/t/simple-animation-displaying-inconsistently/43116 "2023-11-07T19:47:51Z")

</div>

Hello, I have created a sketch and the println function shows it all seems to work but the animation just doesn’t seem to show for me. Sometimes when I minimise and then expand the window the lines do show but its very …

---

## [Filling the overlap of 2 circles](https://discourse.processing.org/t/filling-the-overlap-of-2-circles/43165)

<div class="topic-metadata">

**Author:** [@SkaterDodo](https://discourse.processing.org/u/SkaterDodo)\
**Replies:** 1\
**Last updated:** [November 8, 2023, 4:56am UTC](https://discourse.processing.org/t/filling-the-overlap-of-2-circles/43165 "2023-11-08T04:56:17Z")

</div>

Hi everyone! So I was wondering if its possible to fill the part that is overlaping of 2 circles overlaping and leave the rest white or in a different color. The problem extends a little from this, but I feel that if I…

---

## [Underlap and overlap](https://discourse.processing.org/t/underlap-and-overlap/43158)

<div class="topic-metadata">

**Author:** [@Ernest](https://discourse.processing.org/u/Ernest)\
**Replies:** 2\
**Last updated:** [November 7, 2023, 11:30pm UTC](https://discourse.processing.org/t/underlap-and-overlap/43158 "2023-11-07T23:30:38Z")

</div>

Hi all, Basic question, sorry. When we draw overlapping circles in a circular pattern - a bit like the petals of a flower - using a for loop, each new circle overlaps the former. However, the first circle is overlappe…

---

## [Check if mouse is in an arc](https://discourse.processing.org/t/check-if-mouse-is-in-an-arc/43154)

<div class="topic-metadata">

**Author:** [@Batman](https://discourse.processing.org/u/Batman)\
**Replies:** 2\
**Last updated:** [November 5, 2023, 10:36pm UTC](https://discourse.processing.org/t/check-if-mouse-is-in-an-arc/43154 "2023-11-05T22:36:27Z")

</div>

"float cx, cy; float arcRadius; float startAngle, endAngle, rotation; void setup() { size(400, 400); background(255); cx = width / 2; cy = height / 2; arcRadius = 150; } void draw() { background(255); transla…

---

## [Processing Java mode return Index of sorted array](https://discourse.processing.org/t/processing-java-mode-return-index-of-sorted-array/43063)

<div class="topic-metadata">

**Author:** [@seany](https://discourse.processing.org/u/seany)\
**Replies:** 1\
**Last updated:** [October 31, 2023, 9:13am UTC](https://discourse.processing.org/t/processing-java-mode-return-index-of-sorted-array/43063 "2023-10-31T09:13:39Z")

</div>

Hello This is my first post. I am using: Processing 4 1293 for Linux In Java mode, I want to sort an array, but want to get the index of the sorted array. Example: array = {1,4,2,4,1,4,3,4,5}; // this is my input} s…

---

## [How to use computer shaders with Processing](https://discourse.processing.org/t/how-to-use-computer-shaders-with-processing/43092)

<div class="topic-metadata">

**Author:** [@Batman](https://discourse.processing.org/u/Batman)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 7:41pm UTC](https://discourse.processing.org/t/how-to-use-computer-shaders-with-processing/43092 "2023-10-30T19:41:48Z")

</div>

Hello. I am trying to create Boids but there limits to just using the CPU especially when you want about 50000 birds flying about. I am pretty experienced in processing but I have never dived into the shader side of it …

---

## [Getting accented typed chars from keys (like "é")](https://discourse.processing.org/t/getting-accented-typed-chars-from-keys-like-e/43099)

<div class="topic-metadata">

**Author:** [@villares](https://discourse.processing.org/u/villares)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 4:40pm UTC](https://discourse.processing.org/t/getting-accented-typed-chars-from-keys-like-e/43099 "2023-10-30T16:40:03Z")

</div>

I found this answer from @George on StackOverflow but it doesn’t work for me: I’m on Linux using a Portuguese Layout that uses “dead keys”(?) like “backtick” + a to make à or “acute” + e to make é. Any tips?

---

## [Minecraft-Like Clone Lagging too much](https://discourse.processing.org/t/minecraft-like-clone-lagging-too-much/43083)

<div class="topic-metadata">

**Author:** [@Noodlybanan](https://discourse.processing.org/u/Noodlybanan)\
**Replies:** 4\
**Last updated:** [October 29, 2023, 12:45am UTC](https://discourse.processing.org/t/minecraft-like-clone-lagging-too-much/43083 "2023-10-29T00:45:44Z")

</div>

Hi! I am programming a Minecraft Like Clone in processing to learn more about the language. I have an RTX3050 but rendering 6800 triangles is only running at 20FPS. It would be helpfull if someone could explain me why it…

---

## [Make window be always focused](https://discourse.processing.org/t/make-window-be-always-focused/43059)

<div class="topic-metadata">

**Author:** [@Noodlybanan](https://discourse.processing.org/u/Noodlybanan)\
**Replies:** 2\
**Last updated:** [October 28, 2023, 1:52pm UTC](https://discourse.processing.org/t/make-window-be-always-focused/43059 "2023-10-28T13:52:51Z")

</div>

Hi! Is there a possibility to make a window be forced to always stay focused? Thanks for any advice in advance, -Libby :slight\_smile:

---

## [Jump in Processing?](https://discourse.processing.org/t/jump-in-processing/43025)

<div class="topic-metadata">

**Author:** [@AniManOtaku](https://discourse.processing.org/u/AniManOtaku)\
**Replies:** 4\
**Last updated:** [October 27, 2023, 10:31am UTC](https://discourse.processing.org/t/jump-in-processing/43025 "2023-10-27T10:31:40Z")

</div>

Hello, I know that processing is not very suitable for this purpose but I want to make a small pixel game with it. I need the character to jump a certain height in a certain time. I’ve already written some code. main: …

---

## [Creating detached windows](https://discourse.processing.org/t/creating-detached-windows/42987)

<div class="topic-metadata">

**Author:** [@Noodlybanan](https://discourse.processing.org/u/Noodlybanan)\
**Replies:** 34\
**Last updated:** [October 24, 2023, 7:29pm UTC](https://discourse.processing.org/t/creating-detached-windows/42987 "2023-10-24T19:29:37Z")

</div>

Hi! I found some code by others here, who helped me to create processing applications that don’t have a default windows title bar. This inspired me to try this, I just don’t know on how to start. Now, I want to know, i…

---

## [Mapping PVector heading() to another range](https://discourse.processing.org/t/mapping-pvector-heading-to-another-range/42999)

<div class="topic-metadata">

**Author:** [@gomako](https://discourse.processing.org/u/gomako)\
**Replies:** 2\
**Last updated:** [October 18, 2023, 10:19am UTC](https://discourse.processing.org/t/mapping-pvector-heading-to-another-range/42999 "2023-10-18T10:19:22Z")

</div>

I am creating a PVector using the .fromAngle() method. I use an variable that increments from 0 to TWO\_PI. When I access the heading() of the vector, I get a range from 0 → PI → -PI → 0. Is this expected behaviour? I’m t…

---

## [selectInput() + loadTable()](https://discourse.processing.org/t/selectinput-loadtable/42966)

<div class="topic-metadata">

**Author:** [@xxxdiegoxxx](https://discourse.processing.org/u/xxxdiegoxxx)\
**Replies:** 3\
**Last updated:** [October 17, 2023, 11:47am UTC](https://discourse.processing.org/t/selectinput-loadtable/42966 "2023-10-17T11:47:45Z")

</div>

Hi! im on a sketch in which i have some classes and one of then should take a .csv file and create some lists. ive set a global string to receive the selectInput() result and asked the class to generate the table using …

---

## [Array of pixels (enclosed in shape)](https://discourse.processing.org/t/array-of-pixels-enclosed-in-shape/42946)

<div class="topic-metadata">

**Author:** [@Wouter](https://discourse.processing.org/u/Wouter)\
**Replies:** 8\
**Last updated:** [October 12, 2023, 12:31pm UTC](https://discourse.processing.org/t/array-of-pixels-enclosed-in-shape/42946 "2023-10-12T12:31:04Z")

</div>

Hi there! If you draw a closed shape in processing, is there a way to get all points/pixels that the shape encloses in a separate array? Best wishes, Wouter

---

## [Help wanted using complicated math drawing (spline)](https://discourse.processing.org/t/help-wanted-using-complicated-math-drawing-spline/42911)

<div class="topic-metadata">

**Author:** [@nuhuhwy](https://discourse.processing.org/u/nuhuhwy)\
**Replies:** 2\
**Last updated:** [October 8, 2023, 4:48am UTC](https://discourse.processing.org/t/help-wanted-using-complicated-math-drawing-spline/42911 "2023-10-08T04:48:04Z")

</div>

I tried writing some code that allows the user to add points to an array, then draws a dotted line which is curved. Meaning this is happens: I tried figuring this out myself, but it didnt end well. The only thing i …

---

## [Complex gradient loop](https://discourse.processing.org/t/complex-gradient-loop/42832)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 31\
**Last updated:** [October 7, 2023, 3:17am UTC](https://discourse.processing.org/t/complex-gradient-loop/42832 "2023-10-07T03:17:39Z")

</div>

Hi there! I am trying to do a gradient with multiple focal points, like the one you can see on this Daniel Otoole artwork. I have found this useful code on happycoding and I am playing with it to get something more …

---

## [Execute code when sketch stops](https://discourse.processing.org/t/execute-code-when-sketch-stops/42868)

<div class="topic-metadata">

**Author:** [@garrettlynch](https://discourse.processing.org/u/garrettlynch)\
**Replies:** 4\
**Last updated:** [October 4, 2023, 3:17pm UTC](https://discourse.processing.org/t/execute-code-when-sketch-stops/42868 "2023-10-04T15:17:53Z")

</div>

I’m trying to execute code when a sketch stops. I’ve been using this as a guide (Run code on exit - Processing Forum). There seems to be three scenarios that this can occur 1) Closing the window 2) Hitting the ESC key 3)…

---

## [Color issue when circles overlap](https://discourse.processing.org/t/color-issue-when-circles-overlap/42867)

<div class="topic-metadata">

**Author:** [@tomashau](https://discourse.processing.org/u/tomashau)\
**Replies:** 1\
**Last updated:** [October 1, 2023, 12:47pm UTC](https://discourse.processing.org/t/color-issue-when-circles-overlap/42867 "2023-10-01T12:47:43Z")

</div>

Hi, I am running into an issue trying to create this effect. I am trying to make new circles for each mousePressed that have the same gradient border. To achieve the orange border I have added an orange stroke, and the w…

---

## [Write color pixel to an Image](https://discourse.processing.org/t/write-color-pixel-to-an-image/42849)

<div class="topic-metadata">

**Author:** [@matheplica](https://discourse.processing.org/u/matheplica)\
**Replies:** 1\
**Last updated:** [September 28, 2023, 3:01pm UTC](https://discourse.processing.org/t/write-color-pixel-to-an-image/42849 "2023-09-28T15:01:00Z")

</div>

Hi, I’m trying to draw green pixel from a layer to a PImage. But I’ve got this result unexpected : The code seems ok, there is something I don’t understand. PImage result; PGraphics msk; void setup() { size(360, 2…

---

## [How to fill in a checker pattern with PVectors?](https://discourse.processing.org/t/how-to-fill-in-a-checker-pattern-with-pvectors/42822)

<div class="topic-metadata">

**Author:** [@asymmetric](https://discourse.processing.org/u/asymmetric)\
**Replies:** 10\
**Last updated:** [September 28, 2023, 3:40am UTC](https://discourse.processing.org/t/how-to-fill-in-a-checker-pattern-with-pvectors/42822 "2023-09-28T03:40:49Z")

</div>

Hi, I am having a hard time changing the fill(); on the following terrain code. How can I fill(); in a black and white pattern? import processing.svg.\*; boolean record; // a class to representing a point on our grid. …

---

## [SVG export fails to produce wanted output](https://discourse.processing.org/t/svg-export-fails-to-produce-wanted-output/42838)

<div class="topic-metadata">

**Author:** [@appas](https://discourse.processing.org/u/appas)\
**Replies:** 4\
**Last updated:** [September 26, 2023, 5:42pm UTC](https://discourse.processing.org/t/svg-export-fails-to-produce-wanted-output/42838 "2023-09-26T17:42:42Z")

</div>

Hi, I am trying to export an image drawn by my sketch as SVG. The export runs through, but the result is wrong. Here is the output of the sketch in the render window: …and here is the exported image as rendered by b…

---

## [Arcs and angles with PI (wings)](https://discourse.processing.org/t/arcs-and-angles-with-pi-wings/42797)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 17\
**Last updated:** [September 23, 2023, 8:13pm UTC](https://discourse.processing.org/t/arcs-and-angles-with-pi-wings/42797 "2023-09-23T20:13:55Z")

</div>

Hi there! I’m trying to draw some arcs with right angle, but I can’t understand how to use PI in processing. Doing some test I was able to make an angle from 0 to 90°, but I don’t know how to draw another from 135° to 45…

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

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