hi
how can i use multisampling in the SDL?
i’m trying to use SDL_GL_SetAttribute but i can do it please help me with an example source code( for SDL)
hi
how can i use multisampling in the SDL?
i’m trying to use SDL_GL_SetAttribute but i can do it please help me with an example source code( for SDL)
What’s the problem if you can do it?
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Unable to initialize SDL: %s
", SDL_GetError());
exit(1);
}
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
if ( SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL ) {
fprintf(stderr, "Unable to create OpenGL screen: %s
", SDL_GetError());
SDL_Quit();
exit(2);
}
N.
Don’t forget to use glEnable(GL_MULTISAMPLE)
can i change video mode at runtime or enable/disable multisampling at runtime
With certain drivers, even when you call glDisable(GL_MULTISAMPLE) it doesn’t disabled it. Actually, I haven’t tried this in a long time.
Indeed, on my GF 7600 GO disabling multisampling only works when using 4 samples or less. I ‘solved’ this issue by using framebuffer objects. I write to either a multisampled or singlesampled window and use framebuffer blitting to transfer the result to the singlesampled main window.
N.