Add retina/hi-dpi support to OpenGL #2573

Closed
benfry opened this Issue Jun 8, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@benfry
Member

benfry commented Jun 8, 2014

Looks like it's on its way or may have arrived with JOGL 2.2:
https://jogamp.org/bugzilla/show_bug.cgi?id=741

I didn't think we had an open issue for this, so this is just to track any updates.

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Aug 3, 2014

Member

started making some initial progress (2ab6b31):

{ PJOGL.RETINA = true; } // for now

public void setup() {
//  size(640, 480, "processing.core.PGraphicsRetina2D");
//  size(640, 480, JAVA2D);
  size(640, 480, P2D);
//  smooth(4);
  textFont(createFont("Courier", 24));

  noStroke();
  fill(0);
}

public void draw() {
  background(180);

  for (int x = 0; x < width + 50; x += 50) {
    for (int y = 0; y < height - 50; y += 50) {
      ellipse(x, y, 40, 40);
    }    
  }

  text("Text doesn't look particularly crisp, though", 0, height - 20);
} 

All operations that are pixel-based (i.e.: text rendering) need special handling to look good without requiring any user intervention, the high-res guidelines from Apple will probably help.

Member

codeanticode commented Aug 3, 2014

started making some initial progress (2ab6b31):

{ PJOGL.RETINA = true; } // for now

public void setup() {
//  size(640, 480, "processing.core.PGraphicsRetina2D");
//  size(640, 480, JAVA2D);
  size(640, 480, P2D);
//  smooth(4);
  textFont(createFont("Courier", 24));

  noStroke();
  fill(0);
}

public void draw() {
  background(180);

  for (int x = 0; x < width + 50; x += 50) {
    for (int y = 0; y < height - 50; y += 50) {
      ellipse(x, y, 40, 40);
    }    
  }

  text("Text doesn't look particularly crisp, though", 0, height - 20);
} 

All operations that are pixel-based (i.e.: text rendering) need special handling to look good without requiring any user intervention, the high-res guidelines from Apple will probably help.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 4, 2014

Member

Great news!

Member

benfry commented Aug 4, 2014

Great news!

@neilpanchal

This comment has been minimized.

Show comment
Hide comment
@neilpanchal

neilpanchal Apr 28, 2015

@codeanticode Thanks. I tried this and found a problem.

{ PJOGL.RETINA = true; }

void setup() {
    size(1200, 1200, P2D);
    background(255);
    ... do stuff;
}

void draw() {
    strokeWeight(1);
    stroke(0, 50);
    ... do stuff;
}

When using P2D as an argument to size(), I get the following result when plotting Lissajous curves on a retina display with strokeWeight(1) and stroke(0, 50).

UGLY

When using P3D or OPENGL as an argument, the result is smooth as shown below:

SMOOTH

P3D and OPENGL render fine but P2D render has those ugly blobs/artifacts. Also, the saveFrame("####.png") doesn't save the image in full retina resolution despite of declaring hint(ENABLE_RETINA_PIXELS); in the setup() method.

Hope this helps,
Neil

@codeanticode Thanks. I tried this and found a problem.

{ PJOGL.RETINA = true; }

void setup() {
    size(1200, 1200, P2D);
    background(255);
    ... do stuff;
}

void draw() {
    strokeWeight(1);
    stroke(0, 50);
    ... do stuff;
}

When using P2D as an argument to size(), I get the following result when plotting Lissajous curves on a retina display with strokeWeight(1) and stroke(0, 50).

UGLY

When using P3D or OPENGL as an argument, the result is smooth as shown below:

SMOOTH

P3D and OPENGL render fine but P2D render has those ugly blobs/artifacts. Also, the saveFrame("####.png") doesn't save the image in full retina resolution despite of declaring hint(ENABLE_RETINA_PIXELS); in the setup() method.

Hope this helps,
Neil

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jun 9, 2015

Member

@codeanticode Is this officially set?

Member

benfry commented Jun 9, 2015

@codeanticode Is this officially set?

@codeanticode

This comment has been minimized.

Show comment
Hide comment
Member

codeanticode commented Jun 9, 2015

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment