diff --git a/miniwin/src/d3drm/backends/opengl1/actual.cpp b/miniwin/src/d3drm/backends/opengl1/actual.cpp index bf9c7504..34ef18ba 100644 --- a/miniwin/src/d3drm/backends/opengl1/actual.cpp +++ b/miniwin/src/d3drm/backends/opengl1/actual.cpp @@ -124,15 +124,15 @@ void GL11_BeginFrame(const Matrix4x4* projection) glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); +#ifndef __PSP__ // Disable all lights and reset global ambient for (int i = 0; i < 8; ++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); +#endif // Projection and view glMatrixMode(GL_PROJECTION); @@ -145,7 +145,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l) { // Setup light glMatrixMode(GL_MODELVIEW); - glPushMatrix(); glLoadIdentity(); GLenum lightId = GL_LIGHT0 + lightIdx++; const FColor& c = l->color; @@ -188,8 +187,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l) glLightfv(lightId, GL_POSITION, pos); } glEnable(lightId); - - glPopMatrix(); } void GL11_EnableTransparency() @@ -212,6 +209,7 @@ void GL11_SubmitDraw( glEnable(GL_NORMALIZE); #ifndef __PSP__ + glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glColor4ub(appearance.color.r, appearance.color.g, appearance.color.b, appearance.color.a); #else @@ -283,8 +281,6 @@ void GL11_SubmitDraw( glDrawElements(GL_TRIANGLES, static_cast(mesh.indices.size()), GL_UNSIGNED_SHORT, mesh.indices.data()); } - - glPopMatrix(); } void GL11_Resize(int width, int height) @@ -314,13 +310,11 @@ void GL11_Draw2DImage( glDepthMask(GL_FALSE); glMatrixMode(GL_PROJECTION); - glPushMatrix(); glLoadIdentity(); glOrtho(left, right, bottom, top, -1, 1); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); glLoadIdentity(); glDisable(GL_LIGHTING); @@ -354,9 +348,7 @@ void GL11_Draw2DImage( // Restore state glMatrixMode(GL_MODELVIEW); - glPopMatrix(); glMatrixMode(GL_PROJECTION); - glPopMatrix(); } void GL11_Download(SDL_Surface* target)