# P3D and noSmooth(), points disappear

**URL:** <https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770>\
**Category:** Processing\
**Created:** [September 10, 2020, 2:39am UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770 "2020-09-10T02:39:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimyoung](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jimyoung](https://discourse.processing.org/u/jimyoung)\
**Post date:** [September 10, 2020, 2:39am UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/1 "2020-09-10T02:39:52Z")

</div>

Hi everyone - I am having a strange bug, and I hope I’m just overlooking something really simple. I’m using the P3D renderer to do opengl-like calls, and I’m not a fan of the antialiasing. However, if I use noSmooth, points fail to draw. Lines still draw.

Here’s a minimal example:

```auto
void setup() {
  size(640, 640, P3D);
  //noSmooth();
}

void draw() {
  beginShape(POINTS);
    vertex(10,10);
    vertex(100,100);
  endShape(POINTS);
}

```

uncomment noSmooth(), and the points fail to draw. Thanks!

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 10, 2020, 12:08pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/2 "2020-09-10T12:08:14Z")

</div>

Hi, @jimyoung  
True. When testing I discovered that this also is the case using point().  
It seems that when using P3D mode you have to give a minimal strokeWeight(1.5);

---

<div class="post-metadata">

**Author:** ![jimyoung](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jimyoung](https://discourse.processing.org/u/jimyoung)\
**Post date:** [September 10, 2020, 4:37pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/3 "2020-09-10T16:37:58Z")

</div>

and a quick followup. Man POINTS is slow in processing. I’m testing a line algorithm, and the exact same code is about 30x faster on JOGL than on P3D (!!).

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [September 11, 2020, 12:33pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/4 "2020-09-11T12:33:02Z")

</div>

That sounds about right - you testing JOGL by itself or using `beginPGL()`?

---

<div class="post-metadata">

**Author:** ![jimyoung](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jimyoung](https://discourse.processing.org/u/jimyoung)\
**Post date:** [September 11, 2020, 1:38pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/5 "2020-09-11T13:38:54Z")

</div>

I was using JOGL in straight Java (without linking to Processing).

I’ve since found how I can access OpenGL 2 context in Processing 3, and that approach brings the processing speed up to what I’d expect. I didn’t realize that Processing only simulates OpenGL 2 in the current version.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [September 11, 2020, 1:57pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/6 "2020-09-11T13:57:29Z")

</div>

> [@jimyoung](#):
>
> I didn’t realize that Processing only simulates OpenGL 2 in the current version.

Not sure what you mean there?! The renderer has overhead in certain scenarios - it’s not simulating anything - but it’s not the same as working directly with raw GL either. I’m not sure why you’re mentioning OpenGL 2 rather than OpenGL 3, but it’s definitely possible to make performant point clouds using `beginPGL()` for low level OpenGL without directly accessing JOGL classes. Check out eg. [GitHub - kessoning/processing\_opengl\_demonstration\_pogl: OpenGL implementation in Processing using vertex and fragment shaders, by sharing the float buffer from Processing to OpenGL through NIO.](https://github.com/KessonDalef/processing_opengl_demonstration_pogl)

---

<div class="post-metadata">

**Author:** ![jimyoung](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jimyoung](https://discourse.processing.org/u/jimyoung)\
**Post date:** [September 11, 2020, 2:47pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/7 "2020-09-11T14:47:10Z")

</div>

Sorry Neil - rushing between tasks and my comments are a little underspecified.

I’ve struggled to find clear documentation on using OpenGL in Processing, so your link is certainly helpful. There seems to be several ways about it, and the documentation online is mixed to say the least.

My requirements are that I need to use immediate mode OpenGL, which was the standard in OpenGL2. You know, the glBegin, glEnd, etc etc.

I read somewhere (I can’t find the link currently) that in Processing 3., the OpenGL hooks for immediate mode were removed, and processing just emulates that functionality when we use the beginShape/endShape, vertex, etc., calls. This certainly would explain my performance issue.

I found that I can set the OpenGl profile to a lower value which enables me to get the GL2 context  
(PJOGL.profile = 1; … PJOGL pgl = (PJOGL) beginPGL(); gl2 = pgl.gl.getGL2()😉 and then I can use that with my immediate mode functions.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [September 11, 2020, 4:15pm UTC](https://discourse.processing.org/t/p3d-and-nosmooth-points-disappear/23770/8 "2020-09-11T16:15:25Z")

</div>

> [@jimyoung](#):
>
> I read somewhere (I can’t find the link currently) that in Processing 3., the OpenGL hooks for immediate mode were removed, and processing just emulates that functionality when we use the beginShape/endShape, vertex, etc., calls. This certainly would explain my performance issue.

True, except for the idea that it explains your performance issue! 😄

You might be thinking of [Advanced OpenGL · processing/processing Wiki · GitHub](https://github.com/processing/processing/wiki/Advanced-OpenGL#processing-3x)
