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:
@@ -1558,10 +1558,8 @@ void LLViewerWindow::initGLDefaults()
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
F32 ambient[4] = {0.f,0.f,0.f,0.f };
|
||||
F32 diffuse[4] = {1.f,1.f,1.f,1.f };
|
||||
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,ambient);
|
||||
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,diffuse);
|
||||
glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,LLColor4::black.mV);
|
||||
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,LLColor4::white.mV);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT,1);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||
@@ -1571,7 +1569,7 @@ void LLViewerWindow::initGLDefaults()
|
||||
// lights for objects
|
||||
glShadeModel( GL_SMOOTH );
|
||||
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
|
||||
gGL.setAmbientLightColor(LLColor4::black);
|
||||
|
||||
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
|
||||
|
||||
@@ -2234,7 +2232,7 @@ void LLViewerWindow::drawDebugText()
|
||||
gGL.pushMatrix();
|
||||
{
|
||||
// scale view by UI global scale factor and aspect ratio correction factor
|
||||
glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
gGL.scalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
mDebugText->draw();
|
||||
}
|
||||
gGL.popMatrix();
|
||||
@@ -2253,9 +2251,9 @@ void LLViewerWindow::draw()
|
||||
|
||||
LLUI::setLineWidth(1.f);
|
||||
// Reset any left-over transforms
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
glLoadIdentity();
|
||||
gGL.loadIdentity();
|
||||
|
||||
//S32 screen_x, screen_y;
|
||||
|
||||
@@ -2266,7 +2264,7 @@ void LLViewerWindow::draw()
|
||||
// draw timecode block
|
||||
std::string text;
|
||||
|
||||
glLoadIdentity();
|
||||
gGL.loadIdentity();
|
||||
|
||||
microsecondsToTimecodeString(gFrameTime,text);
|
||||
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
|
||||
@@ -2286,8 +2284,9 @@ void LLViewerWindow::draw()
|
||||
}
|
||||
gGL.pushMatrix();
|
||||
{
|
||||
|
||||
// scale view by UI global scale factor and aspect ratio correction factor
|
||||
glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
gGL.scalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
|
||||
LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
|
||||
// apply camera zoom transform (for high res screenshots)
|
||||
@@ -2299,10 +2298,10 @@ void LLViewerWindow::draw()
|
||||
int pos_y = sub_region / llceil(zoom_factor);
|
||||
int pos_x = sub_region - (pos_y*llceil(zoom_factor));
|
||||
// offset for this tile
|
||||
glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x,
|
||||
gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x,
|
||||
(F32)getWindowHeightScaled() * -(F32)pos_y,
|
||||
0.f);
|
||||
glScalef(zoom_factor, zoom_factor, 1.f);
|
||||
gGL.scalef(zoom_factor, zoom_factor, 1.f);
|
||||
LLUI::sGLScaleFactor *= zoom_factor;
|
||||
}
|
||||
|
||||
@@ -2326,7 +2325,7 @@ void LLViewerWindow::draw()
|
||||
S32 screen_x, screen_y;
|
||||
top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
|
||||
top_ctrl->draw();
|
||||
@@ -2338,7 +2337,7 @@ void LLViewerWindow::draw()
|
||||
// of the screen.
|
||||
if( mToolTip && mToolTip->getVisible() && !mToolTipBlocked )
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
{
|
||||
S32 tip_height = mToolTip->getRect().getHeight();
|
||||
@@ -3241,17 +3240,17 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
|
||||
LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
|
||||
|
||||
// set up transform to encompass bounding box of HUD
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
|
||||
glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
|
||||
gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
|
||||
glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
|
||||
gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
|
||||
}
|
||||
|
||||
// Render light for editing
|
||||
@@ -3261,12 +3260,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
|
||||
LLGLEnable gls_blend(GL_BLEND);
|
||||
LLGLEnable gls_cull(GL_CULL_FACE);
|
||||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
if (selection->getSelectType() == SELECT_TYPE_HUD)
|
||||
{
|
||||
F32 zoom = gAgentCamera.mHUDCurZoom;
|
||||
glScalef(zoom, zoom, zoom);
|
||||
gGL.scalef(zoom, zoom, zoom);
|
||||
}
|
||||
|
||||
struct f : public LLSelectedObjectFunctor
|
||||
@@ -3277,15 +3276,15 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
|
||||
if (drawable && drawable->isLight())
|
||||
{
|
||||
LLVOVolume* vovolume = drawable->getVOVolume();
|
||||
glPushMatrix();
|
||||
gGL.pushMatrix();
|
||||
|
||||
LLVector3 center = drawable->getPositionAgent();
|
||||
glTranslatef(center[0], center[1], center[2]);
|
||||
gGL.translatef(center[0], center[1], center[2]);
|
||||
F32 scale = vovolume->getLightRadius();
|
||||
glScalef(scale, scale, scale);
|
||||
gGL.scalef(scale, scale, scale);
|
||||
|
||||
LLColor4 color(vovolume->getLightColor(), .5f);
|
||||
glColor4fv(color.mV);
|
||||
gGL.color4fv(color.mV);
|
||||
|
||||
F32 pixel_area = 100000.f;
|
||||
// Render Outside
|
||||
@@ -3296,14 +3295,14 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
|
||||
gSphere.render(pixel_area);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
glPopMatrix();
|
||||
gGL.popMatrix();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} func;
|
||||
LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
|
||||
|
||||
glPopMatrix();
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
||||
// NOTE: The average position for the axis arrows of the selected objects should
|
||||
@@ -3376,11 +3375,11 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
|
||||
}
|
||||
if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.popMatrix();
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user