mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-20 06:01:16 +00:00
Stip out more unnecessary OpenGL calls (#476)
This commit is contained in:
parent
55c13cd140
commit
4c0035fa74
@ -130,8 +130,7 @@ void GL11_BeginFrame(const Matrix4x4* projection)
|
|||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
glDisable(GL_LIGHT0 + i);
|
glDisable(GL_LIGHT0 + i);
|
||||||
}
|
}
|
||||||
const GLfloat zeroAmbient[4] = {0.f, 0.f, 0.f, 1.f};
|
|
||||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, zeroAmbient);
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
||||||
|
|
||||||
// Projection and view
|
// Projection and view
|
||||||
@ -145,7 +144,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l)
|
|||||||
{
|
{
|
||||||
// Setup light
|
// Setup light
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GLenum lightId = GL_LIGHT0 + lightIdx++;
|
GLenum lightId = GL_LIGHT0 + lightIdx++;
|
||||||
const FColor& c = l->color;
|
const FColor& c = l->color;
|
||||||
@ -188,8 +186,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l)
|
|||||||
glLightfv(lightId, GL_POSITION, pos);
|
glLightfv(lightId, GL_POSITION, pos);
|
||||||
}
|
}
|
||||||
glEnable(lightId);
|
glEnable(lightId);
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL11_EnableTransparency()
|
void GL11_EnableTransparency()
|
||||||
@ -273,8 +269,6 @@ void GL11_SubmitDraw(
|
|||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mesh.indices.size()), GL_UNSIGNED_SHORT, mesh.indices.data());
|
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mesh.indices.size()), GL_UNSIGNED_SHORT, mesh.indices.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL11_Resize(int width, int height)
|
void GL11_Resize(int width, int height)
|
||||||
@ -304,13 +298,11 @@ void GL11_Draw2DImage(
|
|||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glOrtho(left, right, bottom, top, -1, 1);
|
glOrtho(left, right, bottom, top, -1, 1);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
@ -344,9 +336,7 @@ void GL11_Draw2DImage(
|
|||||||
|
|
||||||
// Restore state
|
// Restore state
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL11_Download(SDL_Surface* target)
|
void GL11_Download(SDL_Surface* target)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user