What is a good way to think about this? Are handles lost?
glCreateProgram()?
glCreateShader()?
glGenTextures()?
glGenBuffers()?
Im wondering if I am doing what’s necessary (or doing too much and leaking memory)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How do you lose a context? The OpenGL context will exist until you destroy it (or the window/HDC).
However, all OpenGL objects are bound to the context(s) that they are created in. If you destroy the context, all objects are destroyed as well (unless you have shared objects with another context. In which case, only the sharable objects will remain). So you must reload them.
If the OpenGL context is destroyed, you must call whatever OpenGL functions you need to recreate your objects. Any OpenGL objects that you got from the old context are gone. They are invalid. They are deleted pointers, and using deleted pointers is always wrong.
A new OpenGL context is new. So you must create your objects as though it were a new context. Because it is.