diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-19 21:41:09 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-19 21:41:09 +0200 |
| commit | 3b2e7cc2347d88dbd8d7697a7cbd8354e7728fc0 (patch) | |
| tree | 56cd83dca6d3627844347cc2ca86a6f6255f87d5 /inc | |
| parent | b0998910dd974280b3c6f3f65e21bfd5859b117f (diff) | |
| download | mandelbrot-3b2e7cc2347d88dbd8d7697a7cbd8354e7728fc0.tar.gz mandelbrot-3b2e7cc2347d88dbd8d7697a7cbd8354e7728fc0.tar.bz2 mandelbrot-3b2e7cc2347d88dbd8d7697a7cbd8354e7728fc0.zip | |
Added OpenGL boilerplate
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/mandel.h | 39 |
1 files changed, 35 insertions, 4 deletions
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 <stdio.h> # include <stdlib.h> # include <stdbool.h> # include <math.h> -# include <immintrin.h> +# include <GL/glew.h> # include <SDL2/SDL.h> +# include <assert.h> + #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; @@ -39,11 +48,28 @@ typedef struct 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 |
