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 › turning off opengl bilinear filtering
Page Index Toggle Pages: 1
turning off opengl bilinear filtering (Read 700 times)
turning off opengl bilinear filtering
Jan 22nd, 2008, 9:33am
 
Hey guys, I need your help.

Is there any way to turn off opengl's bilinear filtering? I tried the technique described here:

http://gregs-blog.com/2008/01/14/how-to-turn-off-bilinear-filtering-in-opengl/

However this had no effect on processing's image rendering. I don't want my images blurred by filtering when zooming in on (scaling) them. What can I do?
Re: turning off opengl bilinear filtering
Reply #1 - Jan 22nd, 2008, 5:29pm
 
>> processing's image rendering

So I assume you're not doing direct opengl calls?  (still having processing doing all the low-level drawing?)

If so, you'll need to modify PGraphicsOpenGL.  Unfortunately this setting is done by an inner cache class so it isn't easy to just extend PGraphicsOpenGL and reimplement something small - you'd have to redo the entire inner class, so might as well hack the source directly.  Here's the approach:

1. copy PGraphicsOpenGL.java into your sketch folder
2. rename it MyGraphicsOpenGL.java
(reload sketch if necessary to see the new .java tab)
3. remove the package statement, and change all occurences of PGraphicsOpenGL to MyGraphicsOpenGL
4. size() like this:  size(640,480,"MyGraphicsOpenGL");

now that you have your own gl renderer you can hack at it:

5. around lines 1045 you'll find the texture filtering parameters - you'd want to change those to GL.GL_NEAREST.  
(you could also find and disable the mip-map generation, but ok to leave that as is, they just won't be used)
Re: turning off opengl bilinear filtering
Reply #2 - Jan 22nd, 2008, 10:34pm
 
Wonderful. Thanks davbol.
Page Index Toggle Pages: 1