From 3b2e7cc2347d88dbd8d7697a7cbd8354e7728fc0 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 19 May 2020 21:41:09 +0200 Subject: Added OpenGL boilerplate --- inc/mandel.h | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/mandel.h b/inc/mandel.h index a98e007..f55466c 100644 --- a/inc/mandel.h +++ b/inc/mandel.h @@ -1,18 +1,27 @@ #ifndef MANDEL_H # define MANDEL_H +# include # include # include # include -# include +# include # include +# include + #define SDL_CALL(x) do { \ SDL_ClearError(); \ x; \ error_check_sdl(#x, __FILE__, __LINE__); \ } while (0) +# define GL_CALL(x) do { \ + error_clear_gl(); \ + x; \ + error_check_gl(#x, __FILE__, __LINE__); \ +} while (0) + typedef union { uint32_t data; @@ -37,13 +46,30 @@ typedef struct double y; } Point; +typedef struct +{ + unsigned int id; + struct + { + int iteration; + } location; +} Shader; + typedef struct { SDL_Window *window; - SDL_Renderer *renderer; + SDL_GLContext context; bool running; - SDL_Texture *texture; - Color *palette; + int width; + int height; + + unsigned int vertex_buf; + unsigned int texture; + + Shader shader; + + // Color *palette; + double real_start; double real_end; double imag_start; @@ -64,8 +90,13 @@ void event_handle(State *state); // error.c void error_check_sdl(const char *code, const char *filename, int line_num); +void error_clear_gl(void); +void error_check_gl(const char *code, const char *filename, int line_num); // color.c Color *color_palette_new(Color *palette, int iterations); +// shader.c +bool shader_init(Shader *shader); + #endif -- cgit