schroedinger-solver/src/renderer/context.c

38 lines
635 B
C
Raw Normal View History

2022-10-16 12:13:13 +00:00
#include "context.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
2022-10-16 21:43:22 +00:00
#include "buffer.h"
2022-10-16 12:13:13 +00:00
int ctx_init()
{
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
}
void ctx_viewport(int x, int y, int w, int h)
{
glViewport(x, y, w, h);
}
void ctx_clear_screen(float r, float g, float b, float a)
{
glClearColor(r, g, b, a);
2022-10-18 14:57:14 +00:00
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
2022-10-16 12:13:13 +00:00
}
2022-10-16 21:43:22 +00:00
void ctx_draw_elements(VertexArrayObject* vao)
{
bind_vao(*vao);
glDrawElements(GL_TRIANGLES, vao->elements, GL_UNSIGNED_INT, (void*)0);
}
2022-10-18 14:57:14 +00:00
void ctx_enable(int feature)
{
glEnable(feature);
}
void ctx_front_face(int front)
{
glFrontFace(front);
}