Skip to main content
gamedev.net
🔒 Locked

Better filters?!

Started by PhiberOptic Jun 1, 2003 at 10:13 AM 4 replies 400+ views
Original Post
PhiberOptic
PhiberOptic
How do I make textures fliterd with something better than GL_LINEAR? (like trilinear)?? Is there a fast way to do this?
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
iNsAn1tY
iNsAn1tY
Well, I believe that tri-linear filtering is mip-mapping. Normal OpenGL textures are defined using glTexImage2D(). You can then set up GL_NEAREST or GL_LINEAR in the minification and magnification filters. Mip-mapping uses the function call gluBuild2DMipmaps(), and provides two new filters: GL_NEAREST_MIPMAP_NEAREST and GL_LINEAR_MIPMAP_LINEAR. This is trilinear filering, and gives your polygons better texturing whether you're close up or far away...



Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You're Already Here | The Best Film Reviews ]


[edited by - iNsAn1tY on June 1, 2003 12:02:49 PM]
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
jitspoe
jitspoe
Also, if you want to do anisotropic filtering:

float gl_anisotropy_value;
qglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, ≷_anisotropy_value);

...

qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
gl_anisotropy_value);

That'll set it to the maximum anisotropic value the card supports.

[edited by - jitspoe on June 2, 2003 3:15:36 AM]
Aldacron
Aldacron
quote:
Original post by iNsAn1tY
Well, I believe that tri-linear filtering is mip-mapping. Normal OpenGL textures are defined using glTexImage2D(). You can then set up GL_NEAREST or GL_LINEAR in the minification and magnification filters. Mip-mapping uses the function call gluBuild2DMipmaps(), and provides two new filters: GL_NEAREST_MIPMAP_NEAREST and GL_LINEAR_MIPMAP_LINEAR. This is trilinear filering, and gives your polygons better texturing whether you''re close up or far away...



There are actually 4 filters available for mipmaps:

GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR

The 2 you are probably most interested in are GL_LINEAR_MIPMAP_NEAREST (bilinear filtering) and GL_LINEAR_MIPMAP_LINEAR (trilinear filtering).
PhiberOptic
PhiberOptic
Thx.. however, for the thing with qglTexParameteri... isn''t that only for the Quake II engine?
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
Aldacron
Aldacron
qglTexParameteri is a function pointer. It points to glTexParameteri. The quake 2 engine loads the OpenGL dll dynamically and assigns the gl functions to pointers prefixed by qgl, so they are effectively the same thing. Just use glTexparameteri in your code.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.