# FX2D is better than P2D

**URL:** <https://discourse.processing.org/t/fx2d-is-better-than-p2d/42937>\
**Category:** Processing\
**Created:** [October 11, 2023, 12:47am UTC](https://discourse.processing.org/t/fx2d-is-better-than-p2d/42937 "2023-10-11T00:47:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuhuhwy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nuhuhwy/32/18485_2.png) [@nuhuhwy](https://discourse.processing.org/u/nuhuhwy)\
**Post date:** [October 11, 2023, 12:47am UTC](https://discourse.processing.org/t/fx2d-is-better-than-p2d/42937/1 "2023-10-11T00:47:23Z")

</div>

If you want to use GLSL and a pressure library, use P2D.

If not, use FX2D, because:

- Rounded Rectangles in `rect(100,100,200,200,25);` look incredibly weird, if you want clear strokes. (compare it using FX2D / Default renderer & OPENGL, it looks different)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/8/1842b8d622cf1b7c23bd57fed6563cd2b348d48e.png)

- Key Presses in OPENGL behave completly different then in the default renderer or FX2D (hard to describe, try example), example:

```auto
import processing.javafx.*;

String inputString = "";

void setup() {
  size(400, 200, FX2D); //try P2D or FX2D
}

void draw() {
  background(220);
  fill(0);
  textSize(24);
  text(inputString, 20, 40);
}

void keyTyped() {
  inputString = inputString + key;
}

```

- Cursors are the OPENGL default ones, and when used multiple times in one draw call, they start to glitch.

```auto
void setup() {
  size(400, 400, P2D);
}

void draw() {
  background(220);
  cursor(ARROW);
  cursor(ARROW);
  cursor(ARROW);
  noCursor();
}

```

Why not use the default renderer? Because FX2D gives a performance increase like P2D, but doesn’t behave like OPENGL.

This is making it hard to develop something cool, due to these features being needed to develop a good functioning application.

I wish the processing devs (if its processings fault for these errors) would change some of the OPENGL functionalities. They probably can’t do anything about some of the stuff.

I don’t wanna bash OPENGL, but it annoys me, and i had to let it out.

These “perks” have been tested on Windows & Linux.

Happy coding 🙂

---

<div class="post-metadata">

**Author:** ![adrinalino](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@adrinalino](https://discourse.processing.org/u/adrinalino)\
**Post date:** [October 15, 2023, 8:11am UTC](https://discourse.processing.org/t/fx2d-is-better-than-p2d/42937/2 "2023-10-15T08:11:19Z")

</div>

Sounds good. How do I install javafx in processing 4.3?  
Cheers,  
Adrian.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [October 15, 2023, 12:37pm UTC](https://discourse.processing.org/t/fx2d-is-better-than-p2d/42937/3 "2023-10-15T12:37:41Z")

</div>

> How do I install javafx in processing 4.3?

Install the Library:

 ![fx](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/3/4399a41dc103196c0432aea50dddaf560a465ed9.png)
