+ // Allocate an FBO with the the given texture(s) bound as framebuffer attachment(s),
+ // or fetch a previous used if possible. Unbinds GL_FRAMEBUFFER afterwards.
+ // Keeps ownership of the FBO; you must call release_fbo() of deleting
+ // it when you no longer want it.
+ //
+ // NOTE: In principle, the FBO doesn't have a resolution or pixel format;
+ // you can bind almost whatever texture you want to it. However, changing
+ // textures can have an adverse effect on performance due to validation,
+ // in particular on NVidia cards. Also, keep in mind that FBOs are not
+ // shareable across contexts, so you must have the context that's supposed
+ // to own the FBO current when you create or release it.
+ GLuint create_fbo(GLuint texture0_num,
+ GLuint texture1_num = 0,
+ GLuint texture2_num = 0,
+ GLuint texture3_num = 0);
+ void release_fbo(GLuint fbo_num);
+
+ // Create a VAO of a very specific form: All the given attribute indices
+ // are bound to start of the given VBO and contain two-component floats.
+ // Keeps ownership of the VAO; you must call release_vec2_vao() of deleting
+ // it when you no longer want it. VAOs are not sharable across contexts.
+ //
+ // These are not cached primarily for performance, but rather to work
+ // around an NVIDIA driver bug where glVertexAttribPointer() is thread-hostile
+ // (ie., simultaneous GL work in unrelated contexts can cause the driver
+ // to free() memory that was never malloc()-ed).
+ GLuint create_vec2_vao(const std::set<GLint> &attribute_indices,
+ GLuint vbo_num);
+ void release_vec2_vao(const GLuint vao_num);
+
+ // Informs the ResourcePool that the current context is going away soon,
+ // and that any resources held for it in the freelist should be deleted.
+ //
+ // You do not need to do this for the last context; the regular destructor
+ // will take care of that. This means that if you only ever use one
+ // thread/context, you never need to call this function.
+ void clean_context();
+