Non-fullscreen Anti-Aliasing with OpenGL and SDL

Started by
10 comments, last by Yann L 12 years, 9 months ago
I have been looking at various anti-aliasing options in OpenGL, and none of them seems to provide what i want.
The ARB_multisample extension -AFAIK- is only for /full screen/ anti-aliasing, where as the core opengl polygon antialiasing requires me to
sort my polygons in depth order.
Is there a way to combine the 2 ? i.e. a non fullscreen anti-aliasing technique that *just works* ?

Thanks in advance.

P.S : I use OpenGL w/ SDL
Advertisement
Have you set multisampling attributes before SDL_SetVideoMode()?
WBW, capricorn

Is there a way to combine the 2 ? i.e. a non fullscreen anti-aliasing technique that *just works* ?

Can you be more precise on what you mean by "non fullscreen anti-aliasing" ? Antialiasing only part of a window ? Only one viewport ? Only selected primitives ?

MSAA and the old style line/polygon smoothing are two totally independent techniques, each with their respective limitations. First off, you should probably rethink your approach. Why can't you just antialias everything and be done with it ? That would certainly be the most efficient way.

Now, it is possible to have parts of your scene rendered with antialising and parts without by using multiple FBOs with different multisampling settings. It's rather trivial if they affect distinct parts of the screen. It's harder if MSAA settings are to be mixed within the same render area. Except for a few special cases (eg. having a reflection rendered without AA, but the rest of the scene with AA) this approach is not usually advisable.
I think when he says fullscreen he means not windowed mode? In other words the viewport covers the entire display (I could be wrong). I think multisample antialias should work in fullscreen as well as in windowed mode.. again, I could be wrong...

I have noticed that some nVidia chipsets have had some problems with msaa, it might require some driver tinkering to get working.

I think when he says fullscreen he means not windowed mode?



Yeah, that's a common misunderstanding that "FS" in "FSAA" means "full-screen" (it's "full-scene"). There is no difference whether the window covers entire screen or not.

WBW, capricorn
Oh..k. Sorry for the confusion.
I assumed the FS in FSAA to mean Full-Screen since it didn't work for me in windowed mode. Well, it didn't work in full screen mode either...
Please tell me what i'm doing wrong :

i am using SDL w/ OpenGL on ubuntu10.10
i have an ati-radeon card w/ fglrx installed

After SDL_Init, i do :

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);

and after SDL_SetVideoMode,

glEnable( GL_MULTISAMPLE );

But i don't see any multisampling going on.

What's worse is that if i run the same program on my intel laptop w/ inbuilt graphics card, the program /segfaults/ on the first gl call following SetVideoMode.
If i free the sdl_surface immediately after SetVideoMode and call SetVideoMode again, i don't see any segfault, but i don't see any AA either.

P.S : glGetString( GL_EXTENSIONS ); does print GL_ARB_multisample on both my laptops.

Please tell me what i'm missing.
Thank you.



After SDL_Init, i do :

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);

and after SDL_SetVideoMode,

glEnable( GL_MULTISAMPLE );

But i don't see any multisampling going on.


And what do SDL_GL_GetAttribute() for those attributes say after SDL_SetVideoMode? Or glGetInteger with GL_SAMPLE_BUFFERS_ARB/GL_SAMPES_ARB?
And also, are there any visuals supporting multisampling? Check output of glxinfo. In the table with visuals, look for "ms" column. "ns" there is number of samples, and "b" is number of buffers.


What's worse is that if i run the same program on my intel laptop w/ inbuilt graphics card, the program /segfaults/ on the first gl call following SetVideoMode.
If i free the sdl_surface immediately after SetVideoMode and call SetVideoMode again, i don't see any segfault, but i don't see any AA either.
[/quote]

What do you mean "I free sdl_surface"? You should not ever free the surface returned by SDL_SetVideoMode. If you need another video mode, just call SDL_SetVideoMode again.
WBW, capricorn
Capricorn,
On my intel laptop (no dedicated graphics card), i tried glxinfo. It showed me no visuals with non-zero ms and b. Does this mean i can't have multisampling on this laptop?, or is there something i can try to make it happen. And, yeah, SDL_GetAttribute returned 0, 0 too. Also, are all opengl games i run on this laptop doomed to look jaggy?
I'll try the same on my ati-radeon laptop when i get home.

Thanks!
Short answer is yes, you can't have multisampling. Long answer is: check your video driver documentation for clues on enabling FSAA. nVidia drivers, for example, allow you to set __GL_FSAA_MODE environment variable prior to launching application, thus overriding any AA settings. Even then, if you don't have any ms-capable visuals, it's up to driver. Though I must tell I have little faith in both Intel's and ATI's Linux drivers anyway.
WBW, capricorn
Oh.. that's sad.
Btw, on ati-radeon laptop, i do see ms capable visuals. I tried using the buffer sizes mentioned in the glxinfo listing with multisampling,
but still i see no AA going on.
Also, SDL_GetAttribute returns 4 and 1 for samples and buffers respectively.

What's happening?

Thank you.

P.S : i am still not able to convince myself that there i have no anti-aliasing solution available.
Isn't there some some crude method to fall back to?, a software implementation perhaps? Something...

This topic is closed to new replies.

Advertisement