From 9e004cdb5b35e3bba1682cffc069babc547f1ad0 Mon Sep 17 00:00:00 2001 From: ktyl Date: Wed, 7 Jul 2021 00:49:22 +0100 Subject: [PATCH] smidge of refactoring --- readme.md | 7 +++++++ src/gfx.c | 7 +++---- src/gfx.h | 4 +--- src/main.c | 3 +-- src/stb_image.h | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..8e9237c --- /dev/null +++ b/readme.md @@ -0,0 +1,7 @@ +# oglc + +## sources + +[learnogengl](https://learnopengl.com/) +[Anton's OpenGL 4 Tutorials](https://antongerdelan.net/opengl/compute.html) + diff --git a/src/gfx.c b/src/gfx.c index 5dc53ab..ca888e9 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -6,12 +6,9 @@ const char* fragShaderPath = "res/shader/shader.frag"; SDL_Window* sdlWindow; SDL_GLContext* sdlContext; -SDL_Window* getWindow() { return sdlWindow; } -SDL_GLContext* getContext() { return sdlContext; } - GLuint compileShader(const char* path, GLenum type); -void gfxInit() +SDL_Window* gfxInit() { // load sdl modules if (SDL_Init(SDL_INIT_VIDEO) != 0) @@ -43,6 +40,8 @@ void gfxInit() int availableAttributes; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &availableAttributes); //printf("max vertex attributes %d\n", availableAttributes); + + return sdlWindow; } unsigned int compileShaderProgram() diff --git a/src/gfx.h b/src/gfx.h index 6e752f7..3c16dbf 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -9,9 +9,7 @@ #include "io.h" -void gfxInit(); -SDL_Window* getWindow(); -SDL_GLContext* getContext(); +SDL_Window* gfxInit(); unsigned int compileShaderProgram(); diff --git a/src/main.c b/src/main.c index a0c81c0..f29bbe9 100644 --- a/src/main.c +++ b/src/main.c @@ -26,8 +26,7 @@ float time(); int main() { - gfxInit(); - SDL_Window* window = getWindow(); + SDL_Window* window = gfxInit(); // generate opengl texture unsigned int texture; diff --git a/src/stb_image.h b/src/stb_image.h index 4f4e8ec..db24532 100644 --- a/src/stb_image.h +++ b/src/stb_image.h @@ -6775,8 +6775,8 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, stbi_uc *two_back = 0; stbi__gif g; int stride; - //int out_size = 0; - //int delays_size = 0; + int out_size = 0; + int delays_size = 0; memset(&g, 0, sizeof(g)); if (delays) { *delays = 0;