32 #include <glad/glad.h> 37 #define _USE_MATH_DEFINES 58 "attribute vec2 vPos;\n" 61 " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" 68 " gl_FragColor = vec4(1.0);\n" 73 fprintf(stderr,
"Error: %s\n", description);
94 printf(
"Usage: msaa [-h] [-s SAMPLES]\n");
97 int main(
int argc,
char** argv)
101 GLuint vertex_buffer, vertex_shader, fragment_shader,
program;
102 GLint mvp_location, vpos_location;
104 while ((ch =
getopt(argc, argv,
"hs:")) != -1)
126 printf(
"Requesting MSAA with %i samples\n", samples);
128 printf(
"Requesting that MSAA not be available\n");
149 printf(
"Context reports MSAA is available with %i samples\n", samples);
151 printf(
"Context reports MSAA is unavailable\n");
185 ratio = width / (float) height;
The header of the GLFW 3 API.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
static void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
int main(int argc, char **argv)
#define glGetAttribLocation
static const vec2 vertices[4]
void *(* GLADloadproc)(const char *name)
static GLFWwindow * window
static void error_callback(int error, const char *description)
#define GLFW_CONTEXT_VERSION_MAJOR
Context client API major version hint and attribute.
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
#define glUniformMatrix4fv
static void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
int getopt(int argc, char *const argv[], const char *optstring)
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
#define glVertexAttribPointer
static void mat4x4_translate(mat4x4 T, float x, float y, float z)
#define glEnableVertexAttribArray
#define GL_COLOR_BUFFER_BIT
GLbitfield GLuint program
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
GLint GLsizei GLsizei height
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
#define glGetUniformLocation
#define GL_FRAGMENT_SHADER
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
GLAPI int gladLoadGLLoader(GLADloadproc)
static const textual_icon exit
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
GLFWAPI void glfwDestroyWindow(GLFWwindow *window)
Destroys the specified window and its context.
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
#define GLFW_SAMPLES
Framebuffer MSAA samples hint.
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
static void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
#define GLFW_CONTEXT_VERSION_MINOR
Context client API minor version hint and attribute.
static const char * fragment_shader_text
static const char * vertex_shader_text
struct GLFWwindow GLFWwindow
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.