Port to web for free

This commit is contained in:
PedroEdiaz
2024-11-19 21:54:22 -06:00
parent c4016d239a
commit 61b014a803
4 changed files with 71 additions and 27 deletions

View File

@@ -1,10 +1,15 @@
#include "main.h"
#ifdef EMSCRIPTEN
#include <GL/gl.h>
#else
#ifdef GLAD
#include <GLFW/glfw3.h>
#include <glad.h>
#else
#include <GL/glew.h>
#endif
#endif
void set_clean_color_context(unsigned char r, unsigned char g, unsigned char b)
{
@@ -15,12 +20,16 @@ void set_clean_color_context(unsigned char r, unsigned char g, unsigned char b)
int init_context(void)
{
#ifdef EMSCRIPTEN
return 1;
#else
#ifdef GLAD
return gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
#else
return glewInit();
#endif
#endif
}
void clean_context(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }