The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL2 - Antialiasing / Multisampling / supersampling
Magnet


Joined: 14 May 2014
Posts: 20
Is there SDL2 support for sampling?

I've see some stuff for OpenGL, but if your just using the SDL2 API how would I go about incorporating AA, and sampling?
D216


Joined: 02 Jun 2014
Posts: 7
If you need OpenGL multisampling through SDL it goes like this:
Code:
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);

Do it before creating a window.
Magnet


Joined: 14 May 2014
Posts: 20
D216 wrote:
If you need OpenGL multisampling through SDL it goes like this:
Code:
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);

Do it before creating a window.


I've tried before and after the window creation, but it doesn't appear to be doing anything.

I also believe depending on the number of samples, it would also slow down the display or scrolling a tad but both the speed and screen remain unchanged.
mr_tawan


Joined: 13 Jan 2014
Posts: 161
Out of curiosity, are you working 3D openGL app ? or just plain 2D SDL ?
Magnet


Joined: 14 May 2014
Posts: 20
I'm suppose I'm doing 2D. I place bitmaps on a 2d surface, convert it to a texture and push It out the screen. I'm writing a Terminal Client/Emulator in SDL2 using bitmap fonts. The fonts are 8x16 in fixed width size, so for 80x25 screen size then translates to a 640x400 surface. The problem is when you do fullscreen desktop for example, and this window size upgrades to desktop resolution eg.. 1900x1080p (what your desktop rez is at). The fonts are no longer 1 to 1 in scaling. Certain extended ASCII characters like shaded blocks that have specific pixel patterns are now all goofy and resized incorrectly. Now this can be corrected with linear texture filtering. However this also dims the colors and leaves a bit of bluring. Not the most appealing, but it keeps the pixels looking correct and even smooths the fonts. I want the scaling and smoothing without the blur.

What I'm looking for I suppose is a way to do sampling that will resize and smooth like linear filtering does but without the bluring. However, the more I look into it, it seems as though i'll have to manually incorporate some algo's to calculate this this manually. I was hoping there was multi-sampling that would do the work for me.
Magnet


Joined: 14 May 2014
Posts: 20
Welp I've looked into to it some more. And even included GL libs etc.. Does multi-sampling only work on GL Textures and contexts. I use SDL textures etc.
I'm wondering if that's the issue.