From 6623e7fbdb4307536d3f5920c267c74f8bc6a989 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 11 May 2020 02:19:18 +0200 Subject: Generating triangles for polygon face in .obj file, opengl error/initialisation --- src/error.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/error.c (limited to 'src/error.c') diff --git a/src/error.c b/src/error.c new file mode 100644 index 0000000..17e2611 --- /dev/null +++ b/src/error.c @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* error.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/11 01:43:45 by charles #+# #+# */ +/* Updated: 2020/05/11 01:55:03 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "scop.h" + +void error_clear(void) +{ + while (glGetError() != GL_NO_ERROR) + ; +} + +void error_check(char *code, char *filename, int line_num) +{ + GLenum err; + bool occured; + + occured = false; + while ((err = glGetError()) != GL_NO_ERROR) + { + ft_putstr("[ERROR opengl] ("); + ft_putnbr(err); + ft_putstr(") "); + ft_putstr(code); + ft_putstr(" at "); + ft_putstr(filename); + ft_putchar(':'); + ft_putnbr(line_num); + ft_putchar('\n'); + occured = true; + } + if (occured) + exit(EXIT_FAILURE); +} -- cgit