package Basicsource;

import static Support.Resources.*;
import java.awt.event.*;
import com.jogamp.opengl.GL4;


/**
 * @author Yu Sangzhuoyang
 * @version 6.14
 */
public class Painter
{
	
	public Painter()
	{
		
	}
	
	protected void setup()
	{
		gl.glEnable(GL4.GL_DEPTH_TEST); //enable depth testing
		gl.glEnable(GL4.GL_MULTISAMPLE);//enable multi-sampling antialiasing
		//gl.glEnable(GL4.GL_BLEND);
		
		gl.glDepthFunc(GL4.GL_LEQUAL);  //the type of depth test to do
		
		// Linear filter is more compute-intensive
        // Use linear filter if image is larger than the original texture
		gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MAG_FILTER, GL4.GL_LINEAR);
        // Use linear filter if image is smaller than the original texture
		gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MIN_FILTER, GL4.GL_LINEAR_MIPMAP_LINEAR);
	}
	
	protected void render()
	{
		gl.glViewport(0, 0, displayWidth, displayHeight);
		gl.glClear(GL4.GL_COLOR_BUFFER_BIT | GL4.GL_DEPTH_BUFFER_BIT);
	}
	
	public void destroy()
	{
		
	}
	
	protected void keyEvents(KeyEvent e)
	{
		
	}
}