<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with #opengl - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23opengl</link>
      <pubDate>Sun, 08 Aug 2021 18:00:20 +0000</pubDate>
         <description>Tagged with #opengl - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23opengl/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>P2D &amp; P3D renderer error on MacOS</title>
      <link>https://forum.processing.org/two/discussion/25949/p2d-p3d-renderer-error-on-macos</link>
      <pubDate>Sun, 14 Jan 2018 01:59:23 +0000</pubDate>
      <dc:creator>thesuperdaine</dc:creator>
      <guid isPermaLink="false">25949@/two/discussions</guid>
      <description><![CDATA[<p>Basically I get this error when I try to use either the P2D or P3D renderers. I have seen this problem on the forums before, but they are all using windows or there's some sort of antivirus that prevents the PDE from creating a temp folder. I'm on macOS and I do not have any antivirus installed. It doesn't have anything to do with the code. I am, however, able to export it and run the application flawlessly.</p>

<pre><code>java.lang.UnsatisfiedLinkError: Can't load library: /Users/daineesvang/natives/macosx-universal//nativewindow_awt
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:624)
    at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
    at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:106)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:487)
    at jogamp.nativewindow.NWJNILibLoader.access$000(NWJNILibLoader.java:39)
    at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:49)
    at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:41)
    at java.security.AccessController.doPrivileged(Native Method)
    at jogamp.nativewindow.NWJNILibLoader.loadNativeWindow(NWJNILibLoader.java:41)
    at jogamp.nativewindow.jawt.JAWTUtil.&lt;clinit&gt;(JAWTUtil.java:336)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:346)
    at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:342)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.jogamp.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:342)
    at com.jogamp.newt.NewtFactory$1.run(NewtFactory.java:68)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.jogamp.newt.NewtFactory.&lt;clinit&gt;(NewtFactory.java:65)
    at processing.opengl.PSurfaceJOGL.initIcons(PSurfaceJOGL.java:498)
    at processing.opengl.PSurfaceJOGL.initFrame(PSurfaceJOGL.java:134)
    at processing.core.PApplet.initSurface(PApplet.java:10889)
    at processing.core.PApplet.runSketch(PApplet.java:10776)
    at processing.core.PApplet.main(PApplet.java:10476)
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.
</code></pre>
]]></description>
   </item>
   <item>
      <title>PGraphics and Android : very slow, even with simple sketch</title>
      <link>https://forum.processing.org/two/discussion/25550/pgraphics-and-android-very-slow-even-with-simple-sketch</link>
      <pubDate>Wed, 13 Dec 2017 08:33:01 +0000</pubDate>
      <dc:creator>Adrien</dc:creator>
      <guid isPermaLink="false">25550@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>When I'm running this very simple sketch on a Samsung tab A (2016), frameRate is around 8fps, even with a very simple sketch as this one :</p>

<pre><code>PGraphics pg; 
void setup() {
  size(displayWidth, displayHeight, P2D); 
  pg=createGraphics(width, height);
}

void draw() {
  println("fps : ", frameRate); 
  pg.beginDraw(); 
  pg.stroke(0); 
  pg.ellipse(width/2, height/2, 300, 300); 
  pg.endDraw(); 
  image(pg, 0, 0, width, height);
}
</code></pre>

<p>I tried different render (Default one, P2D, P3D, JAVA2D, OPENGL...), but still.</p>

<p>Do you have any idea where it come from (I have 2 times "OpenGL error 1280 at bot beginDraw(): invalid enum", aswell..) or how to manage things differently? I really need to draw on différent layer, because one has to be refhresh every frame and the other no...</p>

<p>Thanks for your help,</p>

<p>A.</p>
]]></description>
   </item>
   <item>
      <title>How to send modelview matrix to vertex shader</title>
      <link>https://forum.processing.org/two/discussion/24022/how-to-send-modelview-matrix-to-vertex-shader</link>
      <pubDate>Mon, 04 Sep 2017 17:24:52 +0000</pubDate>
      <dc:creator>technosalon</dc:creator>
      <guid isPermaLink="false">24022@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I need some help to understand vertex shader in Processing.</p>

<p>What I want to do is just to change vertices coordinates in vertex shaders, such as in "www.vertexshaderart.com" . In order to do that:</p>

<ol>
<li><p>restore the vertices coordinates into the world coordinates like <code>worldPos = modlviewInv * vertex</code></p></li>
<li><p>move vertices as we like</p></li>
<li><p>re-restore the vertices coordinates into the eye coordinates like <code>newPos = projection * modelview * worldPos</code></p></li>
</ol>

<p>According to the official explanations (<a href="https://github.com/processing/processing/wiki/Advanced-OpenGL" target="_blank" rel="nofollow">https://github.com/processing/processing/wiki/Advanced-OpenGL</a>), the modelview matrix in the vertex shader in Processing is an "IDENTITY" matrix for some performance issues, which means our vertex shader does not know the original modelview matrix, we need to send the unmodified modelview matrix from the processing side to the vertex shader explicitly.</p>

<p>I thought the code below might work, but I failed, which I do not know why:</p>

<p>Processing side:</p>

<pre><code>PGraphicsOpenGL pg = (PGraphicsOpenGL)g;
shader.set("modelviewOriginal", pg.modelview);//send the modelview matrix to the uniform mat4 variable "modelviewOriginal"
</code></pre>

<p>vertex shader side:</p>

<pre><code>vec4 worldPos = modelviewInv * vertex;//restore world coordinates
worldPos = vec4(worldPos.x + 100., worldPos.yzw);//for example, translate x pos
vec4 newPos = projection * modelviewOriginal * worldPos;//re-restore eye coordinates
</code></pre>

<p>Probably, I have been missing something basic stuff, I could not have figured them out so far...</p>

<p>So...., please help me !!!!!</p>
]]></description>
   </item>
   <item>
      <title>Drop library drag-and-drop not working in P2D or P3D mode</title>
      <link>https://forum.processing.org/two/discussion/17092/drop-library-drag-and-drop-not-working-in-p2d-or-p3d-mode</link>
      <pubDate>Fri, 10 Jun 2016 16:48:40 +0000</pubDate>
      <dc:creator>solidsnake</dc:creator>
      <guid isPermaLink="false">17092@/two/discussions</guid>
      <description><![CDATA[<p>sDrop works fine with the default renderer, but if the sketch is running in P2D or P3D mode, drag-n-drop does not work anymore, for example :</p>

<p><code>size(400, 400, P3D);</code></p>

<p>Any workaround for this?</p>
]]></description>
   </item>
   <item>
      <title>Issues updating openGL old code to processing 3.0</title>
      <link>https://forum.processing.org/two/discussion/18215/issues-updating-opengl-old-code-to-processing-3-0</link>
      <pubDate>Mon, 19 Sep 2016 14:16:25 +0000</pubDate>
      <dc:creator>bontempos</dc:creator>
      <guid isPermaLink="false">18215@/two/discussions</guid>
      <description><![CDATA[<p>I am having a hard time trying to find references to put this to work on processing 3.0!!!</p>

<p><a href="https://processing.org/discourse/beta/num_1273419930.html" target="_blank" rel="nofollow">https://processing.org/discourse/beta/num_1273419930.html</a></p>

<p>In case anyone is experienced about these libraries I would be really glad!</p>
]]></description>
   </item>
   <item>
      <title>I don't have OpenGL installed.</title>
      <link>https://forum.processing.org/two/discussion/19603/i-don-t-have-opengl-installed</link>
      <pubDate>Thu, 08 Dec 2016 11:29:09 +0000</pubDate>
      <dc:creator>bahtiyar_a</dc:creator>
      <guid isPermaLink="false">19603@/two/discussions</guid>
      <description><![CDATA[<p><img src="https://forum.processing.org/two/uploads/imageupload/491/IM35H570Y8L0.png" alt="Screen Shot 2016-12-08 at 7.19.48 PM" title="Screen Shot 2016-12-08 at 7.19.48 PM" /></p>

<p>Don't ask me why you don't have opengl, I have no idea.</p>

<p>Where do I download the OpenGL library for processing?</p>

<p>Thank you.</p>
]]></description>
   </item>
   <item>
      <title>How do I set the OpenGL device?</title>
      <link>https://forum.processing.org/two/discussion/18244/how-do-i-set-the-opengl-device</link>
      <pubDate>Thu, 22 Sep 2016 12:35:30 +0000</pubDate>
      <dc:creator>DasPez</dc:creator>
      <guid isPermaLink="false">18244@/two/discussions</guid>
      <description><![CDATA[<p>I recently started playing around with the "PixelFlow" library and the framerate is bad. 
The code is running on the iGPU : (console output)</p>

<pre><code>PixelFlow v0.18  -  <a href="http://www.thomasdiewald.com" target="_blank" rel="nofollow">http://www.thomasdiewald.com</a>
-------------------------------------------------------------------
    OPENGL_VENDOR:         Intel
    OPENGL_RENDERER:       Intel(R) HD Graphics 530
    OPENGL_VERSION:        4.4.0 - Build 20.19.15.4454
    GLSLVersionString:     #version 440 core
    GLSLVersionNumber:     4.40.0
    GLVersion:             4.4 (Core profile, arb, compat[ES2, ES3], FBO, hardware) - 4.4.0 - Build 20.19.15.4454
    GLVendorVersionNumber: 20.19.15 (- Build 20.19.15.4454)
-------------------------------------------------------------------
</code></pre>

<p>Is it possible to use my GTX 960M?</p>
]]></description>
   </item>
   <item>
      <title>P2D now slow, even on an empty sketch, wasn't so slow before</title>
      <link>https://forum.processing.org/two/discussion/14874/p2d-now-slow-even-on-an-empty-sketch-wasn-t-so-slow-before</link>
      <pubDate>Fri, 12 Feb 2016 15:08:52 +0000</pubDate>
      <dc:creator>Adrien</dc:creator>
      <guid isPermaLink="false">14874@/two/discussions</guid>
      <description><![CDATA[<p>Hi, 
This morning I could run a particle system sketch with size(displayWidth, displayHeight, P2D) at 60fps.
Now, even an empty sketch (just 1 line in draw to display frameRate, size in setup with the same arguments), run around 30 fps.
I install new drivers for my graphic card, reboot computer, nothing runnning behind...
Any clues?
Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Low-level OpenGL and Framebuffer object</title>
      <link>https://forum.processing.org/two/discussion/15582/low-level-opengl-and-framebuffer-object</link>
      <pubDate>Sun, 20 Mar 2016 11:45:44 +0000</pubDate>
      <dc:creator>Coda</dc:creator>
      <guid isPermaLink="false">15582@/two/discussions</guid>
      <description><![CDATA[<p>Hi all, first post.
I think I need to do some low-level OpenGL programming (which means learning OpenGL too), but I've been trying to avoid ditching Processing and moving to another IDE with JOGL/LWJGL because I believe that I can work around the problems I'm facing (not problems with Processing, but problems with my understanding/knowledge level). Also, Processing provides a lot of helper code that saves me time (not having to write OBJ importing classes for example). Although I'm sure I can achieve what I want in Processing, I have this massive uphill learning curve trying to figure out how to work with the OpenGL interface underneath. I'm not a super Java coder, but I understand core OO principles like inheritance/polymorphism etc. I've seen the basic OpenGL demo sketches, So I now understand basic use.</p>

<p>More specifically - I'm doing a project which will be marked by unknown examiners (CS academics) running on any platform in [linux|mac|win]. Because of having some experience with Processing the past few years, and that the people who will run my code are Processing users/teachers themselves it was an obvious choice for me to have some guarantee of cross-platform compatibility. Part of my project will rely on rendering depth information (to a texture or the framebuffer depth buffer) so I can access this info in the frag shader. You're probably now thinking "that's Shadow mapping", yes, like that, but it isn't my goal. So I guess the question is "Is trying to use a PGraphics object (instanced with createGraphics) not the way forward, should I just get a GL instance and do OpenGL manually?"</p>

<p>(I also have an issue with OBJ importing (each face being a child object), but I might open a separate thread about that).</p>

<p>Sorry for the long-winded post, and thanks for any advice.</p>
]]></description>
   </item>
   <item>
      <title>Fonts behaving unpredictably (Android)</title>
      <link>https://forum.processing.org/two/discussion/15268/fonts-behaving-unpredictably-android</link>
      <pubDate>Thu, 03 Mar 2016 21:14:23 +0000</pubDate>
      <dc:creator>wit221</dc:creator>
      <guid isPermaLink="false">15268@/two/discussions</guid>
      <description><![CDATA[<p>Mode: Android Mode 0232
Renderer: P3D
TextMode: PConstants.SHAPE</p>

<hr />

<p><strong>Issue 1: Some letters not displaying at all</strong></p>

<p>The issue is shown here:</p>

<p><a href="http://imgur.com/a/8iVjy" target="_blank" rel="nofollow">http://imgur.com/a/8iVjy</a></p>

<p>I am using createFont() in setup with smooth turned on and textFont(), then using textSize() at different points.</p>

<p>The problem appears on some Android devices, on some not. I have tried to look for the problem. I created the following table:</p>

<p><a href="http://imgur.com/8RQNQlA" target="_blank" rel="nofollow">http://imgur.com/8RQNQlA</a></p>

<p>Could not draw conclusions from it apart from the observation that most vowels display and most consonants don't. Most signs display.</p>

<hr />

<p><strong>Issue 2: Some letters displayed with stroke</strong></p>

<p>The issue is shown here:</p>

<p><a href="http://imgur.com/uCC54D1" target="_blank" rel="nofollow">http://imgur.com/uCC54D1</a></p>

<p>On devices on which the font actually displays, some letters are rendered with stroke, some not. In the picture above, notice how "b" and "d" display differently than the rest. I tried calling noStroke() before text(), but to no avail. Switching from P3D to OPENGL does not solve the problem. Changing the font did not solve the issue either.</p>

<hr />

<p><strong>Issue 3: textFont not changing the font when called second and all consecutive times.</strong></p>

<p>Since in P3D and OPENGL the fonts are generated as bitmaps in the setup(), different fonts must be instantiated to accomodate for different font sizes. Then, in draw(), textFont() should be used depending on the dimensions of the text which needs to be displayed. That is the way it should work in theory. In practice, however, in my case, calling textFont() works only once, at the beginning. Consecutive calls bear no effect.</p>

<hr />

<p>Neither issue is, to my knowledge, present with the JAVA2D renderer.</p>

<p>Could anybody point me to the right direction to solve any of the problems?</p>

<p>Thank you in advance.</p>
]]></description>
   </item>
   <item>
      <title>Why does openGL not work in Processing 3.0?</title>
      <link>https://forum.processing.org/two/discussion/15111/why-does-opengl-not-work-in-processing-3-0</link>
      <pubDate>Thu, 25 Feb 2016 10:04:13 +0000</pubDate>
      <dc:creator>Aishh</dc:creator>
      <guid isPermaLink="false">15111@/two/discussions</guid>
      <description><![CDATA[<p>When I use openGL or P3D in Processing 3.0, I don't get an output. Instead I get an error that OPENGL is deprecated.</p>
]]></description>
   </item>
   <item>
      <title>P3D not always creating window...</title>
      <link>https://forum.processing.org/two/discussion/14454/p3d-not-always-creating-window</link>
      <pubDate>Thu, 14 Jan 2016 09:08:13 +0000</pubDate>
      <dc:creator>Kodbin</dc:creator>
      <guid isPermaLink="false">14454@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I've been using the processing core in an IntelliJ project for some time.  However I've seen the same thing in the processing environment, so I don't think it is to do with my set up...</p>

<p>What I'm seeing is that P3D sketches sometimes work entirely normally, a window appears and graphics render in it.</p>

<p>But on other occasions the sketch will appear (as far as the debugger is concerned) to be running normally, but no window will appear.</p>

<p>At first I thought this was some sort of corruption, where it would work for a while after a reboot and then break, but it's more erratic than that, and sometimes it starts working again.  This is a Windows 7 Enterprise machine, many cores, nVidia Quatro K5000 with twin monitors.</p>

<p>I thought it might be some sort of driver problem, but I don't generally see any graphics problems and there's nothing I can see in the system logs -- just some notes about NVWMI connecting to new processes, which seem the same whether the process works or not...</p>

<p>I realise this may be in part triggered by my exact set-up here, but any ideas?</p>

<p>Ian</p>
]]></description>
   </item>
   <item>
      <title>OpenGL error</title>
      <link>https://forum.processing.org/two/discussion/10984/opengl-error</link>
      <pubDate>Mon, 25 May 2015 03:42:48 +0000</pubDate>
      <dc:creator>philspitler</dc:creator>
      <guid isPermaLink="false">10984@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to run this 3d sphere viewer on Android and am getting openGL errors.</p>

<p>This is the error I get.</p>

<blockquote class="Quote">
  <p>Already called drawing on another PGraphicsOpenGL object
  FATAL EXCEPTION: GLThread 202
  Process: processing.test.eqviewer, PID: 2258
  java.lang.NullPointerException
    at processing.opengl.PGraphicsOpenGL.setFramebuffer(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.beginPixelsOp(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.readPixels(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.loadPixels(Unknown Source)
    at processing.test.eqviewer.EqViewer.setup(EqViewer.java:81)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.opengl.PGL$AndroidRenderer.onDrawFrame(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)</p>
</blockquote>

<p>The code works great in JAVA mode on OSX.</p>

<p>Any ideas?</p>

<p>Thanks.</p>

<p>Phil</p>

<pre><code>public boolean showlight = false;
PGraphics portal;
PImage gp;
public boolean viewwin= false;
public boolean autorotate = false;

import processing.opengl.*;
PImage bg;
PImage texmap;
PGraphics pop;
PImage mmget;
int sDetail = 175;  //Sphere detail setting
float rotationX = 0;
float rotationY = 0;
float velocityX = 0;
float velocityY = 0;
float globeRadius = 300;
float pushBack = 0;
public float rotation = 0.0f;
float[] cx,cz,sphereX,sphereY,sphereZ;
float sinLUT[];
float cosLUT[];
float SINCOS_PRECISION = 0.5f;
int SINCOS_LENGTH = int(360.0 / SINCOS_PRECISION);
public String  [] file;


// 

void setup()
{
  file = new String[9];

file[0]  = "vr.jpg";  
  mmget = new PImage (255,255);


 if (texmap == null){
  size(640, 480, P3D); 
      texmap  = loadImage  (file[0]);

 }


 // smooth();
  pop = createGraphics(width,height,P3D);
  pop.beginDraw();
  loadPixels();
  portal = createGraphics(width,height,P3D);
  portal.beginDraw();
  portal.loadPixels();
if (texmap !=null){
  portal.image(texmap,0,0,width,height);
  portal.endDraw();
  portal.updatePixels();

  pop.loadPixels();
  pop.image(texmap,0,0,width,height);
  pop.updatePixels();
}
  initializeSphere(sDetail);

  gp = new PImage (640,480);
  noStroke();
  gp.loadPixels();


}



int x,y,i,w=512;

int r(int a){return int(random(a));}

void draw()
{   


  background(0);




  rotation +=.02;
 translate(width/2,height/2, 300);
  //rotateY(radians(180)); // uncomment to look ahead
 if (autorotate){
 rotateY(rotation);
 }

 renderGlobe();


if (viewwin){
 for (int x= 0;x&lt;width;x++){
 for (int y= 0;y&lt;height;y++){

      set (x,y,portal.pixels[x+width*y]);

   }
 }

}
 }


void renderGlobe()
{
  pushMatrix();
  //translate(width/2.0, height/2.0, pushBack);
  pushMatrix();
  noFill();
  stroke(255,200);
  strokeWeight(2);
  //smooth();
  popMatrix();
  lights();   
  pushMatrix();
  rotateX( radians(-rotationX) ); 
  rotateY( radians(270 - rotationY) );
  fill(200);
  noStroke();
  textureMode(IMAGE); 




  texturedSphere(globeRadius,texmap);

  popMatrix(); 
  popMatrix();
  rotationX += velocityX;
  rotationY += velocityY;
  velocityX *= 0.95;
  velocityY *= 0.95;

  // Implements mouse control (interaction will be inverse when sphere is  upside down)
  if(mousePressed){
    velocityX += (mouseY-pmouseY) * 0.01;
    velocityY -= (mouseX-pmouseX) * 0.01;
  }
}

void initializeSphere(int res)
{
  sinLUT = new float[SINCOS_LENGTH];
  cosLUT = new float[SINCOS_LENGTH];

  for (int i = 0; i &lt; SINCOS_LENGTH; i++) {
    sinLUT[i] = (float) Math.sin(i * DEG_TO_RAD * SINCOS_PRECISION);
    cosLUT[i] = (float) Math.cos(i * DEG_TO_RAD * SINCOS_PRECISION);
  }

  float delta = (float)SINCOS_LENGTH/res;
  float[] cx = new float[res];
  float[] cz = new float[res];

  // Calc unit circle in XZ plane
  for (int i = 0; i &lt; res; i++) {
    cx[i] = -cosLUT[(int) (i*delta) % SINCOS_LENGTH];
    cz[i] = sinLUT[(int) (i*delta) % SINCOS_LENGTH];
  }

  // Computing vertexlist vertexlist starts at south pole
  int vertCount = res * (res-1) + 2;
  int currVert = 0;

  // Re-init arrays to store vertices
  sphereX = new float[vertCount];
  sphereY = new float[vertCount];
  sphereZ = new float[vertCount];
  float angle_step = (SINCOS_LENGTH*0.5f)/res;
  float angle = angle_step;

  // Step along Y axis
  for (int i = 1; i &lt; res; i++) {
    float curradius = sinLUT[(int) angle % SINCOS_LENGTH];
    float currY = -cosLUT[(int) angle % SINCOS_LENGTH];
    for (int j = 0; j &lt; res; j++) {
      sphereX[currVert] = cx[j] * curradius;
      sphereY[currVert] = currY;
      sphereZ[currVert++] = cz[j] * curradius;
    }
    angle += angle_step;
  }
  sDetail = res;
}

// Generic routine to draw textured sphere
void texturedSphere(float r, PImage t)
{
  int v1,v11,v2;
  r = (r + 240 ) * 0.33;
  beginShape(TRIANGLE_STRIP);
  texture(t);
  float iu=(float)(t.width-1)/(sDetail);
  float iv=(float)(t.height-1)/(sDetail);
  float u=0,v=iv;
  for (int i = 0; i &lt; sDetail; i++) {
    vertex(0, -r, 0,u,0);
    vertex(sphereX[i]*r, sphereY[i]*r, sphereZ[i]*r, u, v);
    u+=iu;
  }
  vertex(0, -r, 0,u,0);
  vertex(sphereX[0]*r, sphereY[0]*r, sphereZ[0]*r, u, v);
  endShape(CLOSE);  

  // Middle rings
  int voff = 0;
  for(int i = 2; i &lt; sDetail; i++) {
    v1=v11=voff;
    voff += sDetail;
    v2=voff;
    u=0;
    beginShape(TRIANGLE_STRIP);
    texture(t);
    for (int j = 0; j &lt; sDetail; j++) {
      vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1++]*r, u, v);
      vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2++]*r, u, v+iv);
      u+=iu;
    }

    // Close each ring
    v1=v11;
    v2=voff;
    vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1]*r, u, v);
    vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v+iv);
    endShape(CLOSE);
    v+=iv;
  }
  u=0;

  // Add the northern cap
  beginShape(TRIANGLE_STRIP);
  texture(t);
  for (int i = 0; i &lt; sDetail; i++) {
    v2 = voff + i;
    vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v);
    vertex(0, r, 0,u,v+iv);   
    u+=iu;
  }
  vertex(0, r, 0,u, v+iv);
  vertex(sphereX[voff]*r, sphereY[voff]*r, sphereZ[voff]*r, u, v);
  endShape(CLOSE);

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>OpenGL Ocean Simulation</title>
      <link>https://forum.processing.org/two/discussion/13818/opengl-ocean-simulation</link>
      <pubDate>Mon, 07 Dec 2015 03:26:58 +0000</pubDate>
      <dc:creator>rtavakko</dc:creator>
      <guid isPermaLink="false">13818@/two/discussions</guid>
      <description><![CDATA[<pre><code>PImage ground;
//This is the final PShape
PShape surface;
PShader texShader;

PShape[][] test;

//Width and length of the ocean vertex matrix
int w,l;

//This timer is used to generate random wave ripples 
int timer;

//This is the height matrix for each vertex
float[][] elevation;

boolean[][] flag;

void setup() {  
  frameRate(30);

  timer = 0;

  size(800, 800, P3D);  
  ground = loadImage("ocean.jpg");

  w = 200;
  l = 200;

  elevation = new float[w][l];
  flag = new boolean[w][l];

  test = new PShape[w-1][l-1];

  for(int i = 0; i &lt; w; i++)
  {
    for(int j = 0; j &lt; l; j++)
    {
      //Initial vertex elevation value
      elevation[i][j] = random(-1,1);
      flag[i][j] = true;
    }
  }

  surface = createSurface(w, l, 200, ground);
  texShader = loadShader("texfrag.glsl", "texvert.glsl");
}

void draw() {   
  background(0);

  //Calculate movements of each vertex and wave
  runOcean();

  //Write vertex positions to the PShape
  updateShape();

  shader(texShader);  

  //Move to appropriate positions
  translate((width-200)/2, (height-200)/2,350);  
  rotateX(PI/2.75);

  shape(surface); 
}

//This function creates a PShape using the points from elevation[][]
PShape createSurface(int w, int d, int detail, PImage tex) {

  textureMode(NORMAL);
  PShape sh = createShape(GROUP);

  sh.beginShape();
  sh.noStroke();

  for(int i = 0; i &lt; detail-1; i++)
  {
    for(int j = 0; j &lt; detail-1; j++)
    {
      PShape tmp = createShape();
      tmp.beginShape(QUAD);
      tmp.noStroke();
      tmp.texture(ground);      
      tmp.vertex(i*(w/detail),j*(d/detail),elevation[i][j],float(i)/detail,float(j)/detail);
      tmp.vertex((i+1)*(w/detail),j*(d/detail),elevation[i+1][j],float(i+1)/detail,float(j)/detail);
      tmp.vertex((i+1)*(w/detail),(j+1)*(d/detail),elevation[i+1][j+1],float(i+1)/detail,float(j+1)/detail);
      tmp.vertex(i*(w/detail),(j+1)*(d/detail),elevation[i][j+1],float(i)/detail,float(j+1)/detail);
      tmp.endShape();

      sh.addChild(tmp);
    }
  }
  return sh;
}

//Calculate movements of each vertex and wave
void runOcean()
{
  //This is for the ordinary random movement which is there
  //even when there are no waves
  for(int i = 0; i &lt; w; i++)
  {
    for(int j = 0; j &lt; l; j++)
    { 
      if(!flag[i][j])
       {
          elevation[i][j] =random(-.5,0.5);
          elevation[i][j] = constrain(elevation[i][j],-2,2);
          flag[i][j] = true;
       }
       if(flag[i][j])
       {
         flag[i][j] = false;
       }
    }
  }
}

//This writes the points from elevation[][] to the vertices of 'surface'
void updateShape()
{
  for(int i = 0; i &lt; w - 1; i++)
  {
    for(int j = 0; j &lt; l - 1; j++)
    {       
      PVector v  = surface.getChild(i + j*(w-1)).getVertex(0);
      surface.getChild(i + j*(w-1)).setVertex(0,v.x,v.y,elevation[i][j]);
      v  = surface.getChild(i + j*(w-1)).getVertex(1);
      surface.getChild(i + j*(w-1)).setVertex(1,v.x,v.y,elevation[i+1][j]);
      v  = surface.getChild(i + j*(w-1)).getVertex(2);
      surface.getChild(i + j*(w-1)).setVertex(2,v.x,v.y,elevation[i+1][j+1]);
      v  = surface.getChild(i + j*(w-1)).getVertex(3);
      surface.getChild(i + j*(w-1)).setVertex(3,v.x,v.y,elevation[i][j+1]);
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Texture filtering</title>
      <link>https://forum.processing.org/two/discussion/11149/texture-filtering</link>
      <pubDate>Thu, 04 Jun 2015 09:40:59 +0000</pubDate>
      <dc:creator>aferriss</dc:creator>
      <guid isPermaLink="false">11149@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I was wondering if it's possible to set the texture filtering of PGraphics anywhere, or if I'd have to use PGL instead? I searched around in the code and found some bits where it's being set up beforehand, but it'd be nice if I had control over this. <a href="https://github.com/processing/processing/blob/master/core/src/processing/opengl/Texture.java" target="_blank" rel="nofollow">https://github.com/processing/processing/blob/master/core/src/processing/opengl/Texture.java</a></p>

<p>Seems like it's set to NEAREST off the bat, but I'd like to change to LINEAR.</p>

<p>Thanks!</p>
]]></description>
   </item>
   <item>
      <title>¿cómo puedo instalar la librería openGL en processing?         How I can install the OpenGL library?</title>
      <link>https://forum.processing.org/two/discussion/12473/como-puedo-instalar-la-libreria-opengl-en-processing-how-i-can-install-the-opengl-library</link>
      <pubDate>Fri, 11 Sep 2015 05:53:16 +0000</pubDate>
      <dc:creator>edwins04</dc:creator>
      <guid isPermaLink="false">12473@/two/discussions</guid>
      <description><![CDATA[<p>Me gustaría que me ayudaran a instalar la librería openGL en processing, he buscado y no encuentro como instalarla.</p>

<p>I would like to help me install the OpenGL library in processing, I have searched and can not find how to install it.</p>
]]></description>
   </item>
   <item>
      <title>Calling strokeWeight() while P3D is true</title>
      <link>https://forum.processing.org/two/discussion/12090/calling-strokeweight-while-p3d-is-true</link>
      <pubDate>Fri, 14 Aug 2015 19:17:40 +0000</pubDate>
      <dc:creator>TheyCallMeLuke</dc:creator>
      <guid isPermaLink="false">12090@/two/discussions</guid>
      <description><![CDATA[<p><code>size(500, 500, P3D);
 strokeWeight(5);
 line(100, 100, 400, 400);</code></p>

<p>I want to draw a line with a width of 5. However, after calling strokeWeight() while P3D is true, the width of the line is still 1. Why doesn't the code show a line with a width of 5?</p>
]]></description>
   </item>
   <item>
      <title>Help with dated OpenGl code</title>
      <link>https://forum.processing.org/two/discussion/12012/help-with-dated-opengl-code</link>
      <pubDate>Sat, 08 Aug 2015 20:38:20 +0000</pubDate>
      <dc:creator>XYZ</dc:creator>
      <guid isPermaLink="false">12012@/two/discussions</guid>
      <description><![CDATA[<p>Hello. I've been having issues with running a sketch I have found that was made back in 2012. I've updated a lot of the code but there are some functions and ways of calling with OpenGl that give me errors. I would appreciate if anyone could help me to update the following:</p>

<p><code>PGraphicsOpenGL pg = (PGraphicsOpenGL) g;        // processings opengl graphics object
PGL pgl = beginPGL();
gl2 = ((PJOGL)pgl).gl.getGL2();
    pgl.enable(GL2.GL_LINE_SMOOTH);        // make points round
    pgl.LineWidth(lineWeight);
    gl.glBegin(GL.GL_LINES);</code></p>

<p>Currently I'm getting "the function LineWidth(int) does not exist." What do I need to change? I'm using Processing 2.2.1</p>

<p>Dated sketch can be found here: <a href="https://github.com/trentbrooks/Noise-Ink/tree/master/NoiseInk" target="_blank" rel="nofollow">https://github.com/trentbrooks/Noise-Ink/tree/master/NoiseInk</a></p>
]]></description>
   </item>
   <item>
      <title>OPENGL error when compiling with Eclipse</title>
      <link>https://forum.processing.org/two/discussion/11636/opengl-error-when-compiling-with-eclipse</link>
      <pubDate>Thu, 09 Jul 2015 21:13:17 +0000</pubDate>
      <dc:creator>KessonDalef</dc:creator>
      <guid isPermaLink="false">11636@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, I am attempting to compile a sketch with Eclipse, following the tutorial by Daniel Shiffman at <a rel="nofollow" href="http://www.learningprocessing.com/tutorials/processing-in-eclipse/">http://www.learningprocessing.com/tutorials/processing-in-eclipse/</a></p>

<p>It seems to work, but when I need to render with OPENGL it gives me some errors:</p>

<pre><code>java.lang.NoClassDefFoundError: javax/media/opengl/awt/GLCanvas
    at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
    at processing.opengl.PGraphicsOpenGL.&lt;init&gt;(PGraphicsOpenGL.java:518)
    at processing.opengl.PGraphics3D.&lt;init&gt;(PGraphics3D.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at processing.core.PApplet.makeGraphics(PApplet.java:1919)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at exoskeleton.MyProcessingSketch.setup(MyProcessingSketch.java:66)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.awt.GLCanvas
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 15 more
Exception in thread "Animation Thread" java.lang.RuntimeException: javax/media/opengl/awt/GLCanvas
    at processing.core.PApplet.makeGraphics(PApplet.java:1944)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at exoskeleton.MyProcessingSketch.setup(MyProcessingSketch.java:66)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Unknown Source)
</code></pre>

<p>Any idea about it?
Hope that it is correct section.
Thanks</p>
]]></description>
   </item>
   <item>
      <title>text() in P3D throws a warning at every frame</title>
      <link>https://forum.processing.org/two/discussion/11195/text-in-p3d-throws-a-warning-at-every-frame</link>
      <pubDate>Sun, 07 Jun 2015 07:38:52 +0000</pubDate>
      <dc:creator>wit221</dc:creator>
      <guid isPermaLink="false">11195@/two/discussions</guid>
      <description><![CDATA[<p>In Eclipse, every time text() is called within draw(), the following log of the type warning is displayed :</p>

<p>  GL_INVALID_ENUM</p>

<p>This log bears the tag:</p>

<p>ADRENO ES-20</p>

<p>The text is still displayed, but the warning gets called every frame, making it impossible to see other logs.
I have tried to use different types and numbers of arguments for the text() function, but nothing helped. The default renderer version of text() does not throw any warnings.</p>

<p>Do you know how to solve this issue? I am not trying to find a workaround, like filtering out the warning in eclipse in order to see other logs. I would like to know how to eliminate that warning.</p>

<p>Any help is greatly appreciated.</p>
]]></description>
   </item>
   <item>
      <title>P2D and P3D not working in Java mode.</title>
      <link>https://forum.processing.org/two/discussion/8302/p2d-and-p3d-not-working-in-java-mode</link>
      <pubDate>Sun, 23 Nov 2014 06:54:06 +0000</pubDate>
      <dc:creator>zcutner</dc:creator>
      <guid isPermaLink="false">8302@/two/discussions</guid>
      <description><![CDATA[<p>I've been trying to get P2D and P3D working, however when I try to load any of the examples on the website, my screen just goes white and then grey (in Java mode). In JavaScript mode, all the examples work perfectly. I am on Windows 7 and using version 2.2.1, I'd be really grateful for any help!</p>
]]></description>
   </item>
   </channel>
</rss>