| @@ -49,7 +49,7 @@ public: | |||||
| For some quick ways of creating callback objects, see the ModalCallbackFunction class. | For some quick ways of creating callback objects, see the ModalCallbackFunction class. | ||||
| @see ModalCallbackFunction | @see ModalCallbackFunction | ||||
| */ | */ | ||||
| class Callback | |||||
| class JUCE_API Callback | |||||
| { | { | ||||
| public: | public: | ||||
| /** */ | /** */ | ||||
| @@ -22,8 +22,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| OpenGLShaderProgram::OpenGLShaderProgram (const OpenGLContext& c) noexcept | |||||
| : context (c), programID (0) | |||||
| OpenGLShaderProgram::OpenGLShaderProgram (const OpenGLContext& c) noexcept : context (c) | |||||
| { | { | ||||
| } | } | ||||
| @@ -31,7 +31,10 @@ | |||||
| class JUCE_API OpenGLShaderProgram | class JUCE_API OpenGLShaderProgram | ||||
| { | { | ||||
| public: | public: | ||||
| /** Creates a shader for use in a particular GL context. */ | |||||
| OpenGLShaderProgram (const OpenGLContext&) noexcept; | OpenGLShaderProgram (const OpenGLContext&) noexcept; | ||||
| /** Destructor. */ | |||||
| ~OpenGLShaderProgram() noexcept; | ~OpenGLShaderProgram() noexcept; | ||||
| /** Returns the version of GLSL that the current context supports. | /** Returns the version of GLSL that the current context supports. | ||||
| @@ -124,7 +127,7 @@ public: | |||||
| Be careful not to call the set() functions unless the appropriate program | Be careful not to call the set() functions unless the appropriate program | ||||
| is loaded into the current context. | is loaded into the current context. | ||||
| */ | */ | ||||
| struct Uniform | |||||
| struct JUCE_API Uniform | |||||
| { | { | ||||
| /** Initialises a uniform. | /** Initialises a uniform. | ||||
| The program must have been successfully linked when this | The program must have been successfully linked when this | ||||
| @@ -169,13 +172,13 @@ public: | |||||
| After a program has been linked, you can create Attribute objects to let you | After a program has been linked, you can create Attribute objects to let you | ||||
| set the attributes that your vertex shaders use. | set the attributes that your vertex shaders use. | ||||
| */ | */ | ||||
| struct Attribute | |||||
| struct JUCE_API Attribute | |||||
| { | { | ||||
| /** Initialises an attribute. | /** Initialises an attribute. | ||||
| The program must have been successfully linked when this | The program must have been successfully linked when this | ||||
| constructor is called. | constructor is called. | ||||
| */ | */ | ||||
| Attribute (const OpenGLShaderProgram& program, const char* attributeName); | |||||
| Attribute (const OpenGLShaderProgram&, const char* attributeName); | |||||
| /** The attribute's ID number. | /** The attribute's ID number. | ||||
| If the uniform couldn't be found, this value will be < 0. | If the uniform couldn't be found, this value will be < 0. | ||||
| @@ -188,7 +191,7 @@ public: | |||||
| private: | private: | ||||
| const OpenGLContext& context; | const OpenGLContext& context; | ||||
| mutable GLuint programID; | |||||
| mutable GLuint programID = 0; | |||||
| String errorLog; | String errorLog; | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram) | ||||
| @@ -22,7 +22,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| OpenGLAppComponent::OpenGLAppComponent() : frameCounter (0) | |||||
| OpenGLAppComponent::OpenGLAppComponent() | |||||
| { | { | ||||
| setOpaque (true); | setOpaque (true); | ||||
| openGLContext.setRenderer (this); | openGLContext.setRenderer (this); | ||||
| @@ -33,11 +33,13 @@ | |||||
| paint() and mouse-handling. The base class provides some simple abstractions | paint() and mouse-handling. The base class provides some simple abstractions | ||||
| to take care of continuously repainting itself. | to take care of continuously repainting itself. | ||||
| */ | */ | ||||
| class OpenGLAppComponent : public Component, | |||||
| private OpenGLRenderer | |||||
| class JUCE_API OpenGLAppComponent : public Component, | |||||
| private OpenGLRenderer | |||||
| { | { | ||||
| public: | public: | ||||
| OpenGLAppComponent(); | OpenGLAppComponent(); | ||||
| /** Destructor. */ | |||||
| ~OpenGLAppComponent(); | ~OpenGLAppComponent(); | ||||
| /** Returns the number of times that the render method has been called since | /** Returns the number of times that the render method has been called since | ||||
| @@ -45,6 +47,9 @@ public: | |||||
| */ | */ | ||||
| int getFrameCounter() const noexcept { return frameCounter; } | int getFrameCounter() const noexcept { return frameCounter; } | ||||
| /** This must be called from your subclass's destructor, to shut down | |||||
| the GL system and stop it calling render() before your class is destroyed. | |||||
| */ | |||||
| void shutdownOpenGL(); | void shutdownOpenGL(); | ||||
| /** Implement this method to set up any GL objects that you need for rendering. | /** Implement this method to set up any GL objects that you need for rendering. | ||||
| @@ -57,16 +62,17 @@ public: | |||||
| */ | */ | ||||
| virtual void shutdown() = 0; | virtual void shutdown() = 0; | ||||
| /** | |||||
| /** Called to render your openGL. | |||||
| @see OpenGLRenderer::render() | |||||
| */ | */ | ||||
| virtual void render() = 0; | virtual void render() = 0; | ||||
| /** The GL context */ | |||||
| OpenGLContext openGLContext; | OpenGLContext openGLContext; | ||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| int frameCounter; | |||||
| int frameCounter = 0; | |||||
| void newOpenGLContextCreated() override; | void newOpenGLContextCreated() override; | ||||
| void renderOpenGL() override; | void renderOpenGL() override; | ||||