ecere/gfx/OpenGL: (OpenGL ES) Support for glColor4f() with lighting enabled
authorJerome St-Louis <jerome@ecere.com>
Mon, 18 Apr 2016 09:52:22 +0000 (05:52 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 21:35:36 +0000 (17:35 -0400)
- Color material emulation

ecere/src/gfx/drivers/OpenGLDisplayDriver.ec
ecere/src/gfx/drivers/gl3/immediate.ec

index 8832662..800f61e 100644 (file)
@@ -492,8 +492,11 @@ public void GLSetupFog(bool enable)
 #endif
 }
 
+bool lightingEnabled;
+
 public void GLSetupLighting(bool enable)
 {
+   lightingEnabled = enable;
 #if defined(SHADERS)
    shader_lighting(enable);
 #else
index 59be4f4..b6933d7 100644 (file)
@@ -321,6 +321,12 @@ public void glimtkColor4f(float r, float g, float b, float a)
       shader_color(r, g, b, a);
 #else
       glColor4f(r, g, b, a);
+      if(lightingEnabled)
+      {
+         float color[4] = { r, g, b, a };
+         glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
+         glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
+      }
 #endif
    }
 }