We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › image texture rendering problems
Page Index Toggle Pages: 1
image texture rendering problems (Read 1016 times)
image texture rendering problems
Feb 22nd, 2006, 4:48am
 
To create the warped image I segmented the image into polygons and then reapplyed them as texture maps to the polygonsand rendered the image using the OpenGL graphics renderer. The problem is there are thin lines between the polygons although, when I use the P3D graphics renderer the lines disappear but the image is not comparable in smoothness.

http://newmedia.rit.edu/allclasses/ve_2005/students/bryanIjeoma/AVLS_DEMO/4.tiff
Re: image texture rendering problems
Reply #1 - Feb 22nd, 2006, 11:22am
 
If you've got smooth turned on in OpenGL mode, that'd explain the edges. The processing smooth() command only uses some "easy" GL smoothing coommands, which are quick, but don't necessarily make the result look it's best.

If you want, you could try setting the smoothing options manually. smooth() just does:

Code:
    gl.glEnable(GL.GL_POINT_SMOOTH);
gl.glEnable(GL.GL_LINE_SMOOTH);
gl.glEnable(GL.GL_POLYGON_SMOOTH);


To do these by hand you'll need to add:

Code:

.. other imports here ..
import net.java.games.jogl.*;

GL gl;

void setup()
{
.. normal setup stuff ..
gl=((PGraphicsGL)g).gl;
gl.glEnable(GL.GL_POINT_SMOOTH); //try all combinations...
// gl.glEnable(GL.GL_LINE_SMOOTH);
gl.glEnable(GL.GL_POLYGON_SMOOTH);
}
Re: image texture rendering problems
Reply #2 - Feb 22nd, 2006, 4:22pm
 
Thanks JohnG, but I tried all the different OpenGL settings and the lines did not disappear. The lines are not intentional; noStroke() is specified before the beginShape() call. What other issues would possibly cause this bug if it at all it is a bug and not my code? The lines do not appear when I render the image with P3D. Is there a smoothing algorithm I can apply to achieve the smoothness I get when I use OpenGL?

P3D
http://newmedia.rit.edu/allclasses/ve_2005/students/bryanIjeoma/AVLS_DEMO/7.tiff

OPENGL (noSmooth() enabled)
http://newmedia.rit.edu/allclasses/ve_2005/students/bryanIjeoma/AVLS_DEMO/6.tiff

Re: image texture rendering problems
Reply #3 - Feb 22nd, 2006, 6:12pm
 
It's worth checking the antialiasing settings on your graphics card are set to off, or application dependent.

I fixed this problem by doing noSmooth() before drawing textured polys, and then turning smooth() back on afterwards if I needed it.

My own pet theory for this problem is that it has something to do with using floats for coordinates internally (rather than doubles) but it's just a hunch and I haven't tested it.

Re: image texture rendering problems
Reply #4 - Feb 22nd, 2006, 6:56pm
 
I also have an own pet theory for this and it's that since Processing passes only triangles to OpenGL, if smoothing is set to ON, then OpenGL will smooth all the edges of the triangles, creating these artifacts.

I guess that if PGraphicsGL, passed more high level shapes to OpenGL, then it would probably deal better for when to do antialiasing and when not.

Well, I really don't know much about the internal machinery of all this, it's just a guess.  I have the same problem and still wasn't able to solve it.

Anyway if it helps, try running that applet under GNU/Linux, it seems to do much better rendering, at least for me.  Maybe the OpenGL drivers on GNU/Linux work better for these cases.
Re: image texture rendering problems
Reply #5 - Feb 22nd, 2006, 7:10pm
 
I may be misunderstanding something but wether or not I have smooth() or noSmooth() enable the lines still appear so I dont think the issue is with the smoothing. Im not sure though. So excepting this issue w/ OpenGL how can I fix the smoothness in the P3D rendering?
Page Index Toggle Pages: 1