December 9,2009 by gleicher (link) glContexts – or why don my textures and shaders load?
If your textures or shaders aren’t loading correctly, the problem might be when you’re doing it, even if you are doing it correctly. This is a common problem. You can only make calls to OpenGL (for example to initialize a texture or load a shader) once OpenGL is fully initialized and ready to go. Also, once you have OpenGL ready to go, you can only do things if OpenGL knows which window to associate the commands with. This is called “having a GL context.” So, basically, the only time you can make calls to OpenGL (including loading shaders or textures) is inside of the “draw” method of an FlTk Widget (or the draw methods of your object). If you look at the sample code, you’ll notice that things get initialized the first time draw is called (rather than in the constructor).
Related Questions
- How do I create a link inside a frame that, when clicked, will cause the page to load in a new browser window without the frames?
- Link to External Source Article Thursday, December 03, 2009 How Best To Teach Children About Religion?
- What is a roller chain connecting link used for and what is its impact on the chains load capacity?