package speiger.src.coreengine.platform.graphics.opengl.utils.states;

import org.lwjgl.opengl.GL11;

import speiger.src.coreengine.platform.graphics.api.shader.states.PolygonMode;
import speiger.src.coreengine.platform.graphics.opengl.utils.GLUtils;


public class GLPolygon implements IGLState
{
	PolygonMode defaultState = PolygonMode.FILL;
	PolygonMode state = PolygonMode.FILL;
	
	public GLPolygon set(PolygonMode state) {
		if(this.state == state) return this;
		this.state = state;
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GLUtils.toGL(state));
		return this;
	}
	
	@Override
	public void setDefault() {
		set(defaultState);
	}

	@Override
	public void reapply() {
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GLUtils.toGL(state));
	}
}