| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -32,19 +32,46 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <glad/glad.h> | 
					 | 
					 | 
					 | 
					#include <glad/glad.h> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <GLFW/glfw3.h> | 
					 | 
					 | 
					 | 
					#include <GLFW/glfw3.h> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#if defined(_MSC_VER) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 // Make MS math.h define M_PI
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 #define _USE_MATH_DEFINES | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#include "linmath.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <stdio.h> | 
					 | 
					 | 
					 | 
					#include <stdio.h> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <stdlib.h> | 
					 | 
					 | 
					 | 
					#include <stdlib.h> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "getopt.h" | 
					 | 
					 | 
					 | 
					#include "getopt.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void error_callback(int error, const char* description) | 
					 | 
					 | 
					 | 
					static const struct | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    fprintf(stderr, "Error: %s\n", description); | 
					 | 
					 | 
					 | 
					    float x, y; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} vertices[4] = | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    { -0.6f, -0.6f }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {  0.6f, -0.6f }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {  0.6f,  0.6f }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    { -0.6f,  0.6f } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					static const char* vertex_shader_text = | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"uniform mat4 MVP;\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"attribute vec2 vPos;\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"void main()\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"{\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"    gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"}\n"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					static const char* fragment_shader_text = | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"void main()\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"{\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"    gl_FragColor = vec4(1.0);\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					"}\n"; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void framebuffer_size_callback(GLFWwindow* window, int width, int height) | 
					 | 
					 | 
					 | 
					static void error_callback(int error, const char* description) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glViewport(0, 0, width, height); | 
					 | 
					 | 
					 | 
					    fprintf(stderr, "Error: %s\n", description); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) | 
					 | 
					 | 
					 | 
					static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -69,6 +96,8 @@ int main(int argc, char** argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    int ch, samples = 4; | 
					 | 
					 | 
					 | 
					    int ch, samples = 4; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    GLFWwindow* window; | 
					 | 
					 | 
					 | 
					    GLFWwindow* window; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    GLuint vertex_buffer, vertex_shader, fragment_shader, program; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    GLint mvp_location, vpos_location, vcol_location; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    while ((ch = getopt(argc, argv, "hs:")) != -1) | 
					 | 
					 | 
					 | 
					    while ((ch = getopt(argc, argv, "hs:")) != -1) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    { | 
					 | 
					 | 
					 | 
					    { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -97,7 +126,8 @@ int main(int argc, char** argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        printf("Requesting that MSAA not be available\n"); | 
					 | 
					 | 
					 | 
					        printf("Requesting that MSAA not be available\n"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwWindowHint(GLFW_SAMPLES, samples); | 
					 | 
					 | 
					 | 
					    glfwWindowHint(GLFW_SAMPLES, samples); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); | 
					 | 
					 | 
					 | 
					    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL); | 
					 | 
					 | 
					 | 
					    window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (!window) | 
					 | 
					 | 
					 | 
					    if (!window) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -107,56 +137,80 @@ int main(int argc, char** argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwSetKeyCallback(window, key_callback); | 
					 | 
					 | 
					 | 
					    glfwSetKeyCallback(window, key_callback); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwMakeContextCurrent(window); | 
					 | 
					 | 
					 | 
					    glfwMakeContextCurrent(window); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); | 
					 | 
					 | 
					 | 
					    gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwSwapInterval(1); | 
					 | 
					 | 
					 | 
					    glfwSwapInterval(1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (!GLAD_GL_ARB_multisample && !GLAD_GL_VERSION_1_3) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        printf("Multisampling is not supported\n"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glfwTerminate(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        exit(EXIT_FAILURE); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwShowWindow(window); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glGetIntegerv(GL_SAMPLES, &samples); | 
					 | 
					 | 
					 | 
					    glGetIntegerv(GL_SAMPLES, &samples); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (samples) | 
					 | 
					 | 
					 | 
					    if (samples) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        printf("Context reports MSAA is available with %i samples\n", samples); | 
					 | 
					 | 
					 | 
					        printf("Context reports MSAA is available with %i samples\n", samples); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    else | 
					 | 
					 | 
					 | 
					    else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        printf("Context reports MSAA is unavailable\n"); | 
					 | 
					 | 
					 | 
					        printf("Context reports MSAA is unavailable\n"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glMatrixMode(GL_PROJECTION); | 
					 | 
					 | 
					 | 
					    glGenBuffers(1, &vertex_buffer); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glOrtho(0.f, 1.f, 0.f, 0.5f, 0.f, 1.f); | 
					 | 
					 | 
					 | 
					    glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glMatrixMode(GL_MODELVIEW); | 
					 | 
					 | 
					 | 
					    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    vertex_shader = glCreateShader(GL_VERTEX_SHADER); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glCompileShader(vertex_shader); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glCompileShader(fragment_shader); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    program = glCreateProgram(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glAttachShader(program, vertex_shader); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glAttachShader(program, fragment_shader); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glLinkProgram(program); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    mvp_location = glGetUniformLocation(program, "MVP"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    vpos_location = glGetAttribLocation(program, "vPos"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glEnableVertexAttribArray(vpos_location); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                          sizeof(vertices[0]), (void*) 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    while (!glfwWindowShouldClose(window)) | 
					 | 
					 | 
					 | 
					    while (!glfwWindowShouldClose(window)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    { | 
					 | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        GLfloat time = (GLfloat) glfwGetTime(); | 
					 | 
					 | 
					 | 
					        float ratio; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        int width, height; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mat4x4 m, p, mvp; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        const double angle = glfwGetTime() * M_PI / 180.0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glfwGetFramebufferSize(window, &width, &height); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        ratio = width / (float) height; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glViewport(0, 0, width, height); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glClear(GL_COLOR_BUFFER_BIT); | 
					 | 
					 | 
					 | 
					        glClear(GL_COLOR_BUFFER_BIT); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glLoadIdentity(); | 
					 | 
					 | 
					 | 
					        glUseProgram(program); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glTranslatef(0.25f, 0.25f, 0.f); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glRotatef(time, 0.f, 0.f, 1.f); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glDisable(GL_MULTISAMPLE_ARB); | 
					 | 
					 | 
					 | 
					        mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 0.f, 1.f); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glRectf(-0.15f, -0.15f, 0.15f, 0.15f); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glLoadIdentity(); | 
					 | 
					 | 
					 | 
					        mat4x4_translate(m, -1.f, 0.f, 0.f); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glTranslatef(0.75f, 0.25f, 0.f); | 
					 | 
					 | 
					 | 
					        mat4x4_rotate_Z(m, m, (float) angle); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glRotatef(time, 0.f, 0.f, 1.f); | 
					 | 
					 | 
					 | 
					        mat4x4_mul(mvp, p, m); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glEnable(GL_MULTISAMPLE_ARB); | 
					 | 
					 | 
					 | 
					        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glRectf(-0.15f, -0.15f, 0.15f, 0.15f); | 
					 | 
					 | 
					 | 
					        glDisable(GL_MULTISAMPLE); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mat4x4_translate(m, 1.f, 0.f, 0.f); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mat4x4_rotate_Z(m, m, (float) angle); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mat4x4_mul(mvp, p, m); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glEnable(GL_MULTISAMPLE); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glfwSwapBuffers(window); | 
					 | 
					 | 
					 | 
					        glfwSwapBuffers(window); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        glfwPollEvents(); | 
					 | 
					 | 
					 | 
					        glfwPollEvents(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    glfwDestroyWindow(window); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    glfwTerminate(); | 
					 | 
					 | 
					 | 
					    glfwTerminate(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    exit(EXIT_SUCCESS); | 
					 | 
					 | 
					 | 
					    exit(EXIT_SUCCESS); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |