package speiger.src.coreengine.rendering.utils.states;

import org.lwjgl.opengl.GL11;

import speiger.src.coreengine.rendering.utils.values.GLCullType;
import speiger.src.coreengine.rendering.utils.values.GLPoligonMode;

public class GLWireFrame implements IGLState
{
	final GLCullType id;
	GLPoligonMode defaultState = GLPoligonMode.FILL;
	GLPoligonMode state = GLPoligonMode.FILL;
	
	public GLWireFrame(GLCullType id) {
		this.id = id;
	}
	
	public GLWireFrame set(GLPoligonMode state) {
		if(this.state != state) {
			this.state = state;
			GL11.glPolygonMode(id.glValue(), state.glValue());
		}
		return this;
	}
	
	@Override
	public void setDefault() {
		set(defaultState);
	}

	@Override
	public void reapply() {
		GL11.glPolygonMode(id.glValue(), state.glValue());
	}
}