Skip to content

AntiAlias not working in OpenGL #8

Open
jeffg2k opened this Issue Dec 4, 2009 · 10 comments

2 participants

@jeffg2k
jeffg2k commented Dec 4, 2009

The AntiAlias does not work correctly in OpenGL (both FullScreen & SoftFullScreen)
smooth() and gl.glEnable(gl.GL_LINE_SMOOTH); have no effect.

import fullscreen.*;
import processing.opengl.*;
import javax.media.opengl.GL;
PGraphicsOpenGL pgl;
GL gl;
FullScreen fs;

void setup(){
  size(300, 300, OPENGL);
  fs = new FullScreen(this);
  hint(DISABLE_OPENGL_2X_SMOOTH);
  hint(ENABLE_OPENGL_2X_SMOOTH);
  fs.enter(); 
  pgl         = (PGraphicsOpenGL) g;
  gl          = pgl.gl;
  gl.glEnable(gl.GL_LINE_SMOOTH);
}

void draw(){
  background(0);
  ellipse(150,150,150,150);
}
@kritzikratzi
Owner

seems to be a problem with the opengl context (AGAIN!!!)
i get the best results by just using: @hint(ENABLE_OPENGL_4X_SMOOTH);@

I've been digging into it for a while, but couldn't really locate the source of the problem.
Let's hope this (along with all the other opengl issues) will go away automatically in the next version...

@jeffg2k
jeffg2k commented Feb 5, 2010

Just wondering if this has made any progress... This is the only drawback I'm having with the library and I'd be ecstatic to see it resolved.

@jeffg2k
jeffg2k commented Feb 5, 2010

I did try 4x smooth and it did look better than the 2x I was using. However, I'm a bit concerned about the possible performance impact on lower end machines with using 4x, since it applies to the entire scene. With "gl.glEnable(gl.GL_LINE_SMOOTH);" I can selectively enable it for certain portions of the scene. At least that's my thought process... I could be wrong.

@kritzikratzi
Owner

nope, unfortunately no progress yet. the problem is that i haven't even found out why gl.glEnable(gl.GL_LINE_SMOOTH); doesn't work after switching to fullscreen.
this might be solvable using a custom glEventListener.

on a sidenote: maybe i explained this already, but when i talk about "this might go away in the next version": i'm playing around with a completely different approach where i never recreate the original sketch context. i only hide the original sketch window, let it draw to the background and copy the results to a new window. this way all the texture-problems, as well as this issue, go away. i'm only worried about performance (esp. with non-gl renderers), haven't done much testing yet...

@jeffg2k
jeffg2k commented Feb 5, 2010

Thanks for the clarification.. when you said next version, I thought you were referring to Processing (1.10 or something).

@jeffg2k
jeffg2k commented Mar 11, 2010

Should be fixed with this commit for version 0.98.4 (at least partially - I can get it to work if we order it correctly in the sketch).

http://github.com/jeffg2k/fullscreen-p5/commit/3f020076f0661da56aeb188b56cf16ff84269434

@jeffg2k
jeffg2k commented Mar 11, 2010

My recent "fix" caused an error and ended up breaking my minimization. However, I found out that if you call the disable hint in between the creating the frame and entering fullscreen, all works well.

fs = new SoftFullScreen(this);
hint(DISABLE_OPENGL_2X_SMOOTH);
fs.enter();

Perhaps this could still be worked into the code somehow.. but at least we have a workaround.

@kritzikratzi
Owner

interesting. using this, does gl.GL_LINE_SMOOTH work?

@jeffg2k
jeffg2k commented Mar 28, 2010

Yes.. that's what I use.. but you have to put it in the draw. Taking from the original post. This works:

import fullscreen.*;
import processing.opengl.*;
import javax.media.opengl.GL;
PGraphicsOpenGL pgl;
GL gl;
FullScreen fs;

void setup(){
  size(300, 300, OPENGL);
  fs = new FullScreen(this);
  hint(DISABLE_OPENGL_2X_SMOOTH);
  fs.enter(); 
  pgl         = (PGraphicsOpenGL) g;
  gl          = pgl.gl;
}

void draw(){
  background(0);
  gl.glEnable(gl.GL_LINE_SMOOTH);
  ellipse(150,150,150,150);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.