Polygon Smooting (2D)

I am a real beginner in OpenGL and I use it for 2D drawing only at this time, on Windows 7. Please excuse me if this post is not posted in the right forum…
In order to draw text, I use wglUseFontOutlines, whcih generates call lists that I can use later to draw text. I want to have the text antialiased so I use ‘glEnable(GL_POLYGON_SMOOTH)’ first, then I use ‘glCallLists(strlen(text), GL_UNSIGNED_BYTE, text)’ to draw text.
On my main computer, it works perfect, but on my laptop, I can’t have the polygon smoothing. Line smoothing works perfect, but not polygon smooting. This laptop runs Windows7/64 with a Nvidia NVS3100M graphic chipset. I ran OpenGL Extensions Viewer 3.55 and it says OpenGL 3.1 is intalled, with 100% of the features supported.
How come my polygons are not smoothed on this computer?

Thanks for any help,
Eric

If you want antialiased Fonts, use the Freetype library from freetype.org or AngelCode’s BMFont Generator which generates a texture for your font.
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=43
Look at this lesson. The code is outdated, but it gives you a clue how to achieve it.
All Nehe lessons are for OpenGL 1.x and we are already at 3.x.
So consider learning 3.x directly.

In Short words:
You use a texture which contains the glyphs and render parts of that texture to the screen as often as you need it. It is much faster than this wgl stuff and portable.

That is also why smoothing does not help with Font. wgl uses internally the same approach I think.

And for versions of OpenGL: It is a matter of using the correct calls. Displaylists are part of GL 1.x not of 3.x. In fact, they won’t work if you accquire a 3.x core context.
Here is a tutorial about OpenGL 3.x : http://www.arcsynthesis.org/gltut/
It is the only one I found about 3.x
HTH

I thank you for your answer, I will look into this carefully.
Unfortunately, my problem is not limited to the font drawing, the problem is the same for any polygon. Even if I can solve the font problem with your help, it will not solve the problem for the other polygons I use in my application.

My surprise is really that it works fine on a 1 computer on not on the other… This is why I thought there might be a possible OpenGL configuration or something.

I understand what you say about GL 1.x and 3.x, but I thought there was a full upward comaptibility. My application is designed to be used by many users, so I don’t mind using 1.x because it will ensure my code will work on every computer. But if you tell me 1.x code will not work if 3.x is installed, it is a different story :slight_smile:

Thank you,
Eric

Rocky92,

Many newer graphics cards do not support polygon anti-aliasing (many older ones do). This is matter of the graphics hardware – it doesn’t matter what version of OpenGL you have.

Technically speaking, the older OpenGL specs require the system to accept glEnable(GL_POLYGON_SMOOTH), but they don’t have to change the way they draw the polygon. So both cards are compliant with the spec.

Probably you had an older graphics card in one computer, and a newer graphics card in the other. It seems odd, but the newer card is “worse” than the older one – at least in this specific area.

Multi-sample anti-aliasing (MSAA) is commonly used to provide anti-aliasing on newer (doesn’t need to be very new) cards. The polygon edge AA is often lower quality than GL_POLYGON_SMOOTH approach was, but it works with the depth buffer, and doesn’t require any special blending mode, so it is more general. Once you get up to 8xMSAA, it’s hard to tell the difference between a card with GL_POLYGON_SMOOTH and one using MSAA instead, even when rendering small polygonal text.

If you just want quality font edges, consider generating the characters with textures instead, with the anti-aliasing built into the texture using the alpha channel. I’m pretty sure Windows can produce the textures for you from the native fonts. This won’t help with other polygons though – if you want those cleaned up, you’ll need to look into MSAA.