PDA

View Full Version : Some philosophical questions



Morglum
07-30-2001, 05:26 AM
Hello, here are 3 problems I just can't solve :

1. When using glut, how do you specify that you want a 32-bit depth-buffer ? (I automatically get a 24-bit buffer)

2. If the alpha channel is ignored, if GLUT_RGBA = GLUT_RGB, what use is it to specify the 4th component of colors ? Is it always ignored ?

3. I just can't get polygon antialiasing. I've tried glEnable (GL_POLYGON&LINE&POINT_SMOOTH);
I've tried enabling blending. But it does not work !

If you have some idea about any of these 3 problems... please help !

DFrey
07-30-2001, 05:42 AM
1. Most modern consumer hardware supports 24 bit z and no greater. They use the other 8 bits for hardware stencil support.

2. I'm not exactly certain if I follow this question, but it sounds like you are asking how a non existant alpha buffer impacts the fragment alpha component. The alpha buffer is only useful for destination alpha blending effects. It plays no role in alpha testing or in source alpha effects. That's why the 4th color component is still useful even without an alpha buffer.

3. Can't answer as I've never messed with AA polygons. However, I know lots of other people have posted to the board on this topic so a search may do you some good.

Eric
07-30-2001, 06:15 AM
As DFrey has already answered 1), I just have the last two to play with http://www.opengl.org/discussion_boards/ubb/wink.gif:

2) If you are in RGB mode, there is no use in specifying a 4th component (alpha) with glColor... However, you can use the alpha channel of a texture to do some blending or multitexture effects (even if you color buffer does not have an alpha channel !).

3) If you want to enable polygon antialiasing:




glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);


Note that the hint you give in glHint can be ignored: some vendors will simply ignore this and won't antialias your polygons...

What hardware are you using ?

Regards.

Eric

Morglum
07-30-2001, 11:01 AM
Wow I've just become a "frequent contributor" http://www.opengl.org/discussion_boards/ubb/smile.gif !

OK thank you VERY MUCH, DFrey and Eric ! You solved my 3 problems. And for question 3, it was indeed the glHint who missed. Now it works, but it has created another problem : I have a white sky, and polygon antialiasing now produces a white grid on my teapots (exactly as if I had redrawn them in GL_WIRE mode). I guess that the antialiasing algorithm blends the polygon's color with the background color... However such a grid is not convenient. How could I suppress it ?

[This message has been edited by Morglum (edited 07-30-2001).]

Qwylli
07-30-2001, 03:14 PM
Your need to play with the blending function, GL_SRC_ALPHA_MINUS_DST_COLOR i think.

zed
07-30-2001, 03:37 PM
src_alpha one_minus_src_alpha
but personally on my card ive found polygon/line smooth to not give very good results. the only decent looking one is point_smooth

Morglum
07-31-2001, 03:13 AM
thanks, I'm just trying every possible combination of parameters for glBlendFunc. On my card, polygon antialiasing looks very good, but it is very slow.