From 3d5a5b1ecb97746f98a6cb608bb065db44ea0ddb Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 14 Oct 2009 03:50:03 +0000 Subject: [PATCH] implemented multi-sampling for full-screen anti-aliasing (FSAA) git-svn-id: svn://anubis/anaglym/trunk@86 99a6e188-d820-4881-8870-2d33a10e2619 --- Video.cc | 8 +++++++- Video.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Video.cc b/Video.cc index cfd8005..138880d 100644 --- a/Video.cc +++ b/Video.cc @@ -31,7 +31,8 @@ Video::Video() m_inputGrabbed = false; } -void Video::start(int width, int height, bool fullscreen, bool grab_input) +void Video::start(int width, int height, bool fullscreen, bool grab_input, + int samples) { if (m_surface == NULL) { @@ -44,6 +45,11 @@ void Video::start(int width, int height, bool fullscreen, bool grab_input) flags |= SDL_FULLSCREEN; SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if (samples > 1) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, samples); + } m_surface = SDL_SetVideoMode(width, height, 32, flags); if (grab_input) { diff --git a/Video.h b/Video.h index beea11c..501c927 100644 --- a/Video.h +++ b/Video.h @@ -9,7 +9,8 @@ class Video public: Video(); void start(int width = 0, int height = 0, - bool fullscreen = true, bool grab_input = true); + bool fullscreen = true, bool grab_input = true, + int samples = 4); void stop(); int getDefaultWidth() { return m_defaultWidth; } int getDefaultHeight() { return m_defaultHeight; }