]> git.sesse.net Git - movit/blobdiff - resource_pool.h
Complete a forgotten comment.
[movit] / resource_pool.h
index a6e4327b2e953ca5747f6b6dfac8d6e8811426f3..6f4d22d0a4001bd23008fa456348afde0c930c5b 100644 (file)
@@ -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);
 
        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);
 private:
        // Delete the given program and both its shaders.
        void delete_program(GLuint program_num);
@@ -62,7 +71,8 @@ private:
        std::map<GLuint, std::pair<GLuint, GLuint> > program_shaders;
 
        // A list of programs that are no longer in use, most recently freed first.
        std::map<GLuint, std::pair<GLuint, GLuint> > program_shaders;
 
        // A list of programs that are no longer in use, most recently freed first.
-       // Once this reaches <program_freelist_max_length>, 
+       // Once this reaches <program_freelist_max_length>, the last element
+       // will be deleted.
        std::list<GLuint> program_freelist;
 };
 
        std::list<GLuint> program_freelist;
 };