Files
manigraph/src/context.c
2024-12-01 16:12:17 -06:00

26 lines
505 B
C

#include "main.h"
#ifdef EMSCRIPTEN
#include <GL/gl.h>
#else
#include <glad.h>
#include <GLFW/glfw3.h>
#endif
void set_clean_color_context(unsigned char r, unsigned char g, unsigned char b)
{
glEnable(GL_DEPTH_TEST);
glClearColor((float)r / 0xff, (float)g / 0xff, (float)b / 0xff, 1.0);
}
int init_context(void)
{
#ifdef EMSCRIPTEN
return 1;
#else
return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
#endif
}
void clean_context(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }