package speiger.src.coreengine.platform.graphics.opengl.core;

import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL;

import speiger.src.coreengine.assets.manager.AssetManager;
import speiger.src.coreengine.platform.graphics.api.core.Graphics;
import speiger.src.coreengine.platform.input.window.Window;

public class GLGraphics implements Graphics {
	AssetManager manager;
	
	public GLGraphics(AssetManager manager) {
		this.manager = manager;
	}

	@Override
	public String getName() {
		return "OpenGL";
	}
	
	@Override
	public void setupWindowArguments() {
		GLFW.glfwDefaultWindowHints();
		GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
		
		GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 4);
		GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 0);
		GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
		GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
	}
	
	@Override
	public GLGraphicsDevice createDevice(Window window) {
		return new GLGraphicsDevice(window, manager, GL.createCapabilities());
	}
	
}
