Several gl calls now wrapped via LLRender (gGL) as prep for future changes:

glMatrixMode -> gGL.matrixMode
..GL_MODELVIEW -> LLRender::MM_MODELVIEW
..GL_POJECTION -> LLRender::MM_PROJECTION
..GL_TEXTURE -> LLRender::MM_TEXTURE
glMultMatrix -> gGL.multMatrix
glLoadMatrixf -> gGL.loadMatrix
glPushMatrix -> gGL.pushMatrix
glPopMatrix -> gGL.popMatrix
glLoadIdentity -> gGL.loadIdentity
glRotatef -> gGL.rotatef
glTransformf -> gGL.transformf
glOrtho -> gGL.ortho
glColor3f -> gGL.diffuseColor3f
glColor3fv -> gGL.diffuseColor3fv
glColor4f -> gGL.diffuseColor4f
glColor4fv -> gGL.diffuseColor4fv
glColor4ubv -> gGL.diffuseColor4ubv
glLightModelfv(GL_LIGHT_MODEL_AMBIENT -> gGL.
This commit is contained in:
Shyotl
2011-11-21 15:55:44 -06:00
parent 1cf367aae5
commit 83e8a9076b
63 changed files with 1266 additions and 1134 deletions

View File

@@ -562,10 +562,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
// Note that these are not the same as GL defaults...
stop_glerror();
F32 one[4] = {1.f, 1.f, 1.f, 1.f};
glLightModelfv (GL_LIGHT_MODEL_AMBIENT,one);
gGL.setAmbientLightColor(LLColor4::white);
stop_glerror();
/////////////////////////////////////
//
// Render
@@ -727,10 +726,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
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();
@@ -840,24 +839,24 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
//// 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->getScreenRect();
// LLRect floater_rect = frontmost_floaterp->calcScreenRect();
// // deflate by one pixel so rounding errors don't occlude outside of floater extents
// floater_rect.stretch(-1);
// LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidth(),
// (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeight(),
// (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(),
// (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight());
// LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidthScaled(),
// (F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeightScaled(),
// (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);
// {
@@ -869,7 +868,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
// gGL.end();
// glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// }
// glPopMatrix();
// gGL.popMatrix();
//}
LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
@@ -1004,10 +1003,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
void render_hud_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();
@@ -1096,10 +1095,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);
@@ -1182,12 +1181,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;
}
@@ -1199,8 +1198,8 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling)
if (!gSnapshot)
{
glPushMatrix();
glLoadMatrixf(gGLLastModelView);
gGL.pushMatrix();
gGL.loadMatrix(gGLLastModelView);
glh_set_current_modelview(glh_copy_matrix(gGLLastModelView));
}
@@ -1263,7 +1262,7 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling)
if (!gSnapshot)
{
glh_set_current_modelview(saved_view);
glPopMatrix();
gGL.popMatrix();
}
if (gDisplaySwapBuffers)
@@ -1336,10 +1335,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()
@@ -1409,10 +1408,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();
@@ -1479,20 +1478,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();
}