Commits

Alex Szpakowski  committed bd1d0e8

Removed love.graphics.setColorMode
- The "replace" color mode can easily be duplicated with love.graphics.setColor(255, 255, 255)
- The current color mode has no effect when a shader is active
- Color mode functionality can easily be replicated with shaders
- OpenGL ES 2 (iOS, Android, etc) does not have the functions used by love.graphics.setColorMode

  • Participants
  • Parent commits 9dc7d74

Comments (0)

Files changed (4)

File src/modules/graphics/opengl/Graphics.cpp

 	s.backgroundColor = getBackgroundColor();
 
 	s.blendMode = getBlendMode();
-	s.colorMode = getColorMode();
 	//get line style
 	s.lineStyle = lineStyle;
 	//get the point size
 	setColor(s.color);
 	setBackgroundColor(s.backgroundColor);
 	setBlendMode(s.blendMode);
-	setColorMode(s.colorMode);
 	setLine(lineWidth, s.lineStyle);
 	setPoint(s.pointSize, s.pointStyle);
 	if (s.scissor)
 	}
 }
 
-void Graphics::setColorMode(Graphics::ColorMode mode)
-{
-	if (mode == COLOR_MODULATE)
-		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-	else if (mode == COLOR_COMBINE)
-	{
-		glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD_SIGNED);
-		glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
-		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
-	}
-	else // mode = COLOR_REPLACE
-		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
 Graphics::BlendMode Graphics::getBlendMode() const
 {
 	const int gl_1_4 = GLEE_VERSION_1_4;
 	throw Exception("Unknown blend mode");
 }
 
-Graphics::ColorMode Graphics::getColorMode() const
-{
-	GLint mode;
-	glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &mode);
-
-	if (mode == GL_MODULATE)
-		return COLOR_MODULATE;
-	else if (mode == GL_COMBINE)
-		return COLOR_COMBINE;
-	else // mode == GL_REPLACE
-		return COLOR_REPLACE;
-}
-
 void Graphics::setDefaultImageFilter(const Image::Filter &f)
 {
 	Image::setDefaultFilter(f);

File src/modules/graphics/opengl/Graphics.h

 	Color color;
 	Color backgroundColor;
 
-	// Blend and color modes.
+	// Blend mode.
 	Graphics::BlendMode blendMode;
-	Graphics::ColorMode colorMode;
 
 	// Line.
 	Graphics::LineStyle lineStyle;
 		backgroundColor.b = 0;
 		backgroundColor.a = 255;
 		blendMode = Graphics::BLEND_ALPHA;
-		colorMode = Graphics::COLOR_MODULATE;
 		lineStyle = Graphics::LINE_SMOOTH;
 		pointSize = 1.0f;
 		pointStyle = Graphics::POINT_SMOOTH;
 	void setBlendMode(BlendMode mode);
 
 	/**
-	 * Sets the current color mode.
-	 **/
-	void setColorMode(ColorMode mode);
-
-	/**
 	 * Sets the current image filter.
 	 **/
 	void setDefaultImageFilter(const Image::Filter &f);
 	BlendMode getBlendMode() const;
 
 	/**
-	 * Gets the current color mode.
-	 **/
-	ColorMode getColorMode() const;
-
-	/**
 	 * Gets the current image filter.
 	 **/
 	const Image::Filter &getDefaultImageFilter() const;

File src/modules/graphics/opengl/wrap_Graphics.cpp

 	return 0;
 }
 
-int w_setColorMode(lua_State *L)
-{
-	Graphics::ColorMode mode;
-	const char *str = luaL_checkstring(L, 1);
-	if (!Graphics::getConstant(str, mode))
-		return luaL_error(L, "Invalid color mode: %s", str);
-
-	instance->setColorMode(mode);
-	return 0;
-}
-
 int w_setDefaultImageFilter(lua_State *L)
 {
 	Image::FilterMode min;
 	}
 }
 
-int w_getColorMode(lua_State *L)
-{
-	Graphics::ColorMode mode = instance->getColorMode();
-	const char *str;
-	if (!Graphics::getConstant(mode, str))
-		return luaL_error(L, "Unknown color mode");
-	lua_pushstring(L, str);
-	return 1;
-}
-
 int w_getDefaultImageFilter(lua_State *L)
 {
 	const Image::Filter &f = instance->getDefaultImageFilter();
 	{ "getFont", w_getFont },
 
 	{ "setBlendMode", w_setBlendMode },
-	{ "setColorMode", w_setColorMode },
 	{ "setDefaultImageFilter", w_setDefaultImageFilter },
 	{ "getBlendMode", w_getBlendMode },
-	{ "getColorMode", w_getColorMode },
 	{ "getDefaultImageFilter", w_getDefaultImageFilter },
 	{ "setLineWidth", w_setLineWidth },
 	{ "setLineStyle", w_setLineStyle },

File src/modules/graphics/opengl/wrap_Graphics.h

 int w_setFont(lua_State *L);
 int w_getFont(lua_State *L);
 int w_setBlendMode(lua_State *L);
-int w_setColorMode(lua_State *L);
 int w_setDefaultImageFilter(lua_State *L);
 int w_getBlendMode(lua_State *L);
-int w_getColorMode(lua_State *L);
 int w_getDefaultImageFilter(lua_State *L);
 int w_setLineWidth(lua_State *L);
 int w_setLineStyle(lua_State *L);