From 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 14 Sep 2011 16:30:45 -0500 Subject: SH-2243 work in progress -- application side matrix stack management --- indra/newview/llglsandbox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index fa3f546157..8c872283bd 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -115,7 +115,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 center_y = (top + bottom) / 2; // save drawing mode - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance"); @@ -230,9 +230,9 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) } // restore drawing mode - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); // restore camera LLViewerCamera::getInstance()->setFar(old_far_plane); -- cgit v1.2.3 From a90ea46804d1fdb60d44178140b12e341c715178 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 15:34:28 -0500 Subject: SH-2240 Fix for beacons not rendering (or crashing when rendered) --- indra/newview/llglsandbox.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 8c872283bd..844d7ba41c 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -777,6 +777,11 @@ void LLViewerObjectList::renderObjectBeacons() LLGLSUIDefault gls_ui; + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -- cgit v1.2.3 From f2fc69c65650bf5db4f0ea098be7bd5fe37f224d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 17:31:59 -0500 Subject: SH-2240 Fix for crash when rendering beacons and Debug GL enabled -- flush every 128 beacons to keep from hitting the end of the immediate mode wrapper buffer. --- indra/newview/llglsandbox.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 844d7ba41c..3f773effcb 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -789,6 +789,8 @@ void LLViewerObjectList::renderObjectBeacons() // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) BOOL flush = FALSE; + S32 flush_me = 128; + for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -818,6 +820,14 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); + + if (--flush_me <= 0) + { + flush_me = 128; + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINES); + } } gGL.end(); } @@ -830,6 +840,8 @@ void LLViewerObjectList::renderObjectBeacons() // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) BOOL flush = FALSE; + S32 flush_me = 128; + for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -858,6 +870,14 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); + + if (--flush_me <= 0) + { + flush_me = 128; + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINES); + } } gGL.end(); -- cgit v1.2.3 From c834bdd05a134d6b3442a31f351a94f21965d4e9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Oct 2011 17:54:06 -0500 Subject: SH-2240 Better fix for beacon rendering -- let LLRender take care of optimization around joining chunks of line segments together into one draw call --- indra/newview/llglsandbox.cpp | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'indra/newview/llglsandbox.cpp') diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 3f773effcb..ac87da2d71 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -788,9 +788,6 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - BOOL flush = FALSE; - S32 flush_me = 128; - for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -799,18 +796,14 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (flush) - { - gGL.end(); - } - flush = TRUE; gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; + + gGL.begin(LLRender::LINES); gGL.color4fv(color.mV); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f); @@ -820,16 +813,9 @@ void LLViewerObjectList::renderObjectBeacons() gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]); draw_line_cube(0.10f, thisline); - - if (--flush_me <= 0) - { - flush_me = 128; - gGL.end(); - gGL.flush(); - gGL.begin(LLRender::LINES); - } + + gGL.end(); } - gGL.end(); } { @@ -839,9 +825,6 @@ void LLViewerObjectList::renderObjectBeacons() S32 last_line_width = -1; // gGL.begin(LLRender::LINES); // Always happens in (line_width != last_line_width) - BOOL flush = FALSE; - S32 flush_me = 128; - for (std::vector::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter) { const LLDebugBeacon &debug_beacon = *iter; @@ -849,18 +832,13 @@ void LLViewerObjectList::renderObjectBeacons() S32 line_width = debug_beacon.mLineWidth; if (line_width != last_line_width) { - if (flush) - { - gGL.end(); - } - flush = TRUE; gGL.flush(); glLineWidth( (F32)line_width ); last_line_width = line_width; - gGL.begin(LLRender::LINES); } const LLVector3 &thisline = debug_beacon.mPositionAgent; + gGL.begin(LLRender::LINES); gGL.color4fv(debug_beacon.mColor.mV); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f); gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f); @@ -871,16 +849,9 @@ void LLViewerObjectList::renderObjectBeacons() draw_line_cube(0.10f, thisline); - if (--flush_me <= 0) - { - flush_me = 128; - gGL.end(); - gGL.flush(); - gGL.begin(LLRender::LINES); - } + gGL.end(); } - gGL.end(); gGL.flush(); glLineWidth(1.f); -- cgit v1.2.3