How can I achieve noSmooth() with the P3D renderer ?

edited April 2017 in Questions about Code

Hi,

I'd like to render basic 3D shapes without any aliasing/smoothing with a PGraphics instance using the P3D renderer, but noSmooth() doesn't seem to work.

In OF I remember calling setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); on a texture.

What would be the equivalent in Processing ?

Thank you, George

Answers

  • edited April 2017 Answer ✓

    This has been answered on stackoverflow: ((PGraphicsOpenGL) buffer).textureSampling(2);

    full test sketch:

    PGraphics buffer;
    PGraphicsOpenGL pgl;
    
    void setup() {
      size(320, 240, P3D);
      noSmooth();
    
      buffer=createGraphics(width/8, height/8, P3D);
      // buffer.noSmooth();
      ((PGraphicsOpenGL) buffer).textureSampling(2);
      buffer.beginDraw();
      buffer.background(0);
      buffer.stroke(255);
      buffer.line(0, 0, buffer.width, buffer.height);
      buffer.endDraw();
    }
    void draw() {
    
      image(buffer, 0, 0, width, height);
    }
    
Sign In or Register to comment.