Antialiasing/Blending problem ?

Hi,

I just bought a new graphic card (Radeon HD4670) and with this car my OpenGL Game got a little problem that I didn’t have with my old Radeon 7600.

All the antialiasing seems to be gone. The fonts and polygons are horrible :s.

I can’t figure out where the problem comes from.
From the following screenshot I would say that there is a blending problem.
As you can see, the lightmaps (there is a second polygone drawn on the wall for the lightmap, no multitexturing for that, just blending) are just horrible.
The textures are not merged smoothly as they were on my old graphic card.

The result can be seen on this screenshot:

Does anyone has an idea of what’s wrong?

Thanks a lot,

Cabre ludovic

Is it possible for you to access your graphics card control panel and set "Anti-aliasing’ to “Force On” and set its value to something like “4x”.

Usually that does the trick. :slight_smile:

Well it worked perfectly… but only on the fonts.
The polygons are still horrible.

Any idea for the lightmap problem ?

How can I programatically activate antialiasing on the graphic card ? (I suppose there is a GLEXT for that ?)

Here is the code which draws the polygons:


float global_ambient_on[] = { 1.0f, 1.0f, 1.0f, 1.0f };
glEnable(GL_POLYGON_SMOOTH);
glDisable(GL_LIGHTING);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient_on);
glColor4fv(global_ambient_on);

    DRAW_HOUSE();

glBlendFunc(GL_ZERO, GL_SRC_COLOR);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glDepthFunc(GL_EQUAL);
 
    DRAW_LIGHTMAPS();

glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);

glEnable(GL_LIGHTING);

Thanks,
Cabre Ludovic

i think the problem with your lightmap is caused by z-fighting,

especially when your DRAW_HOUSE() and DRAW_LIGHTMAPS() are dealing different but approached meshes.

maybe ‘glPolygonOffset’ will work( i didn’t have a try ),
but at least i think you should set ‘glDepthFunc’ with ‘GL_LEQUAL’ rather than ‘GL_EQUAL’ when you draw lightmaps.

ephtracy is right, it is typically a z-fighting problem. But your blending and depth setup look also wrong…
Why using GL_EQUAL as depth function? It approximatively never happens.

Anyway, the way you are doing it is very uneffcient, you are rendering twice the scene geometry just for blending two textures, you better use multitexturing or shaders.

Thanks a lot guys =).

It now works great like before.

Here is the new source code modified for whoever may be interested:

glDisable(GL_LIGHTING);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, { 1.0f, 1.0f, 1.0f, 1.0f });
glColor4fv({ 1.0f, 1.0f, 1.0f, 1.0f });

DRAW_HOUSE();

glBlendFunc(GL_ZERO, GL_SRC_COLOR);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glDepthFunc(GL_LEQUAL);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-2.0f, -2.0f);

DRAW_LIGHTMAPS();

glDisable(GL_POLYGON_OFFSET_FILL);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);

glEnable(GL_LIGHTING);