summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llmousehandler.h2
-rw-r--r--indra/llwindow/llwindowmacosx.cpp1
-rw-r--r--indra/llwindow/llwindowsdl.cpp14
-rw-r--r--indra/llwindow/llwindowwin32.cpp54
4 files changed, 61 insertions, 10 deletions
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index bbbc3d4406..d825a3424c 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -65,7 +65,7 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0;
- virtual std::string getName() const = 0;
+ virtual const std::string& getName() const = 0;
virtual void onMouseCaptureLost() = 0;
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 8057506736..d116f0dfff 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1266,7 +1266,6 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
void LLWindowMacOSX::swapBuffers()
{
- glFinish();
aglSwapBuffers(mContext);
}
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index e41aa9820f..8acb52516a 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -63,6 +63,9 @@ extern BOOL gDebugWindowProc;
const S32 MAX_NUM_RESOLUTIONS = 200;
+const S32 MIN_WINDOW_WIDTH = 1024;
+const S32 MIN_WINDOW_HEIGHT = 768;
+
// static variable for ATI mouse cursor crash work-around:
static bool ATIbug = false;
@@ -985,7 +988,6 @@ void LLWindowSDL::swapBuffers()
{
if (mWindow)
{
- glFinish();
SDL_GL_SwapBuffers();
}
}
@@ -1843,11 +1845,15 @@ void LLWindowSDL::gatherInput()
break;
case SDL_VIDEORESIZE: // *FIX: handle this?
+ {
llinfos << "Handling a resize event: " << event.resize.w <<
"x" << event.resize.h << llendl;
+ S32 width = llmax(event.resize.w, MIN_WINDOW_WIDTH);
+ S32 height = llmax(event.resize.h, MIN_WINDOW_HEIGHT);
+
// *FIX: I'm not sure this is necessary!
- mWindow = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, mSDLFlags);
+ mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags);
if (!mWindow)
{
// *FIX: More informative dialog?
@@ -1861,9 +1867,9 @@ void LLWindowSDL::gatherInput()
break;
}
- mCallbacks->handleResize(this, event.resize.w, event.resize.h );
+ mCallbacks->handleResize(this, width, height);
break;
-
+ }
case SDL_ACTIVEEVENT:
if (event.active.state & SDL_APPINPUTFOCUS)
{
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a84bd5fb08..799f0a3fab 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -41,6 +41,7 @@
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
+#include "llglslshader.h"
// System includes
#include <commdlg.h>
@@ -1125,7 +1126,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
LL_INFOS("Window") << "Drawing context is created." << llendl ;
gGLManager.initWGL();
-
+
if (wglChoosePixelFormatARB)
{
// OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
@@ -1384,7 +1385,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
return FALSE;
}
- if (!(mhRC = wglCreateContext(mhDC)))
+ mhRC = 0;
+ if (wglCreateContextAttribsARB)
+ { //attempt to create a specific versioned context
+ S32 attribs[] =
+ { //start at 4.2
+ WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
+ WGL_CONTEXT_MINOR_VERSION_ARB, 2,
+ WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
+ 0
+ };
+
+ bool done = false;
+ while (!done)
+ {
+ mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
+
+ if (!mhRC)
+ {
+ if (attribs[3] > 0)
+ { //decrement minor version
+ attribs[3]--;
+ }
+ else if (attribs[1] > 3)
+ { //decrement major version and start minor version over at 3
+ attribs[1]--;
+ attribs[3] = 3;
+ }
+ else
+ { //we reached 3.0 and still failed, bail out
+ done = true;
+ }
+ }
+ else
+ {
+ llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl;
+ done = true;
+
+ if (LLRender::sGLCoreProfile)
+ {
+ LLGLSLShader::sNoFixedFunction = true;
+ }
+ }
+ }
+ }
+
+ if (!mhRC && !(mhRC = wglCreateContext(mhDC)))
{
close();
OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
@@ -1404,7 +1451,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
-
+
// Disable vertical sync for swap
if (disable_vsync && wglSwapIntervalEXT)
{
@@ -2910,7 +2957,6 @@ BOOL LLWindowWin32::resetDisplayResolution()
void LLWindowWin32::swapBuffers()
{
- glFinish();
SwapBuffers(mhDC);
}