PDA

View Full Version : Filter



Dimae
04-16-2001, 12:16 PM
Can I filter the render result? In DirectX this function called ALPHA-BLENDING. How I can use it in OpenGL?

Sorry for bad English http://www.opengl.org/discussion_boards/ubb/smile.gif

ben
04-16-2001, 04:58 PM
Originally posted by Dimae:
Can I filter the render result? In DirectX this function called ALPHA-BLENDING. How I can use it in OpenGL?

Sorry for bad English http://www.opengl.org/discussion_boards/ubb/smile.gif

ben
04-16-2001, 05:01 PM
Originally posted by ben:



It's basically the same for OpenGL. Look in the Red Book for info on blending. You'll see functions like:
glEnable(GL_BLEND);
glBlendFunc(...); <-- Or something. I forget the exact call. http://www.opengl.org/discussion_boards/ubb/smile.gif


And some other stuff. There's also an alpha test that might be what you're looking for.
It goes something like:
glEnable(GL_ALPHAv_TEST);
glAlphaFunc(...);

Dimae
04-17-2001, 03:10 AM
glEnable(GL_BLEND);
glBlendFunc(...);
glAlphaFunc(...);

What's a parameters? I want to smooth this BIG Pixels!

DaViper
04-17-2001, 03:25 AM
What exactly do you want to do??

Smooth your Polygons, blend 2 Poylgons or just do you want to have transparent areas http://www.opengl.org/discussion_boards/ubb/confused.gif

Dodger
04-17-2001, 05:18 AM
Originally posted by Dimae:
glEnable(GL_BLEND);
glBlendFunc(...);
glAlphaFunc(...);

What's a parameters? I want to smooth this BIG Pixels!


If you mean magnified texture pixels (texels) then this might help:

glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,GL_LINEAR);

after creating your texture object. GL_TEXTURE_MIN/MAG_FILTER set the interpolation for texture minification/magnification. AFAIK default is GL_NEAREST, so there will be no interpolation between two texel values... that's when you get the 'playstation effect'.

Teofuzz
04-17-2001, 09:47 AM
Maybe you mean anti-aliasing?
tFz

Dimae
04-17-2001, 02:05 PM
May be yes. I don't know how named this function in OpenGL. In small screen resulutions without hardware acceleration pixels of my on the screen are very big. I want smooth its.

Teofuzz
04-18-2001, 01:39 AM
If you are drawing polygons, you can do it in this way:



glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POLYGON_SMOOTH);

Make sure that blending is always enabled. My code modifies it while drawing bumpmapped object, and they aren't antialiased. But I think that with some trick...
Another way to antialias is to use the accumulation buffer, but this requires to draw the entire scene more than once.
tFz