diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-20 07:41:03 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-20 07:41:03 +0200 |
| commit | 09a819b2ef927adf5239a73f91cdfcefd6774688 (patch) | |
| tree | 8602814faa153aae01acc95a557d45b24c028f3b /src/state.c | |
| parent | 70bf7ac330545f14ab9babddfdf0cb5df9e9ee69 (diff) | |
| download | mandelbrot-09a819b2ef927adf5239a73f91cdfcefd6774688.tar.gz mandelbrot-09a819b2ef927adf5239a73f91cdfcefd6774688.tar.bz2 mandelbrot-09a819b2ef927adf5239a73f91cdfcefd6774688.zip | |
Added colors with 1D texture
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/state.c b/src/state.c index 3468464..37eeccc 100644 --- a/src/state.c +++ b/src/state.c @@ -24,6 +24,7 @@ bool state_init(State *state) perror(NULL); return false; } + SDL_GL_GetDrawableSize(state->window, &state->width, &state->height); GL_CALL(glViewport(0, 0, state->width, state->height)); @@ -45,10 +46,10 @@ bool state_init(State *state) GL_CALL(glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0)); GL_CALL(glEnableVertexAttribArray(0)); - /* state->palette = color_palette_new(NULL, MANDEL_ITERATIONS); */ - /* if (state->palette == NULL) */ - /* return false; */ state->iterations = MANDEL_ITERATIONS; + state->texture = color_texture_new(1024); + if (state->texture == 0) + return false; state->real_start = -2.0; state->real_end = 2.0; state->imag_start = -2.0; @@ -77,7 +78,9 @@ void state_run(State *state) void state_quit(State *state) { - /* free(state->palette); */ + GL_CALL(glDeleteTextures(1, &state->texture)); + GL_CALL(glDeleteBuffers(1, &state->vertex_buf)); + GL_CALL(glDeleteVertexArrays(1, &state->vertex_array)); GL_CALL(glDeleteProgram(state->shader.id)); SDL_GL_DeleteContext(state->context); SDL_DestroyWindow(state->window); |
