diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 2c4bb6b28bec214c1186a4de2c0baa602fe65653..58272ec12e0d5fef433dccd623b46c680c6975b3 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -54,7 +54,7 @@ extern void APIENTRY gl_debug_callback(GLenum source, ; #endif -thread_local LLRender gGL; +thread_local LLRender gGL = LLRender(); // Handy copies of last good GL matrices LLMatrix4a gGLModelView; @@ -66,7 +66,7 @@ LLMatrix4a gGLProjection; LLMatrix4a gGLDeltaModelView; LLMatrix4a gGLInverseDeltaModelView; -S32 gGLViewport[4]; +S32 gGLViewport[4] = {}; U32 LLRender::sUICalls = 0; @@ -120,6 +120,21 @@ static const GLenum sGLBlendFactor[] = GL_ZERO // 'BF_UNDEF' }; +void init_gl_globals() +{ + gGLManager = LLGLManager(); + gGL = LLRender(); + + gGLModelView.setIdentity(); + gGLLastModelView.setIdentity(); + gGLLastProjection.setIdentity(); + gGLProjection.setIdentity(); + + // transform from last frame's camera space to this frame's camera space (and inverse) + gGLDeltaModelView.setIdentity(); + gGLInverseDeltaModelView.setIdentity(); +} + LLTexUnit::LLTexUnit(S32 index) : mCurrTexType(TT_NONE), mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7c108228e45382b4856ec06b0d7498e484777423..5400cb3cc1010fe6cb97d9142d6ca8dde6d8c4d7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3028,10 +3028,14 @@ void LLAppViewer::initStrings() } } +extern void init_gl_globals(); + bool LLAppViewer::initWindow() { LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL; + init_gl_globals(); + // store setting in a global for easy access and modification gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");