cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

andrer
Journeyman III

How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Hello,

I'm creating an interactive 3D-Molecule-kit for chemistry teaching and I experienced some problems with ati-cards.

When I try to draw smooth lines this way:

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

...

gluLookAt(mycam.pos[0], mycam.pos[1], mycam.pos[2], mycam.focus[0], mycam.focus[1], mycam.focus[2], 0,1,0);  //3D-projection

...

glShadeModel(GL_SMOOTH);

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_LINE_SMOOTH);

I get usual (non-antialiased) lines with ati cards. When I execute my code on nvidia cards then it works perfectly.

The same behavior appears, when I try to use the accumulation buffer to do full-scene antialiasing or motion blur.

With nvidia cards -> it works

With ati cards -> no effect

Is there any way to enable antialiasing (FSAA) in OpenGL by using GLUT and ATI-Cards?

Or is there a command to force ati-cards to FSAA? May be like the option of Antialiasing in ATI Tray Tools?

Thanks for any help

André

Tags (1)
0 Likes
1 Solution

Accepted Solutions
andrer
Journeyman III

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Dear Mr Sellers

I solved this problem by including the "glext.h" (http://www.opengl.org/registry/api/glext.h) into my project and adding the identifier GLUT_MULTISAMPLE to the glutInitDisplayMode()-routine:

#include <gl/glext.h>

#include <gl/freeglut.h>

...

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA  | GLUT_MULTISAMPLE |  GLUT_DEPTH);

You also have to exchange the old glut-files with the freeglut-files (http://freeglut.sourceforge.net/).

In addition you can control the FSAA by "glEnable(GL_MULTISAMPLE);" or "glDisable(GL_MULTISAMPLE);".

In the end you shouldn't use glEnable(GL_LINE_SMOOTH); to smooth lines, because it is the old way to do this and there is no guarantee, that every system support it. Today you just draw the scene and tell the graphic card to antialias the full scene by hardware (or not).

I'd like to thank Mr Sellers for his advice and time.

When anybody needs an example of my solution, then I will upload one.

Cheers,

André R.

View solution in original post

0 Likes
8 Replies
gsellers
Staff
Staff

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Hi,

At first glance, it looks like the code you posted should work. Note that what you're attempting here is not actually FSAA but alpha-based antialiasing (which is why you need to enable blending). Honestly, I'm no GLUT expert and couldn't say much about FSAA with GLUT. I'd recommend using GLFW rather than GLUT (http://www.glfw.org/) unless you need GLUT's user interface components. It includes support for MSAA and core OpenGL contexts.

Is there some way you could provide access to either your application, or to a sample that reproduces the issue you're seeing? We'd like to take a look and see what, if anything, is going wrong.

Cheers,

Graham

andrer
Journeyman III

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Dear Mr Sellers

I solved this problem by including the "glext.h" (http://www.opengl.org/registry/api/glext.h) into my project and adding the identifier GLUT_MULTISAMPLE to the glutInitDisplayMode()-routine:

#include <gl/glext.h>

#include <gl/freeglut.h>

...

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA  | GLUT_MULTISAMPLE |  GLUT_DEPTH);

You also have to exchange the old glut-files with the freeglut-files (http://freeglut.sourceforge.net/).

In addition you can control the FSAA by "glEnable(GL_MULTISAMPLE);" or "glDisable(GL_MULTISAMPLE);".

In the end you shouldn't use glEnable(GL_LINE_SMOOTH); to smooth lines, because it is the old way to do this and there is no guarantee, that every system support it. Today you just draw the scene and tell the graphic card to antialias the full scene by hardware (or not).

I'd like to thank Mr Sellers for his advice and time.

When anybody needs an example of my solution, then I will upload one.

Cheers,

André R.

View solution in original post

0 Likes
kbrafford
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

>When anybody needs an example of my solution, then I will upload one.

I would love to see the solution you ended up finding.

--Keith Brafford

0 Likes
Skysnake
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Thx for the question!

I have added it also to my project now. Also with the glext.h from the AMD SDK. I think this is very usefull for windows systems.

The performance penalty is quite ok.

I will use it in the future always. I also have learned in the university the old way with GL_LINE_SMOOTH last semester.

It would be GREAT if AMD could bring here a collection of such performance improvements for the OpenCL useres, that want to use OpenGL for visualization of there results. I think most of the people waste lots of performance in OpenGL, because they don´t know lots functions that makes the live easier.

0 Likes
kbrafford
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Skysnake,

    Where did you upload your example project?

--Keith Brafford

0 Likes
Skysnake
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

no where. it is on progress. So lots of things to do.

Perhaps i will upload somewhere, when it is finished. The problem is, i get money for it, so perhaps a upload will be not allowed.

0 Likes
kbrafford
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Oh certainly don't upload proprietary code.  But you could pare down the salient part of the routine into a small demo of how you accomplished the acceptable anti-aliasing, right?

0 Likes
Skysnake
Adept II

Re: How to draw smooth lines with ATI-Cards in OpenGL by using GLUT

Jump to solution

Its just the solution, that andrer have posted.

The OpenCL/OpenGL part is not something of some lines of codes. I need more than 200 lines of code for a more or less flexible interop. And that without the use of the OpenCL/OpenGL interop functionality. This would make it a littlebit more complex. So sorry, there is no short and easy thing to post.

0 Likes