comparison Framework/OpenGL/OpenGLProgram.h @ 947:1091b2adeb5a toa2019081001

Fixed animation frame stopping when returning false + big work on the OpenGL objects to make them lost context-safe + debug code to forcefully tag a context as lost + debug macros
author Benjamin Golinvaux <bgo@osimis.io>
date Sat, 10 Aug 2019 13:07:31 +0200
parents e36e69a380a5
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
946:dbe3e1e47019 947:1091b2adeb5a
28 28
29 namespace OrthancStone 29 namespace OrthancStone
30 { 30 {
31 namespace OpenGL 31 namespace OpenGL
32 { 32 {
33 class IOpenGLContext;
34
33 class OpenGLProgram : public boost::noncopyable 35 class OpenGLProgram : public boost::noncopyable
34 { 36 {
35 private:
36 GLuint program_;
37
38 public: 37 public:
39 // WARNING: A global OpenGL context must be active to create this object! 38 // WARNING: A global OpenGL context must be active to create this object!
40 OpenGLProgram(); 39 // the context is only passed so that it can be checked for loss
40 // when destructing the program resource
41 OpenGLProgram(OpenGL::IOpenGLContext& context);
41 42
42 ~OpenGLProgram(); 43 ~OpenGLProgram();
43 44
44 void Use(); 45 void Use();
45 46
48 const std::string& fragmentCode); 49 const std::string& fragmentCode);
49 50
50 GLint GetUniformLocation(const std::string& name); 51 GLint GetUniformLocation(const std::string& name);
51 52
52 GLint GetAttributeLocation(const std::string& name); 53 GLint GetAttributeLocation(const std::string& name);
54 private:
55 GLuint program_;
56 OpenGL::IOpenGLContext& context_;
53 }; 57 };
54 } 58 }
55 } 59 }