Bilinear Trilinear Filtering???

Member
Posts: 110
Joined: 2002.04
Post: #1
Bilinear Trilinear Filtering???

Ok HOW do I turn this on?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Mars_999
Unregistered
 
Post: #2
You are going to need to get a glext.h file and use this parameter in the your code
Code:
glTexParameteri(GL_TEXTURE_2D, MAX_TEXTURE_MAX_ANISOTROPY_EXT, GL_LINEAR);
//you may need to use GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT instead?

HTH
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
That's if you want anisotropic filtering... and you need to check if your hardware supports the extension before you use it. Rage128s don't AFAIK.

glTexParameteri(GL_TEXTURE_2D, GL_MIN_FILTER, xxx);

where xxx is GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR or GL_LINEAR_MIPMAP_LINEAR.

LINEAR is bilinear, LINEAR_MIPMAP_LINEAR is trilinear, others are in between in terms of quality.

If you choose one of the MIPMAP routes, make sure you generate mipmaps either with the GL_SGIS_generate_mipmap extension, or with gluBuild2DMipmaps.

This is a per-texture-object setting.
Quote this message in a reply
Mars_999
Unregistered
 
Post: #4
Quote:Originally posted by OneSadCookie
That's if you want anisotropic filtering... and you need to check if your hardware supports the extension before you use it. Rage128s don't AFAIK.


Oops he is right that is for anisotropic filtering, which is the best filtering of the three. I think all Nvidia cards support anisotropic filtering. Radeons also have support if I remember right?
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #5
Quote:Originally posted by OneSadCookie
That's if you want anisotropic filtering... and you need to check if your hardware supports the extension before you use it. Rage128s don't AFAIK.

For BANG! support needs to go back to Rage Pro.
I want the biggest consumer base... extra high end features can come later.

Ok now WHAT is anisotropic filtering?

Quote:glTexParameteri(GL_TEXTURE_2D, GL_MIN_FILTER, xxx);

where xxx is GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR or GL_LINEAR_MIPMAP_LINEAR.

LINEAR is bilinear, LINEAR_MIPMAP_LINEAR is trilinear, others are in between in terms of quality.

If you choose one of the MIPMAP routes, make sure you generate mipmaps either with the GL_SGIS_generate_mipmap extension, or with gluBuild2DMipmaps.

This is a per-texture-object setting.

Ok Cool got it...
My code was using GL_NEAREST

In fact here is what it look like right now.... tell me if there is anything really bad about it.

unsigned long texture = (unsigned long) in_triangle->texturemap->get_texture( 0 );

if( texture != last_texure ){
glEnable( GL_TEXTURE_2D );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glBindTexture( GL_TEXTURE_2D, texture );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
last_texure = texture;
}

glBegin(GL_POLYGON);
for ( long x = 0; x < in_triangle->vertex_count; x++ ){

// COLOR //
glColor3d( in_triangle->clipped_vertexes [ x ].r,
in_triangle->clipped_vertexes [ x ].g,
in_triangle->clipped_vertexes [ x ].b
);

// TEXTURE COORDINATES //
glTexCoord2f( in_triangle->clipped_vertexes [ x ].u, in_triangle->clipped_vertexes [ x ].v );

// LOCATION //
glVertex3d( in_triangle->clipped_vertexes[ x ].point.x,
in_triangle->clipped_vertexes[ x ].point.y,
( in_triangle->clipped_vertexes[ x ].point.z / 1000 )
);
}
glEnd();

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
The texture environment (glTexEnvi) is not a per-texture setting, and it only applies when you're actually drawing with the texture. I can't really tell from your code whether you're using it correctly.

Anisotropic filtering is yet another way of improving the look of textures when they're far in the distance. If you make a chessboard texture and use it to texture a very large plane for the ground, for example, you'll get nasty artifacts in the distance. Mipmapping will help these artifacts, but anisotropic filtering improves them even more.

Apple has a nice demo on their site, if your card supports it.
Quote this message in a reply
Post Reply