aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llwindowsdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llwindow/llwindowsdl.cpp')
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp45
1 files changed, 33 insertions, 12 deletions
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp
index 73753c3..d9dc040 100644
--- a/linden/indra/llwindow/llwindowsdl.cpp
+++ b/linden/indra/llwindow/llwindowsdl.cpp
@@ -82,7 +82,7 @@ static BOOL was_fullscreen = FALSE;
82 82
83void maybe_lock_display(void) 83void maybe_lock_display(void)
84{ 84{
85 if (gWindowImplementation) { 85 if (gWindowImplementation && gWindowImplementation->Lock_Display) {
86 gWindowImplementation->Lock_Display(); 86 gWindowImplementation->Lock_Display();
87 } 87 }
88} 88}
@@ -90,7 +90,7 @@ void maybe_lock_display(void)
90 90
91void maybe_unlock_display(void) 91void maybe_unlock_display(void)
92{ 92{
93 if (gWindowImplementation) { 93 if (gWindowImplementation && gWindowImplementation->Unlock_Display) {
94 gWindowImplementation->Unlock_Display(); 94 gWindowImplementation->Unlock_Display();
95 } 95 }
96} 96}
@@ -218,7 +218,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
218 S32 height, U32 flags, 218 S32 height, U32 flags,
219 BOOL fullscreen, BOOL clearBg, 219 BOOL fullscreen, BOOL clearBg,
220 BOOL disable_vsync, BOOL use_gl, 220 BOOL disable_vsync, BOOL use_gl,
221 BOOL ignore_pixel_depth) 221 BOOL ignore_pixel_depth, U32 fsaa_samples)
222 : LLWindow(fullscreen, flags), mGamma(1.0f) 222 : LLWindow(fullscreen, flags), mGamma(1.0f)
223{ 223{
224 // Initialize the keyboard 224 // Initialize the keyboard
@@ -237,6 +237,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
237 mReallyCapturedCount = 0; 237 mReallyCapturedCount = 0;
238 mHaveInputFocus = -1; 238 mHaveInputFocus = -1;
239 mIsMinimized = -1; 239 mIsMinimized = -1;
240 mFSAASamples = fsaa_samples;
240 241
241#if LL_X11 242#if LL_X11
242 mSDL_XWindowID = None; 243 mSDL_XWindowID = None;
@@ -261,7 +262,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
261 mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */ 262 mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */
262 if(mWindowTitle == NULL) 263 if(mWindowTitle == NULL)
263 { 264 {
264 llerrs << "Memory allocation failure" << llendl; 265 llwarns << "Memory allocation failure" << llendl;
265 return; 266 return;
266 } 267 }
267 268
@@ -536,6 +537,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
536 537
537 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 538 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
538 539
540 if (mFSAASamples > 0)
541 {
542 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
543 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples);
544 }
545
539 mSDLFlags = sdlflags; 546 mSDLFlags = sdlflags;
540 547
541 if (mFullscreen) 548 if (mFullscreen)
@@ -747,6 +754,9 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
747#if LL_X11 754#if LL_X11
748 init_x11clipboard(); 755 init_x11clipboard();
749#endif // LL_X11 756#endif // LL_X11
757
758 //make sure multisampling is disabled by default
759 glDisable(GL_MULTISAMPLE_ARB);
750 760
751 // We need to do this here, once video is init'd 761 // We need to do this here, once video is init'd
752 if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 762 if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
@@ -759,7 +769,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
759 769
760 770
761// changing fullscreen resolution, or switching between windowed and fullscreen mode. 771// changing fullscreen resolution, or switching between windowed and fullscreen mode.
762BOOL LLWindowSDL::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) 772BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
763{ 773{
764 const BOOL needsRebuild = TRUE; // Just nuke the context and start over. 774 const BOOL needsRebuild = TRUE; // Just nuke the context and start over.
765 BOOL result = true; 775 BOOL result = true;
@@ -797,7 +807,6 @@ void LLWindowSDL::destroyContext()
797 gGLManager.shutdownGL(); 807 gGLManager.shutdownGL();
798 llinfos << "SDL_QuitSS/VID begins" << llendl; 808 llinfos << "SDL_QuitSS/VID begins" << llendl;
799 SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... 809 SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky...
800 //unload_all_glsyms();
801 810
802 mWindow = NULL; 811 mWindow = NULL;
803} 812}
@@ -923,10 +932,10 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size)
923 { 932 {
924 size->mX = mWindow->w; 933 size->mX = mWindow->w;
925 size->mY = mWindow->h; 934 size->mY = mWindow->h;
926 return (TRUE); 935 return (TRUE);
927 } 936 }
928 937
929 llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; 938 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
930 return (FALSE); 939 return (FALSE);
931} 940}
932 941
@@ -936,10 +945,10 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size)
936 { 945 {
937 size->mX = mWindow->w; 946 size->mX = mWindow->w;
938 size->mY = mWindow->h; 947 size->mY = mWindow->h;
939 return (TRUE); 948 return (TRUE);
940 } 949 }
941 950
942 llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; 951 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
943 return (FALSE); 952 return (FALSE);
944} 953}
945 954
@@ -971,6 +980,16 @@ void LLWindowSDL::swapBuffers()
971 SDL_GL_SwapBuffers(); 980 SDL_GL_SwapBuffers();
972} 981}
973 982
983U32 LLWindowSDL::getFSAASamples()
984{
985 return mFSAASamples;
986}
987
988void LLWindowSDL::setFSAASamples(const U32 samples)
989{
990 mFSAASamples = samples;
991}
992
974F32 LLWindowSDL::getGamma() 993F32 LLWindowSDL::getGamma()
975{ 994{
976 return 1/mGamma; 995 return 1/mGamma;
@@ -1117,8 +1136,10 @@ F32 LLWindowSDL::getPixelAspectRatio()
1117 if (getFullscreen()) 1136 if (getFullscreen())
1118 { 1137 {
1119 LLCoordScreen screen_size; 1138 LLCoordScreen screen_size;
1120 getSize(&screen_size); 1139 if (getSize(&screen_size))
1121 pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX; 1140 {
1141 pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX;
1142 }
1122 } 1143 }
1123 1144
1124 return pixel_aspect; 1145 return pixel_aspect;