X-Git-Url: http://git.mutantstargoat.com?p=gl4;a=blobdiff_plain;f=main.c;h=de73cdc370c5eeaa13d8c60ed1a88b487c938c81;hp=67f7e8ce37cd507617b657cec74389fba6fa065e;hb=HEAD;hpb=6d6e752397e0f4e6a7b9841e41e4157b558769b8 diff --git a/main.c b/main.c index 67f7e8c..de73cdc 100644 --- a/main.c +++ b/main.c @@ -42,7 +42,6 @@ struct matrix_state { float lpos[3]; } __attribute__((packed)); -unsigned int sampler; unsigned int tex; int init(void); @@ -117,10 +116,6 @@ int init(void) return -1; } - glGenSamplers(1, &sampler); - glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if(gen_torus(&torus, 1.0, 0.25, 32, 12) == -1) { return -1; } @@ -135,11 +130,6 @@ int init(void) } #endif - if(link_program(sdr) == -1) { - fprintf(stderr, "failed to bind attribute locations\n"); - return -1; - } - glUseProgram(sdr); glGenBuffers(1, &ubo_matrix); @@ -161,7 +151,7 @@ void cleanup(void) glDeleteVertexArrays(1, &torus.vao); } glDeleteTextures(1, &tex); - glDeleteSamplers(1, &sampler); + glDeleteBuffers(1, &ubo_matrix); } void display(void) @@ -192,9 +182,7 @@ void display(void) glBindBufferBase(GL_UNIFORM_BUFFER, UBLOCK_MATRIX, ubo_matrix); glBindTexture(GL_TEXTURE_2D, tex); - glBindSampler(0, sampler); draw_mesh(&torus); - glBindSampler(0, 0); assert(glGetError() == GL_NO_ERROR); glutSwapBuffers(); @@ -483,6 +471,10 @@ unsigned int load_program(const char *vfname, const char *pfname) glDeleteProgram(prog); return 0; } + + glDetachShader(prog, vs); + glDetachShader(prog, ps); + return prog; }