# Beginners

**URL:** https://discourse.processing.org/c/processing/processing-beginners/14.md?page=19

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

**Page:** 20

---

## [Problems with fractions](https://discourse.processing.org/t/problems-with-fractions/29605)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 2\
**Last updated:** [April 24, 2021, 5:06pm UTC](https://discourse.processing.org/t/problems-with-fractions/29605 "2021-04-24T17:06:20Z")

</div>

Hi, I am trying to make a program where i need to calculate a fraction (3-2)/2 or just 1/2 which is 0,5 ofcourse, however processing says it is 0. I don’t know if it’s a bug or what. I would just like to know how i can f…

---

## [Switching the location of two values in a IntList](https://discourse.processing.org/t/switching-the-location-of-two-values-in-a-intlist/29567)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 2\
**Last updated:** [April 23, 2021, 5:12pm UTC](https://discourse.processing.org/t/switching-the-location-of-two-values-in-a-intlist/29567 "2021-04-23T17:12:04Z")

</div>

As the title says, I was wondering if there’s a command for switching the location of two values in a IntList. I am trying to make a function so i can create a minheap and it just seems kind of boring to save the value i…

---

## [Need help: problems with light and material of the 3d object](https://discourse.processing.org/t/need-help-problems-with-light-and-material-of-the-3d-object/29566)

<div class="topic-metadata">

**Author:** [@sergio\_dm](https://discourse.processing.org/u/sergio_dm)\
**Replies:** 1\
**Last updated:** [April 23, 2021, 8:43am UTC](https://discourse.processing.org/t/need-help-problems-with-light-and-material-of-the-3d-object/29566 "2021-04-23T08:43:13Z")

</div>

Hi everyone, for my university project I have implemented the marching cubes algorithm and everything seems to work, the only problem is that I can’t manage the lights and the surface material. Here is an example: T…

---

## [Font Install Issues](https://discourse.processing.org/t/font-install-issues/29557)

<div class="topic-metadata">

**Author:** [@YellowGTM](https://discourse.processing.org/u/YellowGTM)\
**Replies:** 5\
**Last updated:** [April 23, 2021, 12:00am UTC](https://discourse.processing.org/t/font-install-issues/29557 "2021-04-23T00:00:10Z")

</div>

Good morning all. I see this topic has been posted before, and resolved to some extent. I’m trying to add a font called “Conthrax”, however the Processing IDE will not load it. The font works in other programs such a…

---

## [Function Return Error](https://discourse.processing.org/t/function-return-error/29501)

<div class="topic-metadata">

**Author:** [@Bromo](https://discourse.processing.org/u/Bromo)\
**Replies:** 11\
**Last updated:** [April 19, 2021, 8:06pm UTC](https://discourse.processing.org/t/function-return-error/29501 "2021-04-19T20:06:40Z")

</div>

Hi, I’m pretty new with functions and was wondering what I could do differently here. Ideally I’d like the function to sort the two numbers given and give me the number that’s closest to 100 (without going over). Current…

---

## [Different Colors when using PGraphics](https://discourse.processing.org/t/different-colors-when-using-pgraphics/29458)

<div class="topic-metadata">

**Author:** [@kweso](https://discourse.processing.org/u/kweso)\
**Replies:** 1\
**Last updated:** [April 17, 2021, 6:58pm UTC](https://discourse.processing.org/t/different-colors-when-using-pgraphics/29458 "2021-04-17T18:58:25Z")

</div>

Hey all! could you tell my why I get different colors when drawing to a PGraphic? PGraphics canvas; void setup(){ size(1060,200); colorMode(HSB,360,100,100,100); background(0,0,100); canvas = createGraphic…

---

## [Boolean function inside a class not working](https://discourse.processing.org/t/boolean-function-inside-a-class-not-working/29426)

<div class="topic-metadata">

**Author:** [@iudividnal](https://discourse.processing.org/u/iudividnal)\
**Replies:** 3\
**Last updated:** [April 17, 2021, 10:26am UTC](https://discourse.processing.org/t/boolean-function-inside-a-class-not-working/29426 "2021-04-17T10:26:12Z")

</div>

Hey there i was creating an animation for a simple game im working on and run into a problem where my simple boolean function inside a class returns an error “NullPointerException” int randomHue; int rainbowHue; boole…

---

## [Problem with for loops](https://discourse.processing.org/t/problem-with-for-loops/29425)

<div class="topic-metadata">

**Author:** [@kairama15](https://discourse.processing.org/u/kairama15)\
**Replies:** 1\
**Last updated:** [April 16, 2021, 8:22pm UTC](https://discourse.processing.org/t/problem-with-for-loops/29425 "2021-04-16T20:22:34Z")

</div>

When I run the following code, when I try to println the variable a in the FOR loop, it doesn’t show up on the window. I would expect the loop to be entered and iterated because m\[0\] is greater than 0, and so is m\[1\], m…

---

## [Want to convert string to int](https://discourse.processing.org/t/want-to-convert-string-to-int/29387)

<div class="topic-metadata">

**Author:** [@spamelim](https://discourse.processing.org/u/spamelim)\
**Replies:** 1\
**Last updated:** [April 15, 2021, 4:19pm UTC](https://discourse.processing.org/t/want-to-convert-string-to-int/29387 "2021-04-15T16:19:58Z")

</div>

Hello, I’m trying to make a program to basically calculate COVID risk off the user’s age. Right now, I coded for the user to be able to type their age, but I want the string they type to be converted to an int when they …

---

## [Unable to generate proper float value in Processing](https://discourse.processing.org/t/unable-to-generate-proper-float-value-in-processing/29352)

<div class="topic-metadata">

**Author:** [@estevancarlos](https://discourse.processing.org/u/estevancarlos)\
**Replies:** 2\
**Last updated:** [April 14, 2021, 12:14am UTC](https://discourse.processing.org/t/unable-to-generate-proper-float-value-in-processing/29352 "2021-04-14T00:14:18Z")

</div>

I am converting p5js to Processing. I’ve actually used Processing for years but I specialize in Javascript. I am surprised at this issue because I’ve never noticed before. Not sure how I overlooked it. When calculating …

---

## [Using reflection to determine color datatype versus int](https://discourse.processing.org/t/using-reflection-to-determine-color-datatype-versus-int/29283)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 8\
**Last updated:** [April 13, 2021, 7:51am UTC](https://discourse.processing.org/t/using-reflection-to-determine-color-datatype-versus-int/29283 "2021-04-13T07:51:13Z")

</div>

Hello again! Is there a way, using reflection, to determine if a given class field is declared as a color field as distinct from an int field? I figure there must be a way, but the following returns both fields as int: …

---

## [How to distinguish different continuous color blocks in an image](https://discourse.processing.org/t/how-to-distinguish-different-continuous-color-blocks-in-an-image/29315)

<div class="topic-metadata">

**Author:** [@elonw](https://discourse.processing.org/u/elonw)\
**Replies:** 1\
**Last updated:** [April 13, 2021, 7:05am UTC](https://discourse.processing.org/t/how-to-distinguish-different-continuous-color-blocks-in-an-image/29315 "2021-04-13T07:05:10Z")

</div>

I want to divide a figure into different continuous color blocks (containing repeated color areas), and calculate their average colors of these blocks in another corresponding rendering (real) image. And consequently …

---

## [Basic Java global variable question](https://discourse.processing.org/t/basic-java-global-variable-question/29230)

<div class="topic-metadata">

**Author:** [@zggong](https://discourse.processing.org/u/zggong)\
**Replies:** 7\
**Last updated:** [April 11, 2021, 8:31pm UTC](https://discourse.processing.org/t/basic-java-global-variable-question/29230 "2021-04-11T20:31:34Z")

</div>

I’m very new to object oriented programming in general, and I have a question about how to instance/work with global variables which might be caused by a lack of understanding of Java/OOP in general rather than being spe…

---

## [Where or how to learn trigonometry for processing?](https://discourse.processing.org/t/where-or-how-to-learn-trigonometry-for-processing/28819)

<div class="topic-metadata">

**Author:** [@resboy2445](https://discourse.processing.org/u/resboy2445)\
**Replies:** 21\
**Last updated:** [April 9, 2021, 5:05pm UTC](https://discourse.processing.org/t/where-or-how-to-learn-trigonometry-for-processing/28819 "2021-04-09T17:05:10Z")

</div>

Hello all! where can i learn trigonometry for processing? or can somebody teach me? my teacher taught it in class and i still don’t understand it, i even watched a bunch of youtube videos and i still don’t understand the…

---

## [How do i make a new image file](https://discourse.processing.org/t/how-do-i-make-a-new-image-file/29235)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 8\
**Last updated:** [April 9, 2021, 4:39pm UTC](https://discourse.processing.org/t/how-do-i-make-a-new-image-file/29235 "2021-04-09T16:39:07Z")

</div>

i know how to save a PImage as a png but i have to overwrite an existing file. can i manually create a new png file in my data folder and then write a PImage to it? if i just try to do PImage.save(filename) it tells me …

---

## [Can random(5) output the number 5?](https://discourse.processing.org/t/can-random-5-output-the-number-5/29241)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 11\
**Last updated:** [April 9, 2021, 1:11pm UTC](https://discourse.processing.org/t/can-random-5-output-the-number-5/29241 "2021-04-09T13:11:31Z")

</div>

Hi! The title says it all. so can floor(random(5)) == 5

---

## [Calculation result doesnt make sense](https://discourse.processing.org/t/calculation-result-doesnt-make-sense/29232)

<div class="topic-metadata">

**Author:** [@Rektic](https://discourse.processing.org/u/Rektic)\
**Replies:** 3\
**Last updated:** [April 9, 2021, 8:42am UTC](https://discourse.processing.org/t/calculation-result-doesnt-make-sense/29232 "2021-04-09T08:42:57Z")

</div>

Hi, I need help. Its simple, 3\*1/4 obviously equals 0.75 but when I write the following code, it says, the result is 0.0 float x = 3\*1/4; void draw(){ println(x); }

---

## [Help with operator "&&"](https://discourse.processing.org/t/help-with-operator/29103)

<div class="topic-metadata">

**Author:** [@Dialias](https://discourse.processing.org/u/Dialias)\
**Replies:** 3\
**Last updated:** [April 4, 2021, 12:22am UTC](https://discourse.processing.org/t/help-with-operator/29103 "2021-04-04T00:22:04Z")

</div>

Hey i have a problem with my code. the console says , unexpected tocen ,&&" in th lower code. import processing.pdf.\*; int money; int mpc; //money per click int owned1; //owned first upgrade boolean buy1;…

---

## [Can't print IntList outside setup function](https://discourse.processing.org/t/cant-print-intlist-outside-setup-function/28965)

<div class="topic-metadata">

**Author:** [@potter3366](https://discourse.processing.org/u/potter3366)\
**Replies:** 4\
**Last updated:** [March 30, 2021, 11:03am UTC](https://discourse.processing.org/t/cant-print-intlist-outside-setup-function/28965 "2021-03-30T11:03:56Z")

</div>

I can print listaA within setup function but not when I press a “w” key. Why? IntList Ptop; final int ROWS = 8; final IntList\[\] listaA = new IntList\[ROWS\]; int value; int index; void setup() { size(520, 220); Ptop…

---

## [Help on running "P3D"](https://discourse.processing.org/t/help-on-running-p3d/28874)

<div class="topic-metadata">

**Author:** [@Freddy](https://discourse.processing.org/u/Freddy)\
**Replies:** 11\
**Last updated:** [March 29, 2021, 9:13pm UTC](https://discourse.processing.org/t/help-on-running-p3d/28874 "2021-03-29T21:13:46Z")

</div>

Hello, i’m in a school in France like teacher of “Stem”. \< I can’t run every “exemple” use P3D.\> In 2D all is gone. I’don’t understand why it doesn’t work. I work with “windows 7” on pedagogic reseau, I’am not adminis…

---

## [Issues with removing an object](https://discourse.processing.org/t/issues-with-removing-an-object/28920)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 4\
**Last updated:** [March 28, 2021, 3:14pm UTC](https://discourse.processing.org/t/issues-with-removing-an-object/28920 "2021-03-28T15:14:13Z")

</div>

Hi! I tried making a program, which makes use of the simplified for loop structure (for(p obj : pro){}) Inside of it, I made a condition stating that if the object obj is outside the screen or has age higher than maxAge…

---

## [About Processing automatically converting double literals to floats](https://discourse.processing.org/t/about-processing-automatically-converting-double-literals-to-floats/28886)

<div class="topic-metadata">

**Author:** [@josephh](https://discourse.processing.org/u/josephh)\
**Replies:** 7\
**Last updated:** [March 28, 2021, 1:34pm UTC](https://discourse.processing.org/t/about-processing-automatically-converting-double-literals-to-floats/28886 "2021-03-28T13:34:46Z")

</div>

Hi everyone, In regular Java and other programming languages, this is well known that you can write : System.out.println(0.1 + 0.2 == 0.3); which gives false!! This is due to floating point precision and how computer…

---

## [Confuse about what beginCamera() and endCamera() does](https://discourse.processing.org/t/confuse-about-what-begincamera-and-endcamera-does/28798)

<div class="topic-metadata">

**Author:** [@Shubham](https://discourse.processing.org/u/Shubham)\
**Replies:** 5\
**Last updated:** [March 28, 2021, 8:59am UTC](https://discourse.processing.org/t/confuse-about-what-begincamera-and-endcamera-does/28798 "2021-03-28T08:59:55Z")

</div>

Beginner in processing and want to use camera function but unable to understand the use of beginCamera() and endCamera(). Can anybody give more information as the reference is also quite unclear?

---

## [Help with FloatList](https://discourse.processing.org/t/help-with-floatlist/28763)

<div class="topic-metadata">

**Author:** [@Leommoraes](https://discourse.processing.org/u/Leommoraes)\
**Replies:** 1\
**Last updated:** [March 23, 2021, 4:43pm UTC](https://discourse.processing.org/t/help-with-floatlist/28763 "2021-03-23T16:43:16Z")

</div>

I need to create random sequences of colors within a FloatList, to create the genius game through this sequence of created colors, someone could help me, because I don’t even know where to start

---

## [How often does the draw function loop?](https://discourse.processing.org/t/how-often-does-the-draw-function-loop/28721)

<div class="topic-metadata">

**Author:** [@alex3](https://discourse.processing.org/u/alex3)\
**Replies:** 4\
**Last updated:** [March 23, 2021, 10:37am UTC](https://discourse.processing.org/t/how-often-does-the-draw-function-loop/28721 "2021-03-23T10:37:06Z")

</div>

Hi, I’m new to processing and I noticed my draw function was looping. Does this always happen and if so how many times does it loop?

---

## [Make text print on screen before the dialog box comes?](https://discourse.processing.org/t/make-text-print-on-screen-before-the-dialog-box-comes/28670)

<div class="topic-metadata">

**Author:** [@resboy2445](https://discourse.processing.org/u/resboy2445)\
**Replies:** 2\
**Last updated:** [March 20, 2021, 10:51pm UTC](https://discourse.processing.org/t/make-text-print-on-screen-before-the-dialog-box-comes/28670 "2021-03-20T22:51:27Z")

</div>

How do i make a text print on the screen before the dialog box comes? i am supposed to make the text be on the screen, then when the user clicks on the screen the user will have to type in the dialog box what is on the s…

---

## [Forced to donate, still won't let me download](https://discourse.processing.org/t/forced-to-donate-still-wont-let-me-download/28682)

<div class="topic-metadata">

**Author:** [@wakingBear](https://discourse.processing.org/u/wakingBear)\
**Replies:** 4\
**Last updated:** [March 20, 2021, 3:45pm UTC](https://discourse.processing.org/t/forced-to-donate-still-wont-let-me-download/28682 "2021-03-20T15:45:42Z")

</div>

I am trying to download v.2.2.1 and the site wont let me until I donate. Well I donated… and it took me to a page that said thanks, with no links for the download… so I was forced to navigate off the page and lo and beho…

---

## [Array causing NullPointerException error?](https://discourse.processing.org/t/array-causing-nullpointerexception-error/28614)

<div class="topic-metadata">

**Author:** [@Mattyjak](https://discourse.processing.org/u/Mattyjak)\
**Replies:** 1\
**Last updated:** [March 17, 2021, 4:45pm UTC](https://discourse.processing.org/t/array-causing-nullpointerexception-error/28614 "2021-03-17T16:45:41Z")

</div>

Hello everyone! Today, I’ve decided to start working on my game. I had some old code for player movement that I wanted to see if I could port over, and here it is. Unfortunately, it keeps throwing me a ‘NullPointerExcept…

---

## [How to draw a curveVertex with color gradient?](https://discourse.processing.org/t/how-to-draw-a-curvevertex-with-color-gradient/28513)

<div class="topic-metadata">

**Author:** [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Replies:** 3\
**Last updated:** [March 14, 2021, 11:25am UTC](https://discourse.processing.org/t/how-to-draw-a-curvevertex-with-color-gradient/28513 "2021-03-14T11:25:40Z")

</div>

Drawing a color gradient with a line, even in 3D, is pretty straight-forward: import peasy.\*; PeasyCam cam; void setup() { size(1300, 1300, P3D); cam = new PeasyCam(this, 200); } void draw() { background(255); …

---

## [How to calculate good-looking bezier control points in 3D?](https://discourse.processing.org/t/how-to-calculate-good-looking-bezier-control-points-in-3d/28504)

<div class="topic-metadata">

**Author:** [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Replies:** 6\
**Last updated:** [March 13, 2021, 10:33pm UTC](https://discourse.processing.org/t/how-to-calculate-good-looking-bezier-control-points-in-3d/28504 "2021-03-13T22:33:24Z")

</div>

I’d like to draw Bezier curves algorithmically, i.e. I’d like the control points to be functions of two data points. Assuming the following Bezier curve: I imagine P0, P1, and P2 form an obtuse triangle where the angl…

[Previous page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=18)

[Next page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=20)
