diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-14 16:30:45 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-14 16:30:45 -0500 |
commit | 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 (patch) | |
tree | 1bab2f431bd1df1e9f6f7058cad8d64119ec3bd3 /indra/newview/llviewerdisplay.cpp | |
parent | c0ca2c62fd6b9a90542907ce46bf1fe0ab379e13 (diff) |
SH-2243 work in progress -- application side matrix stack management
Diffstat (limited to 'indra/newview/llviewerdisplay.cpp')
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index c8fe6f8997..5f4156732e 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -701,10 +701,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glh_set_current_projection(proj); glh_set_current_modelview(mod); - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(proj.m); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(mod.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadMatrix(proj.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(mod.m); gViewerWindow->setup3DViewport(); LLGLState::checkStates(); @@ -813,13 +813,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //// assumes frontmost floater with focus is opaque //if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp)) //{ - // glMatrixMode(GL_MODELVIEW); - // glPushMatrix(); + // gGL.matrixMode(LLRender::MM_MODELVIEW); + // gGL.pushMatrix(); // { // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - // glLoadIdentity(); + // gGL.loadIdentity(); // LLRect floater_rect = frontmost_floaterp->calcScreenRect(); // // deflate by one pixel so rounding errors don't occlude outside of floater extents @@ -829,8 +829,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(), // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled()); // floater_3d_rect.translate(-0.5f, -0.5f); - // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); - // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); + // gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); + // gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); // gGL.color4fv(LLColor4::white.mV); // gGL.begin(LLVertexBuffer::QUADS); // { @@ -842,7 +842,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // gGL.end(); // glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // } - // glPopMatrix(); + // gGL.popMatrix(); //} LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; @@ -979,10 +979,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) void render_hud_attachments() { LLMemType mt_ra(LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); glh::matrix4f current_proj = glh_get_current_projection(); glh::matrix4f current_mod = glh_get_current_modelview(); @@ -1068,10 +1068,10 @@ void render_hud_attachments() } LLPipeline::sUseOcclusion = use_occlusion; } - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); glh_set_current_projection(current_proj); glh_set_current_modelview(current_mod); @@ -1154,12 +1154,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region) if (!result) return result; // set up transform to keep HUD objects in front of camera - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(proj.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadMatrix(proj.m); glh_set_current_projection(proj); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(model.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(model.m); glh_set_current_modelview(model); return TRUE; } @@ -1175,8 +1175,8 @@ void render_ui(F32 zoom_factor, int subfield) if (!gSnapshot) { - glPushMatrix(); - glLoadMatrixd(gGLLastModelView); + gGL.pushMatrix(); + gGL.loadMatrix(gGLLastModelView); glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); } @@ -1232,7 +1232,7 @@ void render_ui(F32 zoom_factor, int subfield) if (!gSnapshot) { glh_set_current_modelview(saved_view); - glPopMatrix(); + gGL.popMatrix(); } if (gDisplaySwapBuffers) @@ -1305,10 +1305,10 @@ void draw_axes() gGL.vertex3f(0.0f, 0.0f, 40.0f); gGL.end(); // Some coordinate axes - glPushMatrix(); - glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] ); + gGL.pushMatrix(); + gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] ); renderCoordinateAxes(); - glPopMatrix(); + gGL.popMatrix(); } void render_ui_3d() @@ -1378,10 +1378,10 @@ void render_ui_2d() gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); - glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); - glTranslatef((F32)half_width, (F32)half_height, 0.f); + gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); + gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom,zoom,1.f); + gGL.scalef(zoom,zoom,1.f); gGL.color4fv(LLColor4::white.mV); gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE); gGL.popMatrix(); @@ -1518,20 +1518,20 @@ void render_disconnected_background() { LLGLSUIDefault gls_ui; gViewerWindow->setup2DRender(); - glPushMatrix(); + gGL.pushMatrix(); { // scale ui to reflect UIScaleFactor // this can't be done in setup2DRender because it requires a // pushMatrix/popMatrix pair const LLVector2& display_scale = gViewerWindow->getDisplayScale(); - glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); + gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); gGL.getTexUnit(0)->bind(gDisconnectedImagep); gGL.color4f(1.f, 1.f, 1.f, 1.f); gl_rect_2d_simple_tex(width, height); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } - glPopMatrix(); + gGL.popMatrix(); } gGL.flush(); |