Anti-aliasing

  ... discussions about development with the GLES1 branch of AndEngine.

Anti-aliasing

Postby vael » Mon Oct 04, 2010 1:45 pm

Hello everyone!
I've noticed there is no smoothing enabled by default
Could anyone please tell me if it is possible to enable it?

Thanks
vael
 
Posts: 12
Joined: Fri Sep 10, 2010 6:43 am

Re: Anti-aliasing

Postby Nicolas Gramlich » Tue Oct 05, 2010 11:39 pm

Android doesn't have a GL_POLYGON_SMOOTH option, only GL_LINE_SMOOTH und GL_POINT_SMOOTH are available.

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Anti-aliasing

Postby vael » Wed Oct 06, 2010 12:46 pm

Hello Nicolas

So you mean that lines would be drawn smooth but whenever I draw a box it will always be not smooth?

Regards
vael
 
Posts: 12
Joined: Fri Sep 10, 2010 6:43 am

Re: Anti-aliasing

Postby Nicolas Gramlich » Thu Oct 07, 2010 10:53 am

Yes, but as you'll probably use Sprites (that have a Texture on them) this should not be an issue.

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Anti-aliasing

Postby vael » Sun Oct 10, 2010 11:49 am

Yeah, it is not an issue as long as I don't rotate a sprite. That's why I've opened this topic :)
vael
 
Posts: 12
Joined: Fri Sep 10, 2010 6:43 am

Re: Anti-aliasing

Postby ichi » Sun Oct 24, 2010 12:21 pm

Nicolas Gramlich wrote:Android doesn't have a GL_POLYGON_SMOOTH option, only GL_LINE_SMOOTH und GL_POINT_SMOOTH are available.

Best Regards,
Nicolas

My lines doesn't look very smooth at all, where can I set the GL_LINE_SMOOTH option?

Edit:
I tried changing the option on onInitDraw, and it did smooth... but the width I've set does not work anymore (always 1px width):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Line line = new Line(0,0,0,0) {
  2.   protected void onInitDraw(final GL10 pGL) {
  3.      super.onInitDraw(pGL);
  4.      GLHelper.disableTextures(pGL);
  5.      GLHelper.disableTexCoordArray(pGL);
  6.      pGL.glEnable(GL10.GL_LINE_SMOOTH);
  7.      pGL.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
  8.      GLHelper.lineWidth(pGL, this.getLineWidth());
  9.      }
  10. };
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


How can I make this smooth and still set a line width over 1px?
Attachments
smooth_lines.png
Edited onInitDraw
smooth_lines.png (8.09 KiB) Viewed 2864 times
normal_lines.png
Normal rendering
normal_lines.png (4.13 KiB) Viewed 2864 times
ichi
 
Posts: 62
Joined: Mon Sep 06, 2010 1:47 pm

Re: Anti-aliasing

Postby Nicolas Gramlich » Sat Nov 06, 2010 2:11 am

Taken from the OpenGL Spec:
http://www.opengl.org/sdk/docs/man/xhtm ... eWidth.xml


...

Not all widths can be supported when line antialiasing is enabled. If an
unsupported width is requested, the nearest supported width is used.
Only width 1 is guaranteed to be supported; others depend on the
implementation.
Likewise, there is a range for aliased line widths as well.
To query the range of supported widths and the size
difference between supported widths within the range, call glGet
with arguments GL_ALIASED_LINE_WIDTH_RANGE,
GL_SMOOTH_LINE_WIDTH_RANGE, and GL_SMOOTH_LINE_WIDTH_GRANULARITY.

....


Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany


Return to GLES1

Who is online

Users browsing this forum: No registered users and 18 guests