aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llwindow
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r--linden/indra/llwindow/lldxhardware.cpp1
-rw-r--r--linden/indra/llwindow/lldxhardware.h1
-rw-r--r--linden/indra/llwindow/llgl.cpp146
-rw-r--r--linden/indra/llwindow/llgl.h26
-rw-r--r--linden/indra/llwindow/llglheaders.h68
-rw-r--r--linden/indra/llwindow/llglstates.h1
-rw-r--r--linden/indra/llwindow/llglstubs.h1
-rw-r--r--linden/indra/llwindow/llgltypes.h1
-rw-r--r--linden/indra/llwindow/llkeyboard.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboard.h1
-rw-r--r--linden/indra/llwindow/llkeyboardmacosx.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboardmacosx.h1
-rw-r--r--linden/indra/llwindow/llkeyboardsdl.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboardsdl.h1
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.h1
-rw-r--r--linden/indra/llwindow/llmousehandler.h7
-rw-r--r--linden/indra/llwindow/llwindow.cpp28
-rw-r--r--linden/indra/llwindow/llwindow.h8
-rw-r--r--linden/indra/llwindow/llwindowheadless.cpp1
-rw-r--r--linden/indra/llwindow/llwindowheadless.h1
-rw-r--r--linden/indra/llwindow/llwindowlinux.cpp1
-rw-r--r--linden/indra/llwindow/llwindowlinux.h1
-rw-r--r--linden/indra/llwindow/llwindowmacosx-objc.h1
-rw-r--r--linden/indra/llwindow/llwindowmacosx-objc.mm1
-rw-r--r--linden/indra/llwindow/llwindowmacosx.cpp5
-rw-r--r--linden/indra/llwindow/llwindowmacosx.h1
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.cpp1
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.h1
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp14
-rw-r--r--linden/indra/llwindow/llwindowsdl.h1
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp92
-rw-r--r--linden/indra/llwindow/llwindowwin32.h4
33 files changed, 226 insertions, 195 deletions
diff --git a/linden/indra/llwindow/lldxhardware.cpp b/linden/indra/llwindow/lldxhardware.cpp
index b2e1b04..82d80ec 100644
--- a/linden/indra/llwindow/lldxhardware.cpp
+++ b/linden/indra/llwindow/lldxhardware.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/lldxhardware.h b/linden/indra/llwindow/lldxhardware.h
index 5d8b925..0574880 100644
--- a/linden/indra/llwindow/lldxhardware.h
+++ b/linden/indra/llwindow/lldxhardware.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llgl.cpp b/linden/indra/llwindow/llgl.cpp
index aabe9da..07348b7 100644
--- a/linden/indra/llwindow/llgl.cpp
+++ b/linden/indra/llwindow/llgl.cpp
@@ -1,9 +1,10 @@
1/** 1/**
2 * @file llgl.cpp 2 * @file llgl.cpp
3* @brief LLGL implementation 3 * @brief LLGL implementation
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -44,8 +45,6 @@
44 45
45#include "llglheaders.h" 46#include "llglheaders.h"
46 47
47#define LL_DEBUG_GL 1
48
49#if LL_LINUX && !LL_MESA_HEADLESS 48#if LL_LINUX && !LL_MESA_HEADLESS
50// The __APPLE__ hack is to make glh_extensions.h not symbol-clash horribly 49// The __APPLE__ hack is to make glh_extensions.h not symbol-clash horribly
51# define __APPLE__ 50# define __APPLE__
@@ -123,6 +122,25 @@ PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL;
123PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL; 122PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL;
124PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL; 123PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL;
125 124
125// GL_EXT_framebuffer_object
126PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
127PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
128PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
129PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
130PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
131PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = NULL;
132PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = NULL;
133PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = NULL;
134PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL;
135PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL;
136PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = NULL;
137PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = NULL;
138PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL;
139PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL;
140PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
141PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
142PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
143
126//shader object prototypes 144//shader object prototypes
127PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; 145PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
128PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; 146PFNGLGETHANDLEARBPROC glGetHandleARB = NULL;
@@ -253,17 +271,10 @@ LLGLManager::LLGLManager()
253 mIsDisabled = FALSE; 271 mIsDisabled = FALSE;
254 mHasCubeMap = FALSE; 272 mHasCubeMap = FALSE;
255 mHasMultitexture = FALSE; 273 mHasMultitexture = FALSE;
256 mHasAnyAGP = FALSE;
257 mHasMipMapGeneration = FALSE; 274 mHasMipMapGeneration = FALSE;
258 mHasAnisotropic = FALSE; 275 mHasAnisotropic = FALSE;
259 mHasCompressedTextures = FALSE; 276 mHasCompressedTextures = FALSE;
260 mHasNVVertexArrayRange = FALSE;
261 mHasNVFence = FALSE;
262 mHasARBEnvCombine = FALSE; 277 mHasARBEnvCombine = FALSE;
263 mHasATIVAO = FALSE;
264 mIsRadeon8500 = FALSE;
265 mIsRadeon9700 = FALSE;
266 mIsMobilityRadeon9000 = FALSE;
267 mIsGF2or4MX = FALSE; 278 mIsGF2or4MX = FALSE;
268 mIsGF3 = FALSE; 279 mIsGF3 = FALSE;
269 mIsGFFX = FALSE; 280 mIsGFFX = FALSE;
@@ -377,31 +388,8 @@ bool LLGLManager::initGL()
377 mobile = TRUE; 388 mobile = TRUE;
378 } 389 }
379 mIsATI = TRUE; 390 mIsATI = TRUE;
380 if ( mGLRenderer.find("9500") != LLString::npos
381 || mGLRenderer.find("9600") != LLString::npos
382 || mGLRenderer.find("9700") != LLString::npos
383 || mGLRenderer.find("9800") != LLString::npos )
384 {
385 mIsRadeon9700 = TRUE;
386 }
387 else if (mGLRenderer.find("8500") != LLString::npos
388 || mGLRenderer.find( "9000") != LLString::npos
389 || mGLRenderer.find("9100") != LLString::npos
390 || mGLRenderer.find("9200") != LLString::npos)
391 {
392 mIsRadeon8500 = TRUE;
393 if (mobile && mGLRenderer.find("9000") != LLString::npos)
394 {
395 mIsMobilityRadeon9000 = TRUE;
396 }
397 }
398 391
399#if LL_WINDOWS && !LL_MESA_HEADLESS 392#if LL_WINDOWS && !LL_MESA_HEADLESS
400 if (mIsRadeon9700 && mDriverVersionRelease < 3833)
401 {
402 return false; // Unsupported hardware
403 }
404
405 if (mDriverVersionRelease < 3842) 393 if (mDriverVersionRelease < 3842)
406 { 394 {
407 mATIOffsetVerticalLines = TRUE; 395 mATIOffsetVerticalLines = TRUE;
@@ -532,14 +520,16 @@ void LLGLManager::initExtensions()
532# else 520# else
533 mHasVertexBufferObject = FALSE; 521 mHasVertexBufferObject = FALSE;
534# endif 522# endif
523# if GL_EXT_framebuffer_object
524 mHasFramebufferObject = TRUE;
525# else
526 mHasFramebufferObject = FALSE;
527# endif
535 mHasMipMapGeneration = FALSE; 528 mHasMipMapGeneration = FALSE;
536 mHasPalettedTextures = FALSE; 529 mHasPalettedTextures = FALSE;
537 mHasNVVertexArrayRange = FALSE;
538 mHasNVFence = FALSE;
539 mHasSeparateSpecularColor = FALSE; 530 mHasSeparateSpecularColor = FALSE;
540 mHasAnisotropic = FALSE; 531 mHasAnisotropic = FALSE;
541 mHasCubeMap = FALSE; 532 mHasCubeMap = FALSE;
542 mHasATIVAO = FALSE;
543 mHasOcclusionQuery = FALSE; 533 mHasOcclusionQuery = FALSE;
544 mHasPointParameters = FALSE; 534 mHasPointParameters = FALSE;
545 mHasShaderObjects = FALSE; 535 mHasShaderObjects = FALSE;
@@ -549,17 +539,15 @@ void LLGLManager::initExtensions()
549 mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); 539 mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
550 mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap"); 540 mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap");
551 mHasPalettedTextures = glh_init_extension("GL_EXT_paletted_texture"); 541 mHasPalettedTextures = glh_init_extension("GL_EXT_paletted_texture");
552 mHasNVVertexArrayRange = glh_init_extensions("GL_NV_vertex_array_range");
553 mHasNVFence = glh_init_extensions("GL_NV_fence");
554 mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); 542 mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color");
555 mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); 543 mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic");
556 glh_init_extensions("GL_ARB_texture_cube_map"); 544 glh_init_extensions("GL_ARB_texture_cube_map");
557 mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); 545 mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts);
558 mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); 546 mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts);
559 mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); 547 mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
560 mHasATIVAO = ExtensionExists("GL_ATI_vertex_array_object", gGLHExts.mSysExts);
561 mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); 548 mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
562 mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); 549 mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
550 mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts);
563#if !LL_DARWIN 551#if !LL_DARWIN
564 mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); 552 mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
565#endif 553#endif
@@ -578,14 +566,12 @@ void LLGLManager::initExtensions()
578 mHasARBEnvCombine = FALSE; 566 mHasARBEnvCombine = FALSE;
579 mHasCompressedTextures = FALSE; 567 mHasCompressedTextures = FALSE;
580 mHasVertexBufferObject = FALSE; 568 mHasVertexBufferObject = FALSE;
569 mHasFramebufferObject = FALSE;
581 mHasMipMapGeneration = FALSE; 570 mHasMipMapGeneration = FALSE;
582 mHasPalettedTextures = FALSE; 571 mHasPalettedTextures = FALSE;
583 mHasNVVertexArrayRange = FALSE;
584 mHasNVFence = FALSE;
585 mHasSeparateSpecularColor = FALSE; 572 mHasSeparateSpecularColor = FALSE;
586 mHasAnisotropic = FALSE; 573 mHasAnisotropic = FALSE;
587 mHasCubeMap = FALSE; 574 mHasCubeMap = FALSE;
588 mHasATIVAO = FALSE;
589 mHasOcclusionQuery = FALSE; 575 mHasOcclusionQuery = FALSE;
590 mHasPointParameters = FALSE; 576 mHasPointParameters = FALSE;
591 mHasShaderObjects = FALSE; 577 mHasShaderObjects = FALSE;
@@ -602,11 +588,8 @@ void LLGLManager::initExtensions()
602 // proper blacklist/whitelist on Linux. 588 // proper blacklist/whitelist on Linux.
603 mHasMipMapGeneration = FALSE; 589 mHasMipMapGeneration = FALSE;
604 mHasPalettedTextures = FALSE; 590 mHasPalettedTextures = FALSE;
605 mHasNVVertexArrayRange = FALSE;
606 mHasNVFence = FALSE;
607 mHasAnisotropic = FALSE; 591 mHasAnisotropic = FALSE;
608 mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar 592 mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar
609 mHasATIVAO = FALSE;
610 mHasOcclusionQuery = FALSE; // source of many ATI system hangs 593 mHasOcclusionQuery = FALSE; // source of many ATI system hangs
611 mHasShaderObjects = FALSE; 594 mHasShaderObjects = FALSE;
612 mHasVertexShader = FALSE; 595 mHasVertexShader = FALSE;
@@ -626,17 +609,18 @@ void LLGLManager::initExtensions()
626 if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE; 609 if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE;
627 if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S 610 if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S
628 if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S 611 if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S
629 if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S 612// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S
630 if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S 613// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S
631 if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; 614 if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE;
632 if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S 615 if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S
633 if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S 616 if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S
634 if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S 617// if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S
635 if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE; 618 if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE;
636 if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S 619 if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S
637 if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S 620 if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S
638 if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S 621 if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S
639 if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S 622 if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S
623 if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S
640 } 624 }
641#endif // LL_LINUX 625#endif // LL_LINUX
642 626
@@ -663,14 +647,6 @@ void LLGLManager::initExtensions()
663 { 647 {
664 llinfos << "Couldn't initialize GL_EXT_paletted_texture" << llendl; 648 llinfos << "Couldn't initialize GL_EXT_paletted_texture" << llendl;
665 } 649 }
666 if (!mHasNVVertexArrayRange)
667 {
668 llinfos << "Couldn't initialize GL_NV_vertex_array_range" << llendl;
669 }
670 if (!mHasNVFence)
671 {
672 llinfos << "Couldn't initialize GL_NV_fence" << llendl;
673 }
674 if (!mHasSeparateSpecularColor) 650 if (!mHasSeparateSpecularColor)
675 { 651 {
676 llinfos << "Couldn't initialize separate specular color" << llendl; 652 llinfos << "Couldn't initialize separate specular color" << llendl;
@@ -717,10 +693,6 @@ void LLGLManager::initExtensions()
717 } 693 }
718 694
719 // Misc 695 // Misc
720 if (mHasNVFence || mHasATIVAO)
721 {
722 mHasAnyAGP = TRUE;
723 }
724 glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); 696 glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange);
725 glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); 697 glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
726 698
@@ -744,10 +716,6 @@ void LLGLManager::initExtensions()
744 llinfos << "Has GL_APPLE_vertex_array_object!" << llendl; 716 llinfos << "Has GL_APPLE_vertex_array_object!" << llendl;
745 } 717 }
746 718
747 if(mHasAPPLEFence)
748 {
749 mHasAnyAGP = TRUE;
750 }
751#endif // LL_DARWIN 719#endif // LL_DARWIN
752 720
753#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS 721#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
@@ -773,23 +741,25 @@ void LLGLManager::initExtensions()
773 mHasVertexBufferObject = FALSE; 741 mHasVertexBufferObject = FALSE;
774 } 742 }
775 } 743 }
776 if (mHasATIVAO) 744 if (mHasFramebufferObject)
777 { 745 {
778 // Initialize the extension. 746 glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT");
779 llinfos << "Has ATI_vertex_array_object!" << llendl; 747 glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT");
780 glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glNewObjectBufferATI"); 748 glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT");
781 glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glIsObjectBufferATI"); 749 glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenRenderbuffersEXT");
782 glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glUpdateObjectBufferATI"); 750 glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageEXT");
783 glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetObjectBufferfvATI"); 751 glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetRenderbufferParameterivEXT");
784 glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetObjectBufferivATI"); 752 glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsFramebufferEXT");
785 glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glFreeObjectBufferATI"); 753 glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindFramebufferEXT");
786 glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glArrayObjectATI"); 754 glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteFramebuffersEXT");
787 glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribArrayObjectATI"); 755 glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenFramebuffersEXT");
788 glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetArrayObjectfvATI"); 756 glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glCheckFramebufferStatusEXT");
789 glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetArrayObjectivATI"); 757 glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture1DEXT");
790 glVariantObjectArrayATI = (PFNGLVARIANTARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glVariantObjectArrayATI"); 758 glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture2DEXT");
791 glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVariantArrayObjectfvATI"); 759 glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture3DEXT");
792 glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVariantArrayObjectivATI"); 760 glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferRenderbufferEXT");
761 glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameterivEXT");
762 glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmapEXT");
793 } 763 }
794#if !LL_LINUX 764#if !LL_LINUX
795 // This is expected to be a static symbol on Linux GL implementations 765 // This is expected to be a static symbol on Linux GL implementations
@@ -1005,6 +975,20 @@ void LLGLState::restoreGL()
1005 initClass(); 975 initClass();
1006} 976}
1007 977
978//static
979// Really shouldn't be needed, but seems we sometimes do.
980void LLGLState::resetTextureStates()
981{
982 GLint maxTextureUnits;
983 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits);
984 for (S32 j = maxTextureUnits-1; j >=0; j--)
985 {
986 glActiveTextureARB(GL_TEXTURE0_ARB+j);
987 glClientActiveTextureARB(GL_TEXTURE0_ARB+j);
988 j == 0 ? glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D);
989 }
990}
991
1008void LLGLState::dumpStates() 992void LLGLState::dumpStates()
1009{ 993{
1010 llinfos << "GL States:" << llendl; 994 llinfos << "GL States:" << llendl;
diff --git a/linden/indra/llwindow/llgl.h b/linden/indra/llwindow/llgl.h
index 34bf400..c83ccb8 100644
--- a/linden/indra/llwindow/llgl.h
+++ b/linden/indra/llwindow/llgl.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -40,6 +41,8 @@
40#include "v4math.h" 41#include "v4math.h"
41#include "llgltypes.h" 42#include "llgltypes.h"
42 43
44#define LL_DEBUG_GL 1
45
43#define LL_GL_ERRS llerrs 46#define LL_GL_ERRS llerrs
44 47
45// Manage GL extensions... 48// Manage GL extensions...
@@ -62,10 +65,10 @@ public:
62 BOOL mHasMultitexture; 65 BOOL mHasMultitexture;
63 S32 mNumTextureUnits; 66 S32 mNumTextureUnits;
64 BOOL mHasMipMapGeneration; 67 BOOL mHasMipMapGeneration;
65 BOOL mHasAnyAGP;
66 BOOL mHasPalettedTextures; 68 BOOL mHasPalettedTextures;
67 BOOL mHasCompressedTextures; 69 BOOL mHasCompressedTextures;
68 70 BOOL mHasFramebufferObject;
71
69 // ARB Extensions 72 // ARB Extensions
70 BOOL mHasVertexBufferObject; 73 BOOL mHasVertexBufferObject;
71 BOOL mHasPBuffer; 74 BOOL mHasPBuffer;
@@ -75,25 +78,19 @@ public:
75 BOOL mHasOcclusionQuery; 78 BOOL mHasOcclusionQuery;
76 BOOL mHasPointParameters; 79 BOOL mHasPointParameters;
77 80
78 // nVidia extensions. 81 // Other extensions.
79 BOOL mHasAnisotropic; 82 BOOL mHasAnisotropic;
80 BOOL mHasNVVertexArrayRange;
81 BOOL mHasNVFence;
82 BOOL mHasARBEnvCombine; 83 BOOL mHasARBEnvCombine;
84 BOOL mHasCubeMap;
83 85
84 // ATI extensions. 86 // Vender specific extensions
85 BOOL mHasATIVAO; 87 BOOL mIsATI;
86 BOOL mIsRadeon8500; // Radeon 8500/9000 88 BOOL mIsNVIDIA;
87 BOOL mIsRadeon9700; 89 BOOL mIsIntel;
88 BOOL mIsMobilityRadeon9000;
89 BOOL mIsGF2or4MX; 90 BOOL mIsGF2or4MX;
90 BOOL mIsGF3; 91 BOOL mIsGF3;
91 BOOL mIsGFFX; 92 BOOL mIsGFFX;
92 BOOL mIsATI;
93 BOOL mATIOffsetVerticalLines; 93 BOOL mATIOffsetVerticalLines;
94 BOOL mIsNVIDIA;
95 BOOL mIsIntel;
96 BOOL mHasCubeMap;
97 94
98#if LL_WINDOWS 95#if LL_WINDOWS
99 BOOL mHasWGLARBPixelFormat; 96 BOOL mHasWGLARBPixelFormat;
@@ -220,6 +217,7 @@ public:
220 static void initClass(); 217 static void initClass();
221 static void restoreGL(); 218 static void restoreGL();
222 219
220 static void resetTextureStates();
223 static void dumpStates(); 221 static void dumpStates();
224 static void checkStates(); 222 static void checkStates();
225 static void checkTextureChannels(); 223 static void checkTextureChannels();
diff --git a/linden/indra/llwindow/llglheaders.h b/linden/indra/llwindow/llglheaders.h
index 7c4d8fd..1d815ee 100644
--- a/linden/indra/llwindow/llglheaders.h
+++ b/linden/indra/llwindow/llglheaders.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -137,7 +138,7 @@ extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB;
137extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; 138extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB;
138extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; 139extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB;
139 140
140// GL_ARB;_vertex_shader 141// GL_ARB_vertex_shader
141extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; 142extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB;
142extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; 143extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB;
143extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; 144extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB;
@@ -209,6 +210,26 @@ extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB;
209 210
210extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; 211extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
211 212
213//GL_EXT_framebuffer_object
214extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
215extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
216extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
217extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
218extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
219extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT;
220extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT;
221extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
222extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
223extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
224extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
225extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT;
226extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
227extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT;
228extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
229extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT;
230extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
231
232
212#elif LL_WINDOWS 233#elif LL_WINDOWS
213//---------------------------------------------------------------------------- 234//----------------------------------------------------------------------------
214#include <GL/gl.h> 235#include <GL/gl.h>
@@ -304,7 +325,7 @@ extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB;
304extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; 325extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB;
305extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; 326extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB;
306 327
307// GL_ARB;_vertex_shader 328// GL_ARB_vertex_shader
308extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; 329extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB;
309extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; 330extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB;
310extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; 331extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB;
@@ -371,6 +392,25 @@ extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
371extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; 392extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB;
372extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; 393extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
373 394
395//GL_EXT_framebuffer_object
396extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
397extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
398extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
399extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
400extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
401extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT;
402extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT;
403extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
404extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
405extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
406extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
407extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT;
408extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
409extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT;
410extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
411extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT;
412extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
413
374 414
375#elif LL_DARWIN 415#elif LL_DARWIN
376//---------------------------------------------------------------------------- 416//----------------------------------------------------------------------------
@@ -384,6 +424,30 @@ extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
384 424
385#include "GL/glh_extensions.h" 425#include "GL/glh_extensions.h"
386 426
427// These symbols don't exist on 10.3.9, so they have to be declared weak. Redeclaring them here fixes the problem.
428// Note that they also must not be called on 10.3.9. This should be taken care of by a runtime check for the existence of the GL extension.
429#include <AvailabilityMacros.h>
430
431// GL_EXT_framebuffer_object
432extern GLboolean glIsRenderbufferEXT(GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
433extern void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
434extern void glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
435extern void glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
436extern void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
437extern void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
438extern GLboolean glIsFramebufferEXT(GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
439extern void glBindFramebufferEXT(GLenum target, GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
440extern void glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
441extern void glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
442extern GLenum glCheckFramebufferStatusEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
443extern void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
444extern void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
445extern void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
446extern void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
447extern void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
448extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
449
450
387#ifdef __cplusplus 451#ifdef __cplusplus
388extern "C" { 452extern "C" {
389#endif 453#endif
diff --git a/linden/indra/llwindow/llglstates.h b/linden/indra/llwindow/llglstates.h
index 8e67e33..887d099 100644
--- a/linden/indra/llwindow/llglstates.h
+++ b/linden/indra/llwindow/llglstates.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llglstubs.h b/linden/indra/llwindow/llglstubs.h
index d7f0d94..1d70400 100644
--- a/linden/indra/llwindow/llglstubs.h
+++ b/linden/indra/llwindow/llglstubs.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llgltypes.h b/linden/indra/llwindow/llgltypes.h
index fffa979..d130a42 100644
--- a/linden/indra/llwindow/llgltypes.h
+++ b/linden/indra/llwindow/llgltypes.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2006-2007, Linden Research, Inc. 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboard.cpp b/linden/indra/llwindow/llkeyboard.cpp
index 0da1644..213fe85 100644
--- a/linden/indra/llwindow/llkeyboard.cpp
+++ b/linden/indra/llwindow/llkeyboard.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboard.h b/linden/indra/llwindow/llkeyboard.h
index e262ab6..61ae2ea 100644
--- a/linden/indra/llwindow/llkeyboard.h
+++ b/linden/indra/llwindow/llkeyboard.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardmacosx.cpp b/linden/indra/llwindow/llkeyboardmacosx.cpp
index 961bb66..6d06d53 100644
--- a/linden/indra/llwindow/llkeyboardmacosx.cpp
+++ b/linden/indra/llwindow/llkeyboardmacosx.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardmacosx.h b/linden/indra/llwindow/llkeyboardmacosx.h
index a4d9115..899b011 100644
--- a/linden/indra/llwindow/llkeyboardmacosx.h
+++ b/linden/indra/llwindow/llkeyboardmacosx.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2004-2007, Linden Research, Inc. 5 * Copyright (c) 2004-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardsdl.cpp b/linden/indra/llwindow/llkeyboardsdl.cpp
index 07db986..027f6a4 100644
--- a/linden/indra/llwindow/llkeyboardsdl.cpp
+++ b/linden/indra/llwindow/llkeyboardsdl.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardsdl.h b/linden/indra/llwindow/llkeyboardsdl.h
index b582e21..7546496 100644
--- a/linden/indra/llwindow/llkeyboardsdl.h
+++ b/linden/indra/llwindow/llkeyboardsdl.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2004-2007, Linden Research, Inc. 5 * Copyright (c) 2004-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardwin32.cpp b/linden/indra/llwindow/llkeyboardwin32.cpp
index 33664b9..f9db941 100644
--- a/linden/indra/llwindow/llkeyboardwin32.cpp
+++ b/linden/indra/llwindow/llkeyboardwin32.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llkeyboardwin32.h b/linden/indra/llwindow/llkeyboardwin32.h
index 1501e8f..33233c9 100644
--- a/linden/indra/llwindow/llkeyboardwin32.h
+++ b/linden/indra/llwindow/llkeyboardwin32.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2004-2007, Linden Research, Inc. 5 * Copyright (c) 2004-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h
index 4e9b882..3091920 100644
--- a/linden/indra/llwindow/llmousehandler.h
+++ b/linden/indra/llwindow/llmousehandler.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -34,8 +35,6 @@
34// Intended for use via multiple inheritance. 35// Intended for use via multiple inheritance.
35// A class may have as many interfaces as it likes, but never needs to inherit one more than once. 36// A class may have as many interfaces as it likes, but never needs to inherit one more than once.
36 37
37#include "llstring.h"
38
39class LLMouseHandler 38class LLMouseHandler
40{ 39{
41public: 40public:
@@ -52,11 +51,15 @@ public:
52 virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) = 0; 51 virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) = 0;
53 virtual const LLString& getName() const = 0; 52 virtual const LLString& getName() const = 0;
54 53
54 virtual void onMouseCaptureLost() = 0;
55
55 // Hack to support LLFocusMgr 56 // Hack to support LLFocusMgr
56 virtual BOOL isView() = 0; 57 virtual BOOL isView() = 0;
57 58
58 virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0; 59 virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0;
59 virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0; 60 virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0;
61
62 virtual BOOL hasMouseCapture() = 0;
60}; 63};
61 64
62#endif 65#endif
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp
index 20fc84e..134e606 100644
--- a/linden/indra/llwindow/llwindow.cpp
+++ b/linden/indra/llwindow/llwindow.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -232,6 +233,15 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags)
232 mHideCursorPermanent(FALSE), 233 mHideCursorPermanent(FALSE),
233 mFlags(flags) 234 mFlags(flags)
234{ 235{
236 for (U32 i = 0; i < 6; i++)
237 {
238 mJoyAxis[i] = 0;
239 }
240
241 for (U32 i = 0; i < 16; i++)
242 {
243 mJoyButtonState[i] = 0;
244 }
235} 245}
236 246
237// virtual 247// virtual
@@ -249,6 +259,24 @@ void LLWindow::decBusyCount()
249 } 259 }
250} 260}
251 261
262F32 LLWindow::getJoystickAxis(U32 axis)
263{
264 if (axis < 6)
265 {
266 return mJoyAxis[axis];
267 }
268 return 0.f;
269}
270
271U8 LLWindow::getJoystickButton(U32 button)
272{
273 if (button < 16)
274 {
275 return mJoyButtonState[button];
276 }
277 return 0;
278}
279
252void LLWindow::setCallbacks(LLWindowCallbacks *callbacks) 280void LLWindow::setCallbacks(LLWindowCallbacks *callbacks)
253{ 281{
254 mCallbacks = callbacks; 282 mCallbacks = callbacks;
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h
index f4bb147..a52aff6 100644
--- a/linden/indra/llwindow/llwindow.h
+++ b/linden/indra/llwindow/llwindow.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -200,6 +201,9 @@ public:
200 virtual F32 getNativeAspectRatio() = 0; 201 virtual F32 getNativeAspectRatio() = 0;
201 virtual F32 getPixelAspectRatio() = 0; 202 virtual F32 getPixelAspectRatio() = 0;
202 virtual void setNativeAspectRatio(F32 aspect) = 0; 203 virtual void setNativeAspectRatio(F32 aspect) = 0;
204
205 F32 getJoystickAxis(U32 axis);
206 U8 getJoystickButton(U32 button);
203 207
204 void setCallbacks(LLWindowCallbacks *callbacks); 208 void setCallbacks(LLWindowCallbacks *callbacks);
205 209
@@ -238,7 +242,9 @@ protected:
238 ESwapMethod mSwapMethod; 242 ESwapMethod mSwapMethod;
239 BOOL mHideCursorPermanent; 243 BOOL mHideCursorPermanent;
240 U32 mFlags; 244 U32 mFlags;
241 245 F32 mJoyAxis[6];
246 U8 mJoyButtonState[16];
247
242 friend class LLWindowManager; 248 friend class LLWindowManager;
243}; 249};
244 250
diff --git a/linden/indra/llwindow/llwindowheadless.cpp b/linden/indra/llwindow/llwindowheadless.cpp
index 821632d..62306f1 100644
--- a/linden/indra/llwindow/llwindowheadless.cpp
+++ b/linden/indra/llwindow/llwindowheadless.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowheadless.h b/linden/indra/llwindow/llwindowheadless.h
index cc7fa06..c474a5a 100644
--- a/linden/indra/llwindow/llwindowheadless.h
+++ b/linden/indra/llwindow/llwindowheadless.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowlinux.cpp b/linden/indra/llwindow/llwindowlinux.cpp
index e266efc..79f4d48 100644
--- a/linden/indra/llwindow/llwindowlinux.cpp
+++ b/linden/indra/llwindow/llwindowlinux.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowlinux.h b/linden/indra/llwindow/llwindowlinux.h
index 9550cdd..0465ef4 100644
--- a/linden/indra/llwindow/llwindowlinux.h
+++ b/linden/indra/llwindow/llwindowlinux.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.h b/linden/indra/llwindow/llwindowmacosx-objc.h
index d055729..d17fa61 100644
--- a/linden/indra/llwindow/llwindowmacosx-objc.h
+++ b/linden/indra/llwindow/llwindowmacosx-objc.h
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (c) 2006-2007, Linden Research, Inc. 6 * Copyright (c) 2006-2007, Linden Research, Inc.
7 * 7 *
8 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0 10 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement 11 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.mm b/linden/indra/llwindow/llwindowmacosx-objc.mm
index bde3841..241f821 100644
--- a/linden/indra/llwindow/llwindowmacosx-objc.mm
+++ b/linden/indra/llwindow/llwindowmacosx-objc.mm
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (c) 2006-2007, Linden Research, Inc. 6 * Copyright (c) 2006-2007, Linden Research, Inc.
7 * 7 *
8 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0 10 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement 11 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp
index 7313fd3..b2a1ccf 100644
--- a/linden/indra/llwindow/llwindowmacosx.cpp
+++ b/linden/indra/llwindow/llwindowmacosx.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -91,7 +92,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
91 if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) 92 if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))
92 { 93 {
93 char buffer[1024];/* Flawfinder: ignore */ 94 char buffer[1024];/* Flawfinder: ignore */
94 snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */ 95 snprintf(buffer, sizeof(buffer),
95 "Your video card appears to be a %s, which Second Life does not support.\n" 96 "Your video card appears to be a %s, which Second Life does not support.\n"
96 "\n" 97 "\n"
97 "Second Life requires a video card with 32 Mb of memory or more, as well as\n" 98 "Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@@ -426,7 +427,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
426 mFullscreenRefresh = -1; 427 mFullscreenRefresh = -1;
427 428
428 char error[256]; /* Flawfinder: ignore */ 429 char error[256]; /* Flawfinder: ignore */
429 snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */ 430 snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
430 OSMessageBox(error, "Error", OSMB_OK); 431 OSMessageBox(error, "Error", OSMB_OK);
431 } 432 }
432 } 433 }
diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h
index 7425077..63d846e 100644
--- a/linden/indra/llwindow/llwindowmacosx.h
+++ b/linden/indra/llwindow/llwindowmacosx.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowmesaheadless.cpp b/linden/indra/llwindow/llwindowmesaheadless.cpp
index 7e5f4b0..f10d7cd 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.cpp
+++ b/linden/indra/llwindow/llwindowmesaheadless.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowmesaheadless.h b/linden/indra/llwindow/llwindowmesaheadless.h
index f8599c6..599db72 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.h
+++ b/linden/indra/llwindow/llwindowmesaheadless.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp
index 85836af..c375e32 100644
--- a/linden/indra/llwindow/llwindowsdl.cpp
+++ b/linden/indra/llwindow/llwindowsdl.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -205,7 +206,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
205 if (!strncasecmp(RENDERER, bad_card, strlen(bad_card))) 206 if (!strncasecmp(RENDERER, bad_card, strlen(bad_card)))
206 { 207 {
207 char buffer[1024]; /* Flawfinder: ignore */ 208 char buffer[1024]; /* Flawfinder: ignore */
208 snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */ 209 snprintf(buffer, sizeof(buffer),
209 "Your video card appears to be a %s, which Second Life does not support.\n" 210 "Your video card appears to be a %s, which Second Life does not support.\n"
210 "\n" 211 "\n"
211 "Second Life requires a video card with 32 Mb of memory or more, as well as\n" 212 "Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@@ -314,7 +315,7 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
314 char path_buffer[PATH_BUFFER_SIZE]; /* Flawfinder: ignore */ 315 char path_buffer[PATH_BUFFER_SIZE]; /* Flawfinder: ignore */
315 316
316 // Figure out where our BMP is living on the disk 317 // Figure out where our BMP is living on the disk
317 snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s", /* Flawfinder: ignore */ 318 snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s",
318 gDirUtilp->getAppRODataDir().c_str(), 319 gDirUtilp->getAppRODataDir().c_str(),
319 gDirUtilp->getDirDelimiter().c_str(), 320 gDirUtilp->getDirDelimiter().c_str(),
320 gDirUtilp->getDirDelimiter().c_str(), 321 gDirUtilp->getDirDelimiter().c_str(),
@@ -485,7 +486,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
485 mFullscreenRefresh = -1; 486 mFullscreenRefresh = -1;
486 487
487 char error[256]; /* Flawfinder: ignore */ 488 char error[256]; /* Flawfinder: ignore */
488 snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */ 489 snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
489 OSMessageBox(error, "Error", OSMB_OK); 490 OSMessageBox(error, "Error", OSMB_OK);
490 } 491 }
491 } 492 }
@@ -1184,7 +1185,7 @@ x11clipboard_type convert_format(int type)
1184 these right now, and support is skeletal. */ 1185 these right now, and support is skeletal. */
1185 char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */ 1186 char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */
1186 1187
1187 snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type); /* Flawfinder: ignore */ 1188 snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type);
1188 return XInternAtom(gWindowImplementation->mSDL_Display, 1189 return XInternAtom(gWindowImplementation->mSDL_Display,
1189 format, False); 1190 format, False);
1190 } 1191 }
@@ -1871,7 +1872,7 @@ void LLWindowSDL::gatherInput()
1871 // the locale to protect it, as exotic/non-C locales 1872 // the locale to protect it, as exotic/non-C locales
1872 // causes our code lots of general critical weirdness 1873 // causes our code lots of general critical weirdness
1873 // and crashness. (SL-35450) 1874 // and crashness. (SL-35450)
1874 char *saved_locale = setlocale(LC_ALL, NULL); 1875 std::string saved_locale = setlocale(LC_ALL, NULL);
1875 1876
1876 // Do a limited number of pumps so SL doesn't starve! 1877 // Do a limited number of pumps so SL doesn't starve!
1877 // FIXME - this should ideally be time-limited, not count-limited. 1878 // FIXME - this should ideally be time-limited, not count-limited.
@@ -1880,8 +1881,7 @@ void LLWindowSDL::gatherInput()
1880 if (gtk_events_pending()) 1881 if (gtk_events_pending())
1881 gtk_main_iteration(); 1882 gtk_main_iteration();
1882 1883
1883 if (saved_locale) 1884 setlocale(LC_ALL, saved_locale.c_str() );
1884 setlocale(LC_ALL, saved_locale);
1885 } 1885 }
1886#endif // LL_GTK && LL_LIBXUL_ENABLED 1886#endif // LL_GTK && LL_LIBXUL_ENABLED
1887 1887
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h
index ed529a2..2e75239 100644
--- a/linden/indra/llwindow/llwindowsdl.h
+++ b/linden/indra/llwindow/llwindowsdl.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index 1d084d2..7c3ec01 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -763,8 +764,6 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
763 } 764 }
764 765
765 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer 766 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
766 mJoyStickState = 0;
767 mJoyButtonState = 0;
768} 767}
769 768
770 769
@@ -2815,89 +2814,16 @@ void LLWindowWin32::updateJoystick( )
2815 if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) ) 2814 if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) )
2816 return; // The device should have been acquired during the Poll() 2815 return; // The device should have been acquired during the Poll()
2817 2816
2818 if (js.lX <= -500) 2817 mJoyAxis[0] = js.lX/1000.f;
2819 { 2818 mJoyAxis[1] = js.lY/1000.f;
2820 if (!(mJoyStickState & 0x1)) 2819 mJoyAxis[2] = js.lZ/1000.f;
2821 { 2820 mJoyAxis[3] = js.lRx/1000.f;
2822 gKeyboard->handleTranslatedKeyDown(KEY_PAD_LEFT, 0); 2821 mJoyAxis[4] = js.lRy/1000.f;
2823 mJoyStickState |= 0x1; 2822 mJoyAxis[5] = js.lRz/1000.f;
2824 }
2825 }
2826 else
2827 {
2828 if (mJoyStickState & 0x1)
2829 {
2830 gKeyboard->handleTranslatedKeyUp(KEY_PAD_LEFT, 0);
2831 mJoyStickState &= ~0x1;
2832 }
2833 }
2834 if (js.lX >= 500)
2835 {
2836 if (!(mJoyStickState & 0x2))
2837 {
2838 gKeyboard->handleTranslatedKeyDown(KEY_PAD_RIGHT, 0);
2839 mJoyStickState |= 0x2;
2840 }
2841 }
2842 else
2843 {
2844 if (mJoyStickState & 0x2)
2845 {
2846 gKeyboard->handleTranslatedKeyUp(KEY_PAD_RIGHT, 0);
2847 mJoyStickState &= ~0x2;
2848 }
2849 }
2850 if (js.lY <= -500)
2851 {
2852 if (!(mJoyStickState & 0x4))
2853 {
2854 gKeyboard->handleTranslatedKeyDown(KEY_PAD_UP, 0);
2855 mJoyStickState |= 0x4;
2856 }
2857 }
2858 else
2859 {
2860 if (mJoyStickState & 0x4)
2861 {
2862 gKeyboard->handleTranslatedKeyUp(KEY_PAD_UP, 0);
2863 mJoyStickState &= ~0x4;
2864 }
2865 }
2866 if (js.lY >= 500)
2867 {
2868 if (!(mJoyStickState & 0x8))
2869 {
2870 gKeyboard->handleTranslatedKeyDown(KEY_PAD_DOWN, 0);
2871 mJoyStickState |= 0x8;
2872 }
2873 }
2874 else
2875 {
2876 if (mJoyStickState & 0x8)
2877 {
2878 gKeyboard->handleTranslatedKeyUp(KEY_PAD_DOWN, 0);
2879 mJoyStickState &= ~0x8;
2880 }
2881 }
2882 2823
2883 for( int i = 0; i < 15; i++ ) 2824 for (U32 i = 0; i < 16; i++)
2884 { 2825 {
2885 if ( js.rgbButtons[i] & 0x80 ) 2826 mJoyButtonState[i] = js.rgbButtons[i];
2886 {
2887 if (!(mJoyButtonState & (1<<i)))
2888 {
2889 gKeyboard->handleTranslatedKeyDown(KEY_BUTTON1+i, 0);
2890 mJoyButtonState |= (1<<i);
2891 }
2892 }
2893 else
2894 {
2895 if (mJoyButtonState & (1<<i))
2896 {
2897 gKeyboard->handleTranslatedKeyUp(KEY_BUTTON1+i, 0);
2898 mJoyButtonState &= ~(1<<i);
2899 }
2900 }
2901 } 2827 }
2902} 2828}
2903 2829
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h
index f6300f6..040c9ab 100644
--- a/linden/indra/llwindow/llwindowwin32.h
+++ b/linden/indra/llwindow/llwindowwin32.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -169,9 +170,6 @@ protected:
169 WORD mPrevGammaRamp[256*3]; 170 WORD mPrevGammaRamp[256*3];
170 WORD mCurrentGammaRamp[256*3]; 171 WORD mCurrentGammaRamp[256*3];
171 172
172 U32 mJoyStickState;
173 U32 mJoyButtonState;
174
175 LPWSTR mIconResource; 173 LPWSTR mIconResource;
176 BOOL mMousePositionModified; 174 BOOL mMousePositionModified;
177 BOOL mInputProcessingPaused; 175 BOOL mInputProcessingPaused;