From b2afb8800bb033a04bb3ecdf0363068d56648ef1 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:54 -0500 Subject: Second Life viewer sources 1.15.0.2 --- linden/indra/llwindow/lldxhardware.cpp | 1 + linden/indra/llwindow/lldxhardware.h | 1 + linden/indra/llwindow/llgl.cpp | 146 +++++++++++-------------- linden/indra/llwindow/llgl.h | 26 ++--- linden/indra/llwindow/llglheaders.h | 68 +++++++++++- linden/indra/llwindow/llglstates.h | 1 + linden/indra/llwindow/llglstubs.h | 1 + linden/indra/llwindow/llgltypes.h | 1 + linden/indra/llwindow/llkeyboard.cpp | 1 + linden/indra/llwindow/llkeyboard.h | 1 + linden/indra/llwindow/llkeyboardmacosx.cpp | 1 + linden/indra/llwindow/llkeyboardmacosx.h | 1 + linden/indra/llwindow/llkeyboardsdl.cpp | 1 + linden/indra/llwindow/llkeyboardsdl.h | 1 + linden/indra/llwindow/llkeyboardwin32.cpp | 1 + linden/indra/llwindow/llkeyboardwin32.h | 1 + linden/indra/llwindow/llmousehandler.h | 7 +- linden/indra/llwindow/llwindow.cpp | 28 +++++ linden/indra/llwindow/llwindow.h | 8 +- linden/indra/llwindow/llwindowheadless.cpp | 1 + linden/indra/llwindow/llwindowheadless.h | 1 + linden/indra/llwindow/llwindowlinux.cpp | 1 + linden/indra/llwindow/llwindowlinux.h | 1 + linden/indra/llwindow/llwindowmacosx-objc.h | 1 + linden/indra/llwindow/llwindowmacosx-objc.mm | 1 + linden/indra/llwindow/llwindowmacosx.cpp | 5 +- linden/indra/llwindow/llwindowmacosx.h | 1 + linden/indra/llwindow/llwindowmesaheadless.cpp | 1 + linden/indra/llwindow/llwindowmesaheadless.h | 1 + linden/indra/llwindow/llwindowsdl.cpp | 14 +-- linden/indra/llwindow/llwindowsdl.h | 1 + linden/indra/llwindow/llwindowwin32.cpp | 92 ++-------------- linden/indra/llwindow/llwindowwin32.h | 4 +- 33 files changed, 226 insertions(+), 195 deletions(-) (limited to 'linden/indra/llwindow') 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ /** * @file llgl.cpp -* @brief LLGL implementation + * @brief LLGL implementation * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -44,8 +45,6 @@ #include "llglheaders.h" -#define LL_DEBUG_GL 1 - #if LL_LINUX && !LL_MESA_HEADLESS // The __APPLE__ hack is to make glh_extensions.h not symbol-clash horribly # define __APPLE__ @@ -123,6 +122,25 @@ PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL; PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL; PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL; +// GL_EXT_framebuffer_object +PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL; +PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL; +PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = NULL; +PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = NULL; +PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL; +PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL; + //shader object prototypes PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; @@ -253,17 +271,10 @@ LLGLManager::LLGLManager() mIsDisabled = FALSE; mHasCubeMap = FALSE; mHasMultitexture = FALSE; - mHasAnyAGP = FALSE; mHasMipMapGeneration = FALSE; mHasAnisotropic = FALSE; mHasCompressedTextures = FALSE; - mHasNVVertexArrayRange = FALSE; - mHasNVFence = FALSE; mHasARBEnvCombine = FALSE; - mHasATIVAO = FALSE; - mIsRadeon8500 = FALSE; - mIsRadeon9700 = FALSE; - mIsMobilityRadeon9000 = FALSE; mIsGF2or4MX = FALSE; mIsGF3 = FALSE; mIsGFFX = FALSE; @@ -377,31 +388,8 @@ bool LLGLManager::initGL() mobile = TRUE; } mIsATI = TRUE; - if ( mGLRenderer.find("9500") != LLString::npos - || mGLRenderer.find("9600") != LLString::npos - || mGLRenderer.find("9700") != LLString::npos - || mGLRenderer.find("9800") != LLString::npos ) - { - mIsRadeon9700 = TRUE; - } - else if (mGLRenderer.find("8500") != LLString::npos - || mGLRenderer.find( "9000") != LLString::npos - || mGLRenderer.find("9100") != LLString::npos - || mGLRenderer.find("9200") != LLString::npos) - { - mIsRadeon8500 = TRUE; - if (mobile && mGLRenderer.find("9000") != LLString::npos) - { - mIsMobilityRadeon9000 = TRUE; - } - } #if LL_WINDOWS && !LL_MESA_HEADLESS - if (mIsRadeon9700 && mDriverVersionRelease < 3833) - { - return false; // Unsupported hardware - } - if (mDriverVersionRelease < 3842) { mATIOffsetVerticalLines = TRUE; @@ -532,14 +520,16 @@ void LLGLManager::initExtensions() # else mHasVertexBufferObject = FALSE; # endif +# if GL_EXT_framebuffer_object + mHasFramebufferObject = TRUE; +# else + mHasFramebufferObject = FALSE; +# endif mHasMipMapGeneration = FALSE; mHasPalettedTextures = FALSE; - mHasNVVertexArrayRange = FALSE; - mHasNVFence = FALSE; mHasSeparateSpecularColor = FALSE; mHasAnisotropic = FALSE; mHasCubeMap = FALSE; - mHasATIVAO = FALSE; mHasOcclusionQuery = FALSE; mHasPointParameters = FALSE; mHasShaderObjects = FALSE; @@ -549,17 +539,15 @@ void LLGLManager::initExtensions() mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap"); mHasPalettedTextures = glh_init_extension("GL_EXT_paletted_texture"); - mHasNVVertexArrayRange = glh_init_extensions("GL_NV_vertex_array_range"); - mHasNVFence = glh_init_extensions("GL_NV_fence"); mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); glh_init_extensions("GL_ARB_texture_cube_map"); mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); - mHasATIVAO = ExtensionExists("GL_ATI_vertex_array_object", gGLHExts.mSysExts); mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); + mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts); #if !LL_DARWIN mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); #endif @@ -578,14 +566,12 @@ void LLGLManager::initExtensions() mHasARBEnvCombine = FALSE; mHasCompressedTextures = FALSE; mHasVertexBufferObject = FALSE; + mHasFramebufferObject = FALSE; mHasMipMapGeneration = FALSE; mHasPalettedTextures = FALSE; - mHasNVVertexArrayRange = FALSE; - mHasNVFence = FALSE; mHasSeparateSpecularColor = FALSE; mHasAnisotropic = FALSE; mHasCubeMap = FALSE; - mHasATIVAO = FALSE; mHasOcclusionQuery = FALSE; mHasPointParameters = FALSE; mHasShaderObjects = FALSE; @@ -602,11 +588,8 @@ void LLGLManager::initExtensions() // proper blacklist/whitelist on Linux. mHasMipMapGeneration = FALSE; mHasPalettedTextures = FALSE; - mHasNVVertexArrayRange = FALSE; - mHasNVFence = FALSE; mHasAnisotropic = FALSE; mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar - mHasATIVAO = FALSE; mHasOcclusionQuery = FALSE; // source of many ATI system hangs mHasShaderObjects = FALSE; mHasVertexShader = FALSE; @@ -626,17 +609,18 @@ void LLGLManager::initExtensions() if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE; if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S - if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S - if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S +// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S +// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE; if (strchr(blacklist,'i')) mHasAnisotropic = FALSE;//S if (strchr(blacklist,'j')) mHasCubeMap = FALSE;//S - if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S +// if (strchr(blacklist,'k')) mHasATIVAO = FALSE;//S if (strchr(blacklist,'l')) mHasOcclusionQuery = FALSE; if (strchr(blacklist,'m')) mHasShaderObjects = FALSE;//S if (strchr(blacklist,'n')) mHasVertexShader = FALSE;//S if (strchr(blacklist,'o')) mHasFragmentShader = FALSE;//S if (strchr(blacklist,'p')) mHasPointParameters = FALSE;//S + if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S } #endif // LL_LINUX @@ -663,14 +647,6 @@ void LLGLManager::initExtensions() { llinfos << "Couldn't initialize GL_EXT_paletted_texture" << llendl; } - if (!mHasNVVertexArrayRange) - { - llinfos << "Couldn't initialize GL_NV_vertex_array_range" << llendl; - } - if (!mHasNVFence) - { - llinfos << "Couldn't initialize GL_NV_fence" << llendl; - } if (!mHasSeparateSpecularColor) { llinfos << "Couldn't initialize separate specular color" << llendl; @@ -717,10 +693,6 @@ void LLGLManager::initExtensions() } // Misc - if (mHasNVFence || mHasATIVAO) - { - mHasAnyAGP = TRUE; - } glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); @@ -744,10 +716,6 @@ void LLGLManager::initExtensions() llinfos << "Has GL_APPLE_vertex_array_object!" << llendl; } - if(mHasAPPLEFence) - { - mHasAnyAGP = TRUE; - } #endif // LL_DARWIN #if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS @@ -773,23 +741,25 @@ void LLGLManager::initExtensions() mHasVertexBufferObject = FALSE; } } - if (mHasATIVAO) - { - // Initialize the extension. - llinfos << "Has ATI_vertex_array_object!" << llendl; - glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glNewObjectBufferATI"); - glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glIsObjectBufferATI"); - glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glUpdateObjectBufferATI"); - glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetObjectBufferfvATI"); - glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetObjectBufferivATI"); - glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)GLH_EXT_GET_PROC_ADDRESS("glFreeObjectBufferATI"); - glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glArrayObjectATI"); - glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribArrayObjectATI"); - glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetArrayObjectfvATI"); - glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetArrayObjectivATI"); - glVariantObjectArrayATI = (PFNGLVARIANTARRAYOBJECTATIPROC)GLH_EXT_GET_PROC_ADDRESS("glVariantObjectArrayATI"); - glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVariantArrayObjectfvATI"); - glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVariantArrayObjectivATI"); + if (mHasFramebufferObject) + { + glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbufferEXT"); + glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbufferEXT"); + glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffersEXT"); + glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenRenderbuffersEXT"); + glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glRenderbufferStorageEXT"); + glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetRenderbufferParameterivEXT"); + glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glIsFramebufferEXT"); + glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBindFramebufferEXT"); + glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteFramebuffersEXT"); + glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenFramebuffersEXT"); + glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glCheckFramebufferStatusEXT"); + glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture1DEXT"); + glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture2DEXT"); + glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferTexture3DEXT"); + glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) GLH_EXT_GET_PROC_ADDRESS("glFramebufferRenderbufferEXT"); + glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGetFramebufferAttachmentParameterivEXT"); + glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glGenerateMipmapEXT"); } #if !LL_LINUX // This is expected to be a static symbol on Linux GL implementations @@ -1005,6 +975,20 @@ void LLGLState::restoreGL() initClass(); } +//static +// Really shouldn't be needed, but seems we sometimes do. +void LLGLState::resetTextureStates() +{ + GLint maxTextureUnits; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &maxTextureUnits); + for (S32 j = maxTextureUnits-1; j >=0; j--) + { + glActiveTextureARB(GL_TEXTURE0_ARB+j); + glClientActiveTextureARB(GL_TEXTURE0_ARB+j); + j == 0 ? glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); + } +} + void LLGLState::dumpStates() { 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -40,6 +41,8 @@ #include "v4math.h" #include "llgltypes.h" +#define LL_DEBUG_GL 1 + #define LL_GL_ERRS llerrs // Manage GL extensions... @@ -62,10 +65,10 @@ public: BOOL mHasMultitexture; S32 mNumTextureUnits; BOOL mHasMipMapGeneration; - BOOL mHasAnyAGP; BOOL mHasPalettedTextures; BOOL mHasCompressedTextures; - + BOOL mHasFramebufferObject; + // ARB Extensions BOOL mHasVertexBufferObject; BOOL mHasPBuffer; @@ -75,25 +78,19 @@ public: BOOL mHasOcclusionQuery; BOOL mHasPointParameters; - // nVidia extensions. + // Other extensions. BOOL mHasAnisotropic; - BOOL mHasNVVertexArrayRange; - BOOL mHasNVFence; BOOL mHasARBEnvCombine; + BOOL mHasCubeMap; - // ATI extensions. - BOOL mHasATIVAO; - BOOL mIsRadeon8500; // Radeon 8500/9000 - BOOL mIsRadeon9700; - BOOL mIsMobilityRadeon9000; + // Vender specific extensions + BOOL mIsATI; + BOOL mIsNVIDIA; + BOOL mIsIntel; BOOL mIsGF2or4MX; BOOL mIsGF3; BOOL mIsGFFX; - BOOL mIsATI; BOOL mATIOffsetVerticalLines; - BOOL mIsNVIDIA; - BOOL mIsIntel; - BOOL mHasCubeMap; #if LL_WINDOWS BOOL mHasWGLARBPixelFormat; @@ -220,6 +217,7 @@ public: static void initClass(); static void restoreGL(); + static void resetTextureStates(); static void dumpStates(); static void checkStates(); 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -137,7 +138,7 @@ extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; -// GL_ARB;_vertex_shader +// GL_ARB_vertex_shader extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; @@ -209,6 +210,26 @@ extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB; extern PFNGLCOLORTABLEEXTPROC glColorTableEXT; +//GL_EXT_framebuffer_object +extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; +extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; +extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; +extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; +extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; +extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; +extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; +extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; +extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; +extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; +extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; +extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; +extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; +extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; +extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; +extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; +extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; + + #elif LL_WINDOWS //---------------------------------------------------------------------------- #include @@ -304,7 +325,7 @@ extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB; extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB; extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB; -// GL_ARB;_vertex_shader +// GL_ARB_vertex_shader extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB; extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB; extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB; @@ -371,6 +392,25 @@ extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB; extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB; extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; +//GL_EXT_framebuffer_object +extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; +extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; +extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; +extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; +extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; +extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; +extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; +extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; +extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; +extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; +extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; +extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; +extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; +extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; +extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; +extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; +extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; + #elif LL_DARWIN //---------------------------------------------------------------------------- @@ -384,6 +424,30 @@ extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; #include "GL/glh_extensions.h" +// These symbols don't exist on 10.3.9, so they have to be declared weak. Redeclaring them here fixes the problem. +// 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. +#include + +// GL_EXT_framebuffer_object +extern GLboolean glIsRenderbufferEXT(GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern GLboolean glIsFramebufferEXT(GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glBindFramebufferEXT(GLenum target, GLuint framebuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern GLenum glCheckFramebufferStatusEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + + #ifdef __cplusplus extern "C" { #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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2006-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2004-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2004-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2004-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -34,8 +35,6 @@ // Intended for use via multiple inheritance. // A class may have as many interfaces as it likes, but never needs to inherit one more than once. -#include "llstring.h" - class LLMouseHandler { public: @@ -52,11 +51,15 @@ public: virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) = 0; virtual const LLString& getName() const = 0; + virtual void onMouseCaptureLost() = 0; + // Hack to support LLFocusMgr virtual BOOL isView() = 0; virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0; virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0; + + virtual BOOL hasMouseCapture() = 0; }; #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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -232,6 +233,15 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags) mHideCursorPermanent(FALSE), mFlags(flags) { + for (U32 i = 0; i < 6; i++) + { + mJoyAxis[i] = 0; + } + + for (U32 i = 0; i < 16; i++) + { + mJoyButtonState[i] = 0; + } } // virtual @@ -249,6 +259,24 @@ void LLWindow::decBusyCount() } } +F32 LLWindow::getJoystickAxis(U32 axis) +{ + if (axis < 6) + { + return mJoyAxis[axis]; + } + return 0.f; +} + +U8 LLWindow::getJoystickButton(U32 button) +{ + if (button < 16) + { + return mJoyButtonState[button]; + } + return 0; +} + void LLWindow::setCallbacks(LLWindowCallbacks *callbacks) { 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -200,6 +201,9 @@ public: virtual F32 getNativeAspectRatio() = 0; virtual F32 getPixelAspectRatio() = 0; virtual void setNativeAspectRatio(F32 aspect) = 0; + + F32 getJoystickAxis(U32 axis); + U8 getJoystickButton(U32 button); void setCallbacks(LLWindowCallbacks *callbacks); @@ -238,7 +242,9 @@ protected: ESwapMethod mSwapMethod; BOOL mHideCursorPermanent; U32 mFlags; - + F32 mJoyAxis[6]; + U8 mJoyButtonState[16]; + friend class LLWindowManager; }; 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2006-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2006-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -91,7 +92,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card) if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) { char buffer[1024];/* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */ + snprintf(buffer, sizeof(buffer), "Your video card appears to be a %s, which Second Life does not support.\n" "\n" "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 mFullscreenRefresh = -1; char error[256]; /* Flawfinder: ignore */ - snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */ + snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); OSMessageBox(error, "Error", OSMB_OK); } } 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -205,7 +206,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card) if (!strncasecmp(RENDERER, bad_card, strlen(bad_card))) { char buffer[1024]; /* Flawfinder: ignore */ - snprintf(buffer, sizeof(buffer), /* Flawfinder: ignore */ + snprintf(buffer, sizeof(buffer), "Your video card appears to be a %s, which Second Life does not support.\n" "\n" "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) char path_buffer[PATH_BUFFER_SIZE]; /* Flawfinder: ignore */ // Figure out where our BMP is living on the disk - snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s", /* Flawfinder: ignore */ + snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s", gDirUtilp->getAppRODataDir().c_str(), gDirUtilp->getDirDelimiter().c_str(), gDirUtilp->getDirDelimiter().c_str(), @@ -485,7 +486,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B mFullscreenRefresh = -1; char error[256]; /* Flawfinder: ignore */ - snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */ + snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); OSMessageBox(error, "Error", OSMB_OK); } } @@ -1184,7 +1185,7 @@ x11clipboard_type convert_format(int type) these right now, and support is skeletal. */ char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */ - snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type); /* Flawfinder: ignore */ + snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type); return XInternAtom(gWindowImplementation->mSDL_Display, format, False); } @@ -1871,7 +1872,7 @@ void LLWindowSDL::gatherInput() // the locale to protect it, as exotic/non-C locales // causes our code lots of general critical weirdness // and crashness. (SL-35450) - char *saved_locale = setlocale(LC_ALL, NULL); + std::string saved_locale = setlocale(LC_ALL, NULL); // Do a limited number of pumps so SL doesn't starve! // FIXME - this should ideally be time-limited, not count-limited. @@ -1880,8 +1881,7 @@ void LLWindowSDL::gatherInput() if (gtk_events_pending()) gtk_main_iteration(); - if (saved_locale) - setlocale(LC_ALL, saved_locale); + setlocale(LC_ALL, saved_locale.c_str() ); } #endif // LL_GTK && LL_LIBXUL_ENABLED 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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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 @@ * * Copyright (c) 2001-2007, Linden Research, Inc. * + * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("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, } SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer - mJoyStickState = 0; - mJoyButtonState = 0; } @@ -2815,89 +2814,16 @@ void LLWindowWin32::updateJoystick( ) if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) ) return; // The device should have been acquired during the Poll() - if (js.lX <= -500) - { - if (!(mJoyStickState & 0x1)) - { - gKeyboard->handleTranslatedKeyDown(KEY_PAD_LEFT, 0); - mJoyStickState |= 0x1; - } - } - else - { - if (mJoyStickState & 0x1) - { - gKeyboard->handleTranslatedKeyUp(KEY_PAD_LEFT, 0); - mJoyStickState &= ~0x1; - } - } - if (js.lX >= 500) - { - if (!(mJoyStickState & 0x2)) - { - gKeyboard->handleTranslatedKeyDown(KEY_PAD_RIGHT, 0); - mJoyStickState |= 0x2; - } - } - else - { - if (mJoyStickState & 0x2) - { - gKeyboard->handleTranslatedKeyUp(KEY_PAD_RIGHT, 0); - mJoyStickState &= ~0x2; - } - } - if (js.lY <= -500) - { - if (!(mJoyStickState & 0x4)) - { - gKeyboard->handleTranslatedKeyDown(KEY_PAD_UP, 0); - mJoyStickState |= 0x4; - } - } - else - { - if (mJoyStickState & 0x4) - { - gKeyboard->handleTranslatedKeyUp(KEY_PAD_UP, 0); - mJoyStickState &= ~0x4; - } - } - if (js.lY >= 500) - { - if (!(mJoyStickState & 0x8)) - { - gKeyboard->handleTranslatedKeyDown(KEY_PAD_DOWN, 0); - mJoyStickState |= 0x8; - } - } - else - { - if (mJoyStickState & 0x8) - { - gKeyboard->handleTranslatedKeyUp(KEY_PAD_DOWN, 0); - mJoyStickState &= ~0x8; - } - } + mJoyAxis[0] = js.lX/1000.f; + mJoyAxis[1] = js.lY/1000.f; + mJoyAxis[2] = js.lZ/1000.f; + mJoyAxis[3] = js.lRx/1000.f; + mJoyAxis[4] = js.lRy/1000.f; + mJoyAxis[5] = js.lRz/1000.f; - for( int i = 0; i < 15; i++ ) + for (U32 i = 0; i < 16; i++) { - if ( js.rgbButtons[i] & 0x80 ) - { - if (!(mJoyButtonState & (1<handleTranslatedKeyDown(KEY_BUTTON1+i, 0); - mJoyButtonState |= (1<handleTranslatedKeyUp(KEY_BUTTON1+i, 0); - mJoyButtonState &= ~(1<