27 #include <glad/glad.h> 41 { -0.6f, -0.4f, 1.f, 0.f, 0.f },
42 { 0.6f, -0.4f, 0.f, 1.f, 0.f },
43 { 0.f, 0.6f, 0.f, 0.f, 1.f }
49 "attribute vec3 vCol;\n" 50 "attribute vec2 vPos;\n" 51 "varying vec3 color;\n" 54 " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" 60 "varying vec3 color;\n" 63 " gl_FragColor = vec4(color, 1.0);\n" 68 fprintf(stderr,
"Error: %s\n", description);
80 GLuint vertex_buffer, vertex_shader, fragment_shader,
program;
81 GLint mvp_location, vpos_location, vcol_location;
132 sizeof(
vertices[0]), (
void*) (
sizeof(
float) * 2));
141 ratio = width / (float) height;
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
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)
#define glGetAttribLocation
static void mat4x4_identity(mat4x4 M)
void *(* GLADloadproc)(const char *name)
static GLFWwindow * window
#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)
static const char * vertex_shader_text
static const struct @20 vertices[3]
[code]
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
#define glVertexAttribPointer
static void error_callback(int error, const char *description)
#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
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.
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.
struct GLFWwindow GLFWwindow
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
static const char * fragment_shader_text
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.