Capture visual info into a structure before rendering
[mercenary-reloaded.git] / src / libsdl / opengl.c
index 6d72ed2..e10ef5f 100644 (file)
@@ -266,29 +266,17 @@ void opengl_blit_benson(uint8_t *rgb, int filter, int benson_at_line, double fov
        glDisable(GL_TEXTURE_2D);
 }
 
-static double transparency;
-
-/* start rendering scene */
-void opengl_transparency_set(double _transparency)
+/* set color and opacity */
+void opengl_render_color(double r, double g, double b, double a)
 {
-       if (transparency)
-               glDisable(GL_BLEND);
-
-       transparency = _transparency;
-
-       /* for debugging use transparent rendering */
-       if (transparency) {
+       if (a < 1.0) {
                glEnable(GL_BLEND);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       }
-}
-
-void opengl_render_color(double r, double g, double b)
-{
-       if (transparency)
-               glColor4d(r, g, b, 1.0 - transparency);
-       else
+               glColor4d(r, g, b, a);
+       } else {
+               glDisable(GL_BLEND);
                glColor3d(r, g, b);
+       }
 }
 
 /* render polygon */