# GSOC 2019: Regarding New OpenGL Renderer

**URL:** <https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780>\
**Category:** Summer of Code\
**Created:** [March 30, 2019, 8:06am UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780 "2019-03-30T08:06:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![tianshuai](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tianshuai](https://discourse.processing.org/u/tianshuai)\
**Post date:** [March 30, 2019, 8:06am UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/1 "2019-03-30T08:06:24Z")

</div>

Hello,  
I’m Tianshuai pursuing Software Engineering from Harbin Institute of Technology, China. I hope to work on New OpenGL Renderer during GSOC 2019. But I encountered some problems with the project.

1. I found that the project imported processing.core, but it’s not in lib. I found it in [processing](https://github.com/processing/processing), so if I want to run the test code in [LWJGL](https://github.com/codeanticode/processing-lwjgl), do I need to fork and clone the code in processing as well?
2. What kind of 2D and 3D renderers do we have to make? What should it looks like? What functions should it provide? Is there a template that can be referenced? I feel a little confused. Forgive me for being the first time with 2D and 3D renderers.

Any suggestions would be great.  
Tianshuai

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 30, 2019, 9:49pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/2 "2019-03-30T21:49:40Z")

</div>

@tianshuai – I can’t answer the project questions, but I can tell you that the _current_ OpenGL 2D and 3D renderers are P2D and P3D, and they are extensively documented in the Processing reference, tutorials, and Java API.

- [https://processing.org/reference/size\_.html](https://processing.org/reference/size_.html)
- [https://processing.org/tutorials/p3d/](https://processing.org/tutorials/p3d/)
- [http://processing.github.io/processing-javadocs/core/processing/opengl/package-summary.html](http://processing.github.io/processing-javadocs/core/processing/opengl/package-summary.html)

Are you already familiar with the current opengl 2D/3D in Processing?

---

<div class="post-metadata">

**Author:** ![Andres](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andres/32/18007_2.png) [@Andres](https://discourse.processing.org/u/Andres)\
**Post date:** [April 2, 2019, 10:53pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/3 "2019-04-02T22:53:37Z")

</div>

@tianshuai answering your specific questions:

1. That’s correct, the processing-core is included as project dependency in the Java Build Path:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/563e85af8fc25031ef439523ae45433f2af3b63b.png)

1. The renderers should be P2D and P3D, for 2D and 3D rendering respectively. They are already implemented in the code of processing-lwjgl, as the PGraphicsLWJGL2D PGraphicsLWJGL3D classes. Both are subclasses of PGraphicsLWJGL, which implements all the rendering functionality that’s common to 2D and 3D rendering.

More generally, as it currently stands, the LWJGL renderer works pretty well on Windows, however, there are number of incompatibilities on Mac that make it difficult to use and in fact would require some initialization changes in PApplet itself.

Andres

---

<div class="post-metadata">

**Author:** ![tianshuai](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tianshuai](https://discourse.processing.org/u/tianshuai)\
**Post date:** [April 3, 2019, 2:30pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/4 "2019-04-03T14:30:23Z")

</div>

@jeremydouglass — Thank you so much. I found those documentations quite helpful and I’m still reading them.  
Tianshuai

---

<div class="post-metadata">

**Author:** ![tianshuai](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tianshuai](https://discourse.processing.org/u/tianshuai)\
**Post date:** [April 3, 2019, 3:27pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/5 "2019-04-03T15:27:25Z")

</div>

@Andres — Thanks a lot for your answers. I noticed that the methods in [processing.opengl.PGraphics2D](https://github.com/processing/processing/blob/master/core/src/processing/opengl/PGraphics2D.java) are almost the same with those in [processing.lwjgl.PGraphicsLWJGL2D](https://github.com/codeanticode/processing-lwjgl/blob/master/src/codeanticode/lwjgl/PGraphicsLWJGL2D.java). And they work normally except for some issues on the Mac. So I suppose we might need to implement some other new methods and I want to know how to get good ideas. Should I dive deeper in LWJGL? I hope I‘m asking the right question.  
Also I’m drafting my proposal and I’ll post it here as soon as it’s finished.

---

<div class="post-metadata">

**Author:** ![Andres](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andres/32/18007_2.png) [@Andres](https://discourse.processing.org/u/Andres)\
**Post date:** [April 3, 2019, 8:42pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/6 "2019-04-03T20:42:05Z")

</div>

@tianshuai the code in these two classes is almost the same because the only difference between the 2D renderers between the JOGL-based and the LWJGL-based libraries is that in the first case you inherit PGraphicsOpenGL and in the second PGraphicsLWJGL. And the latter is just a subclass of PGraphicsOpenGL that overrides the createSurface() method to return a PSurfaceLWJGL instead of a PSurfaceJOGL. Those are the ones that contain the binding-specific code.

However, this is not the biggest challenge of this project, the most serious issue is the incompatibility between LWJGL and AWT on Mac, I tried to provide some more details in this wiki:

> **[codeanticode/processing-lwjgl](https://github.com/codeanticode/processing-lwjgl/wiki)**
>
> Processing LWJGL library. Contribute to codeanticode/processing-lwjgl development by creating an account on GitHub.

I hope that’s useful.

---

<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:** [April 4, 2019, 10:57am UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/7 "2019-04-04T10:57:37Z")

</div>

> [@Andres](#):
>
> However, this is not the biggest challenge of this project, the most serious issue is the incompatibility between LWJGL and AWT on Mac, I tried to provide some more details in this wiki:

I was looking at this recently, partly because running headless could also improve JOGL performance. It would be good to make that headless exception in runSketch optional and then see what works and what needs working around, because some of the AWT things you list should work OK headless.

Of course, an interesting fact in this context is that there’s just been a flurry of commits in JOGL over the last few weeks - it might be alive again!

---

<div class="post-metadata">

**Author:** ![tianshuai](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tianshuai](https://discourse.processing.org/u/tianshuai)\
**Post date:** [April 4, 2019, 3:59pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/8 "2019-04-04T15:59:20Z")

</div>

@Andres Thanks again for your detailed answers and patience. I suppose that I’ve come to know the main task of this project, the incompatibility between LWJGL and AWT on Mac. After reading the wiki, I think [Making AWT optional in PApplet](https://github.com/codeanticode/processing-lwjgl/wiki#making-awt-optional-in-papplet) might be a good solution since we can’t change GLFW. So I will focus on how to modularize AWT and handle the init stuff that’s in PApplet.main().  
Tianshuai

---

<div class="post-metadata">

**Author:** ![tianshuai](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@tianshuai](https://discourse.processing.org/u/tianshuai)\
**Post date:** [April 5, 2019, 5:23pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/9 "2019-04-05T17:23:25Z")

</div>

@Andres Hi, I finally finished a preliminary [proposal](https://docs.google.com/document/d/1e0TdQik8l4Ft_6t16K8rVpaDJPnGjuc7WTBEc4BeH4I/edit?usp=sharing) and hope to get some advice. Thanks for your time in advance.

---

<div class="post-metadata">

**Author:** ![Andres](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andres/32/18007_2.png) [@Andres](https://discourse.processing.org/u/Andres)\
**Post date:** [April 7, 2019, 8:54pm UTC](https://discourse.processing.org/t/gsoc-2019-regarding-new-opengl-renderer/9780/10 "2019-04-07T20:54:16Z")

</div>

@tianshuai thanks, I made some comments in your draft.
