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:
@@ -279,10 +279,10 @@ void LLCubeMap::setMatrix(S32 stage)
|
||||
LLMatrix4 trans(mat3);
|
||||
trans.transpose();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf((F32 *)trans.mMatrix);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix((F32 *)trans.mMatrix);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
/*if (stage > 0)
|
||||
{
|
||||
@@ -298,9 +298,9 @@ void LLCubeMap::restoreMatrix()
|
||||
{
|
||||
gGL.getTexUnit(mMatrixStage)->activate();
|
||||
}
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
/*if (mMatrixStage > 0)
|
||||
{
|
||||
|
||||
@@ -423,7 +423,7 @@ S32 LLFontGL::render(const LLWString &wstr,
|
||||
}
|
||||
|
||||
gGL.pushMatrix();
|
||||
glLoadIdentity();
|
||||
gGL.loadIdentity();
|
||||
gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
|
||||
|
||||
// this code snaps the text origin to a pixel grid to start with
|
||||
@@ -562,9 +562,9 @@ S32 LLFontGL::render(const LLWString &wstr,
|
||||
if (!label.empty())
|
||||
{
|
||||
gGL.pushMatrix();
|
||||
//glLoadIdentity();
|
||||
//gGL.loadIdentity();
|
||||
//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
|
||||
//glScalef(sScaleX, sScaleY, 1.f);
|
||||
//gGL.scalef(sScaleX, sScaleY, 1.f);
|
||||
getFontExtChar()->render(label, 0,
|
||||
/*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX),
|
||||
/*llfloor*/(cur_y / sScaleY),
|
||||
@@ -672,9 +672,9 @@ S32 LLFontGL::render(const LLWString &wstr,
|
||||
// recursively render ellipses at end of string
|
||||
// we've already reserved enough room
|
||||
gGL.pushMatrix();
|
||||
//glLoadIdentity();
|
||||
//gGL.loadIdentity();
|
||||
//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
|
||||
//glScalef(sScaleX, sScaleY, 1.f);
|
||||
//gGL.scalef(sScaleX, sScaleY, 1.f);
|
||||
renderUTF8(std::string("..."),
|
||||
0,
|
||||
cur_x / sScaleX, (F32)y,
|
||||
|
||||
@@ -2038,20 +2038,20 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
|
||||
glh::matrix4f suffix;
|
||||
suffix.set_row(2, cplane);
|
||||
glh::matrix4f newP = suffix * P;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(newP.m);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(newP.m);
|
||||
gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
LLGLUserClipPlane::~LLGLUserClipPlane()
|
||||
{
|
||||
if (mApply)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2240,16 +2240,16 @@ LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P, U32 layer)
|
||||
P.element(2, i) = P.element(3, i) * depth;
|
||||
}
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(P.m);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(P.m);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
LLGLSquashToFarClip::~LLGLSquashToFarClip()
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
|
||||
@@ -532,21 +532,21 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT
|
||||
|
||||
void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.f, (GLdouble) width, 0.f, (GLdouble) height, -1.f, 1.f );
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
gGL.ortho( 0.f, (GLdouble) width, 0.f, (GLdouble) height, -1.f, 1.f );
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
}
|
||||
|
||||
void LLPostProcess::viewPerspective(void)
|
||||
{
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPopMatrix();
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glPopMatrix();
|
||||
gGL.matrixMode( LLRender::MM_PROJECTION );
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode( LLRender::MM_MODELVIEW );
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
||||
void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height)
|
||||
|
||||
@@ -1027,6 +1027,15 @@ void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
||||
glScalef(x,y,z);
|
||||
}
|
||||
|
||||
void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar)
|
||||
{
|
||||
glOrtho(left, right, bottom, top, zNear, zFar);
|
||||
}
|
||||
|
||||
void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
||||
{
|
||||
glRotatef(a,x,y,z);
|
||||
}
|
||||
void LLRender::pushMatrix()
|
||||
{
|
||||
flush();
|
||||
@@ -1039,6 +1048,38 @@ void LLRender::popMatrix()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void LLRender::loadMatrix(const GLfloat* m)
|
||||
{
|
||||
glLoadMatrixf(m);
|
||||
}
|
||||
|
||||
|
||||
void LLRender::multMatrix(const GLfloat* m)
|
||||
{
|
||||
glMultMatrixf(m);
|
||||
}
|
||||
|
||||
void LLRender::matrixMode(U32 mode)
|
||||
{
|
||||
static GLenum modes[] =
|
||||
{
|
||||
GL_MODELVIEW,
|
||||
GL_PROJECTION,
|
||||
GL_TEXTURE,
|
||||
GL_TEXTURE,
|
||||
GL_TEXTURE,
|
||||
GL_TEXTURE,
|
||||
GL_TEXTURE,
|
||||
GL_TEXTURE,
|
||||
};
|
||||
glMatrixMode(modes[mode]);
|
||||
}
|
||||
|
||||
void LLRender::loadIdentity()
|
||||
{
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||
{
|
||||
setColorMask(writeColor, writeColor, writeColor, writeAlpha);
|
||||
@@ -1209,6 +1250,11 @@ LLLightState* LLRender::getLight(U32 index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LLRender::setAmbientLightColor(const LLColor4& color)
|
||||
{
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,color.mV);
|
||||
}
|
||||
|
||||
bool LLRender::verifyTexUnitActive(U32 unitToVerify)
|
||||
{
|
||||
if (mCurrTextureUnitIndex == unitToVerify)
|
||||
@@ -1506,6 +1552,31 @@ void LLRender::color3fv(const GLfloat* c)
|
||||
color4f(c[0],c[1],c[2],1);
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
|
||||
{
|
||||
glColor3f(r,g,b);
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor3fv(const F32* c)
|
||||
{
|
||||
glColor3fv(c);
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
|
||||
{
|
||||
glColor4f(r,g,b,a);
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor4fv(const F32* c)
|
||||
{
|
||||
glColor4fv(c);
|
||||
}
|
||||
|
||||
void LLRender::diffuseColor4ubv(const U8* c)
|
||||
{
|
||||
glColor4ubv(c);
|
||||
}
|
||||
|
||||
void LLRender::debugTexUnits(void)
|
||||
{
|
||||
LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL;
|
||||
|
||||
@@ -312,6 +312,18 @@ public:
|
||||
BF_UNDEF
|
||||
} eBlendFactor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MM_MODELVIEW = 0,
|
||||
MM_PROJECTION,
|
||||
MM_TEXTURE0,
|
||||
MM_TEXTURE1,
|
||||
MM_TEXTURE2,
|
||||
MM_TEXTURE3,
|
||||
NUM_MATRIX_MODES,
|
||||
MM_TEXTURE
|
||||
} eMatrixMode;
|
||||
|
||||
LLRender();
|
||||
~LLRender();
|
||||
void init() ;
|
||||
@@ -323,8 +335,15 @@ public:
|
||||
|
||||
void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar);
|
||||
|
||||
void pushMatrix();
|
||||
void popMatrix();
|
||||
void loadMatrix(const GLfloat* m);
|
||||
void loadIdentity();
|
||||
void multMatrix(const GLfloat* m);
|
||||
void matrixMode(U32 mode);
|
||||
|
||||
void flush();
|
||||
|
||||
@@ -347,9 +366,16 @@ public:
|
||||
void color3fv(const GLfloat* c);
|
||||
void color4ubv(const GLubyte* c);
|
||||
|
||||
void diffuseColor3f(F32 r, F32 g, F32 b);
|
||||
void diffuseColor3fv(const F32* c);
|
||||
void diffuseColor4f(F32 r, F32 g, F32 b, F32 a);
|
||||
void diffuseColor4fv(const F32* c);
|
||||
void diffuseColor4ubv(const U8* c);
|
||||
|
||||
void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
|
||||
|
||||
void setColorMask(bool writeColor, bool writeAlpha);
|
||||
void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha);
|
||||
void setSceneBlendType(eBlendType type);
|
||||
@@ -363,6 +389,7 @@ public:
|
||||
eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor);
|
||||
|
||||
LLLightState* getLight(U32 index);
|
||||
void setAmbientLightColor(const LLColor4& color);
|
||||
|
||||
LLTexUnit* getTexUnit(U32 index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user