X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=resource_pool.h;h=6f4d22d0a4001bd23008fa456348afde0c930c5b;hp=a6e4327b2e953ca5747f6b6dfac8d6e8811426f3;hb=c1118618a82c0b3b2e7c87ee74fa3c82c5b5754a;hpb=edb0700c0a8ea225ce9add1cb4f70d42af6de381 diff --git a/resource_pool.h b/resource_pool.h index a6e4327..6f4d22d 100644 --- a/resource_pool.h +++ b/resource_pool.h @@ -41,6 +41,15 @@ public: GLuint compile_glsl_program(const std::string& vertex_shader, const std::string& fragment_shader); void release_glsl_program(GLuint glsl_program_num); + // Allocate a 2D texture of the given internal format and dimensions, + // or fetch a previous used if possible. Unbinds GL_TEXTURE_2D afterwards. + // Keeps ownership of the texture; you must call release_2d_texture() instead + // of deleting it when you no longer want it. + // + // Note: Currently we do not actually have a freelist, but this will change soon. + GLuint create_2d_texture(GLint internal_format, GLsizei width, GLsizei height); + void release_2d_texture(GLuint texture_num); + private: // Delete the given program and both its shaders. void delete_program(GLuint program_num); @@ -62,7 +71,8 @@ private: std::map > program_shaders; // A list of programs that are no longer in use, most recently freed first. - // Once this reaches , + // Once this reaches , the last element + // will be deleted. std::list program_freelist; };