<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jared</title>
    <description>The latest articles on DEV Community by Jared (@jaredscarr).</description>
    <link>https://dev.to/jaredscarr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1336716%2Ffd93da59-01cb-4ee5-b350-e2932ade470e.png</url>
      <title>DEV Community: Jared</title>
      <link>https://dev.to/jaredscarr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaredscarr"/>
    <language>en</language>
    <item>
      <title>My First Open Source Contribution</title>
      <dc:creator>Jared</dc:creator>
      <pubDate>Mon, 15 Apr 2024 16:28:57 +0000</pubDate>
      <link>https://dev.to/jaredscarr/my-first-open-source-contribution-3j07</link>
      <guid>https://dev.to/jaredscarr/my-first-open-source-contribution-3j07</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;I was involved in a program through &lt;a href="https://www.codeday.org/"&gt;CodeDay&lt;/a&gt; and my university that paired myself, and two other team members, with a mentor that would guide us through an open-source contribution to a project hosted on GitHub. I have worked in software for about 3 years, but I had never contributed to an open-source project. I was grateful for this opportunity to have someone show me the ropes and I will attempt to explain some of the key takeaways from my perspective that may also aid other first time contributors.&lt;/p&gt;

&lt;h3&gt;
  
  
  About the Project
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://deck.gl/"&gt;Deck.gl&lt;/a&gt; is a library for visualizing large geospatial datasets and maps with WebGL.&lt;br&gt;
A typical user of this framework is an individual or team, probably in a developer or data science type role. See their &lt;a href="https://deck.gl/showcase"&gt;showcase&lt;/a&gt; for a great selection of example reports and applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Terms
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Layer&lt;/strong&gt; - A component of Deck.gl that will layer on top of a map or another layer.&lt;br&gt;
&lt;strong&gt;Texture&lt;/strong&gt; - An image in the GPU. It maps to actual images, colors, etc for rendering.&lt;br&gt;
&lt;strong&gt;Frame Buffer Object (FBO)&lt;/strong&gt; - An extension to OpenGL that can render a texture.&lt;br&gt;
&lt;strong&gt;Binding&lt;/strong&gt; - Connects the texture to the renderer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example ArcGis Application
&lt;/h3&gt;

&lt;p&gt;In Figure 1 below, the ArcGis base map is displayed and two layers are overlaid on top of the base map. The first layer is a set of geo-json data that contains all the locations of the airports and are highlighted with magenta circles. The second layer is the arced lines that connect the airports. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyox8yrkwh8im8k7sc3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyox8yrkwh8im8k7sc3u.png" alt="Deck.gl Layer Example Heatmap" width="800" height="438"&gt;&lt;/a&gt;&lt;br&gt;
Figure 1 - ArcGis Map with Layers&lt;/p&gt;

&lt;p&gt;Figure 2 below shows a basic diagram of how this works. Deck.gl provides a pure JavaScript API and also supports React. A base map is selected and then one of the core features, the Deck component, is instantiated and assigned layers that will render to the screen over the map.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F177p4zc2w9muglm1anti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F177p4zc2w9muglm1anti.png" alt="Deck.gl Layer Diagram" width="500" height="266"&gt;&lt;/a&gt;&lt;br&gt;
Figure 2 - Deck.gl Layer Diagram&lt;/p&gt;

&lt;h3&gt;
  
  
  Selected Issue
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://github.com/visgl/deck.gl/issues/8428"&gt;issue&lt;/a&gt; I worked on was to address the broken ArcGis integration which meant that developers could not render DeckGL data on top of the ArcGis map and, while the documentation looked correct, the library was not. To start I had to isolate where in the code the problem existed. There were two places that were relevant for addressing this issue: 1) the &lt;a href="https://github.com/visgl/deck.gl/tree/master/examples/get-started/pure-js/arcgis"&gt;example&lt;/a&gt; application provided for guidance and 2) the &lt;a href="https://github.com/visgl/deck.gl/tree/master/modules"&gt;arcgis module&lt;/a&gt;. My strategy at the beginning was to identify error messages in the console and break them up into sub-problems then search for examples that existed already in the code base that were implemented in a similar manner and use them as a guide. It turned out that none of the errors were immediately helpful. A certain amount of the code was closed-box that I did not have visibility into. My strategy immediately failed. How was I to debug a system that I couldn’t step through?&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges
&lt;/h3&gt;

&lt;p&gt;When I started this work, I had no experience working with shaders, graphics, or the GPU. I was fortunate that my mentor did have significant experience in this area and even wrote an &lt;a href="https://gamedevelopment.tutsplus.com/a-beginners-guide-to-coding-graphics-shaders--cms-23313t"&gt;article&lt;/a&gt; that explained a shader which was very helpful. &lt;/p&gt;

&lt;p&gt;I was used to a development environment where all the code was visible and I could step through it with a debugger. Parts of this system were opaque and I realized I needed a different approach. I drew some diagrams and made some assumptions as to how I thought the system should work and then implemented code that would verify my assumptions or disprove them. I would make a single change, wait for the page to reload, and document what worked and what did not. When I was blocked I reached out for guidance from the maintainers, the Slack community, and my mentor. &lt;/p&gt;

&lt;p&gt;To isolate which parts of the code needed to be updated I traced each method call and identified which pieces of code would render to the screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;I ended up with a pipeline of components that I could isolate to figure out where issues were. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2gi1dg4hotso3h2x4buk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2gi1dg4hotso3h2x4buk.png" alt="Screen Render Diagram" width="561" height="121"&gt;&lt;/a&gt;&lt;br&gt;
Figure 3 - Screen Render Diagram&lt;/p&gt;

&lt;p&gt;What is supposed to occur is ArcGis renders directly to the screen and DeckGL renders to a texture that then renders to the screen. I started with the shader itself and removed both the render and the texture FBO to see if a gradient could be drawn directly to the screen (Figure 4). When that failed, it verified that something was wrong with the shader. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhb1ee3fj8tdbe3g7nq9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhb1ee3fj8tdbe3g7nq9g.png" alt="Render Debug Diagram 1" width="496" height="181"&gt;&lt;/a&gt;&lt;br&gt;
Figure 4 - Render Debug Diagram&lt;/p&gt;

&lt;p&gt;Through some trial and error it turned out that the geometry of the shader required an update and once fixed the gradient rendered which verified that the shader could draw to the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flp3osc4vnvv8bg8xlq32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flp3osc4vnvv8bg8xlq32.png" alt="Gradient image over ArcGis base map" width="315" height="300"&gt;&lt;/a&gt;&lt;br&gt;
Figure 5 - Gradient from Shader&lt;/p&gt;

&lt;p&gt;The next logical choice was to look at the communication between the Deck instance on the other end of the pipeline and the shader. The FBO and DeckGL render were removed and replaced with a hard-coded image to see if it would render (Figure 6). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzh8wbmbaq3fgvrfz6nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzh8wbmbaq3fgvrfz6nh.png" alt="Render Debug Pipeline Diagram 2" width="561" height="171"&gt;&lt;/a&gt;&lt;br&gt;
Figure 6 - Pipeline Debug 1&lt;/p&gt;

&lt;p&gt;If the image rendered did then the shader was okay and if not then the shader was still broken and the DeckGL render could be too. The image rendered (Figure 7)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6tlbi3ebl5hyb5r188w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6tlbi3ebl5hyb5r188w.png" alt="Half blue half red image as texture rendered to screen" width="437" height="300"&gt;&lt;/a&gt;&lt;br&gt;
Figure 7 - Image as Texture Rendered to Screen&lt;/p&gt;

&lt;p&gt;This verified the shader could render if supplied a correctly formed and bound image texture. I looked at the DeckGL render next. Here the binding of the texture to the DeckGL instance needed updating with newly required attributes. Once those were discovered the DeckGL instance could render to the shader (see Figure 8).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iqdo8xayjbfzw5xh0hc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iqdo8xayjbfzw5xh0hc.png" alt="Render Debug Pipeline 3" width="561" height="171"&gt;&lt;/a&gt;&lt;br&gt;
Figure 8 - Pipeline Debug 2&lt;/p&gt;

&lt;p&gt;The last piece of the puzzle was the frame buffer object. The FBO and the texture needed to be reconstructed with the correct parameters and the texture bound to it properly. When the right combinations of attributes were found the map with the proper layers rendered and the sample image was removed (see Figure. 1). This was verified to work by adding a video in the discussion that showed the example functioning in the browser. Maintainers accepted the &lt;a href="https://github.com/visgl/deck.gl/pull/8545"&gt;pull request&lt;/a&gt; and I had my first successful open source contribution!&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;One of the not so obvious elements that I learned from this experience was the importance of tracking what has been done and what has been learned. With all the rabbit-holes, code changes, side-quests, and proven or dis-proven assumptions along the way it is easy to get lost with what you did from week to week. Especially, if one wants to write an article or a quality PR detailing the changes and why they were necessary this document is invaluable.&lt;/p&gt;

&lt;p&gt;I really felt fortunate to be part of this program and I learned so much from the process and from my mentor. Not everyone will have access to this kind of guidance, but I encourage everyone to begin to search for a project they feel they can contribute to. Remember to search issues for the label “good first issue”, if they have a Slack or similar join, and read their contribution guidelines. Happy coding!&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
  </channel>
</rss>
